@stacksjs/stx 0.2.160 → 0.2.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/craft.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var CK=Object.defineProperty;var vK=($)=>$;function xK($,Z){this[$]=vK.bind(null,Z)}var t=($,Z)=>{for(var Y in Z)CK($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:xK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var e=import.meta.require;function S8($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var y8,P8;var s7=b(()=>{y8={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},P8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function xW($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...H1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ var vK=Object.defineProperty;var xK=($)=>$;function fK($,Z){this[$]=xK.bind(null,Z)}var t=($,Z)=>{for(var Y in Z)vK($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:fK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var e=import.meta.require;function S8($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var y8,P8;var s7=b(()=>{y8={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},P8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function fW($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...H1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -9,7 +9,7 @@ var CK=Object.defineProperty;var vK=($)=>$;function xK($,Z){this[$]=vK.bind(null
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function fW(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function gW(){return`
13
13
  <script data-stx-scoped data-stx-run="once">
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function gW($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function hW($=0.1,Z="0px"){return`
40
+ `}function hW($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function uW($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped data-stx-run="always">
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function uW(){return`
83
+ `}function mW(){return`
84
84
  <style id="stx-animation-base">
85
85
  :root {
86
86
  --stx-transition-duration: 300ms;
@@ -195,7 +195,7 @@ else {
195
195
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
196
196
  }
197
197
  </style>
198
- `}function mW($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
198
+ `}function dW($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
199
199
  <script data-stx-scoped data-stx-run="always">
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function g8($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!gW(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=uW();X=X.replace("</head>",`${K}
236
- </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=hW(),q=X.lastIndexOf("</body>");if(q!==-1)X=X.slice(0,q)+W+`
237
- `+X.slice(q)}}return X}var H1,C8,v8,x8,f8;var o7=b(()=>{H1={duration:300,delay:0,ease:"ease",direction:"both"};C8={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||H1.duration:H1.duration,G=Z.length>2?Z[2]||H1.ease:H1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||H1.delay:H1.delay,W=Z.length>4?Z[4]||H1.direction:H1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=xW(X,{duration:Q,delay:K,ease:G,direction:W}),z="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${q}" class="${z} ${j} ${W==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},v8={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(X==="fade")z+=" stx-fade";else if(X==="slide-up"||X==="slide")z+=" stx-from-bottom";else if(X==="slide-down")z+=" stx-from-top";else if(X==="slide-left")z+=" stx-from-right";else if(X==="slide-right")z+=" stx-from-left";else if(X==="scale")z+=" stx-scale";else if(X.includes("-"))z+=` stx-${X}`;else z+=` stx-${X}`;return`<div id="${q}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},x8={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=mW(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},f8={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=fW();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as h8}from"stx-router";var u8=b(()=>{r7()});async function dW($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=h8();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var m8;var r7=b(()=>{u8();m8={name:"stxRouter",handler:dW,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function d8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...lW,...Z};return`
235
+ `}function g8($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!hW(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=mW();X=X.replace("</head>",`${K}
236
+ </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=uW(),q=X.lastIndexOf("</body>");if(q!==-1)X=X.slice(0,q)+W+`
237
+ `+X.slice(q)}}return X}var H1,C8,v8,x8,f8;var o7=b(()=>{H1={duration:300,delay:0,ease:"ease",direction:"both"};C8={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||H1.duration:H1.duration,G=Z.length>2?Z[2]||H1.ease:H1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||H1.delay:H1.delay,W=Z.length>4?Z[4]||H1.direction:H1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=fW(X,{duration:Q,delay:K,ease:G,direction:W}),z="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${q}" class="${z} ${j} ${W==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},v8={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(X==="fade")z+=" stx-fade";else if(X==="slide-up"||X==="slide")z+=" stx-from-bottom";else if(X==="slide-down")z+=" stx-from-top";else if(X==="slide-left")z+=" stx-from-right";else if(X==="slide-right")z+=" stx-from-left";else if(X==="scale")z+=" stx-scale";else if(X.includes("-"))z+=` stx-${X}`;else z+=` stx-${X}`;return`<div id="${q}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},x8={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=dW(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},f8={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=gW();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as h8}from"stx-router";var u8=b(()=>{r7()});async function lW($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=h8();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var m8;var r7=b(()=>{u8();m8={name:"stxRouter",handler:lW,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function d8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...pW,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,7 +619,7 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function l8($,Z){let Y=d8(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function pW($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var lW,p8;var a7=b(()=>{lW={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};p8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=pW(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return d8(X)}}});function D1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function c8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function n$($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
622
+ `}function l8($,Z){let Y=d8(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function cW($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var pW,p8;var a7=b(()=>{pW={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};p8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=cW(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return d8(X)}}});function D1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function c8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function n$($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
623
  `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let q=K.slice(0,W).trim(),U=K.slice(W+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}Q[q]=U}return{data:Q,content:X.trim()}}function n1($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,j)=>{let H=Q.length,B=z?` class="language-${D1(z)}"`:"";return Q.push(`<pre><code${B}>${D1(j.trim())}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),X=X.replace(/`([^`]*)`/g,(U,z)=>`<code>${D1(z)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,j)=>{return`<img src="${c8(j)?D1(j):""}" alt="${D1(z)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,j)=>{return`<a href="${c8(j)?D1(j):""}">${z}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,j)=>{let B=`<tr>${z.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${D1(O)}</th>`).join("")}</tr>`,_=j.trim().split(`
625
625
  `).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${D1(L)}</td>`).join("")}</tr>`}).join(`
@@ -637,7 +637,7 @@ ${_}
637
637
  `:`
638
638
  `)}</p>`);if(X=K.join(`
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
- `);for(let U=0;U<Q.length;U++)X=X.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function w5($="const",Z=[],Y){let J=Z.length?_1.filter((X)=>!Z.includes(X)):_1;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}function t7($){if(!$)return!1;return iW.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function e7($){if(!$)return!1;let Z=a8($);if(nW.some((Y)=>Y.test(Z)))return!0;return t7(Z)}function n8($){if(!$)return!1;return sW.test(a8($))||e7($)}function r8(){return`{${s8.map(($)=>`'${$}':1`).join(",")}}`}function a8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(J,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var _1,i8,cW,iW,nW,sW,s8,oW,o8;var Q1=b(()=>{_1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],i8=["onMount","onDestroy"];cW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],iW=_1.filter(($)=>!cW.includes($));nW=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],sW=/\s@[a-z][\w.:-]*\s*=/i;s8=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],oW=["x-init","x-transition","x-effect","x-on"],o8=[...s8,...oW]});function $Z($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(rW.has(J))Z.systemKeys.push(J);else if(J in ZZ)Z.mouse=J;else if(J in e8||/^[a-z]$/.test(J))Z.keys.push(e8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function YZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:q})}return Z}function aW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=ZZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function tW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function $3($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function eW($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=aW($),X=tW($3($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
640
+ `);for(let U=0;U<Q.length;U++)X=X.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function w5($="const",Z=[],Y){let J=Z.length?_1.filter((X)=>!Z.includes(X)):_1;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}function t7($){if(!$)return!1;return nW.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function e7($){if(!$)return!1;let Z=a8($);if(sW.some((Y)=>Y.test(Z)))return!0;return t7(Z)}function n8($){if(!$)return!1;return oW.test(a8($))||e7($)}function r8(){return`{${s8.map(($)=>`'${$}':1`).join(",")}}`}function a8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(J,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var _1,i8,iW,nW,sW,oW,s8,rW,o8;var Q1=b(()=>{_1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],i8=["onMount","onDestroy"];iW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],nW=_1.filter(($)=>!iW.includes($));sW=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],oW=/\s@[a-z][\w.:-]*\s*=/i;s8=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],rW=["x-init","x-transition","x-effect","x-on"],o8=[...s8,...rW]});function $Z($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(aW.has(J))Z.systemKeys.push(J);else if(J in ZZ)Z.mouse=J;else if(J in e8||/^[a-z]$/.test(J))Z.keys.push(e8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function YZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:q})}return Z}function tW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=ZZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function eW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function $3($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function $q($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=tW($),X=eW($3($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
641
641
  (function() {
642
642
  var $el = document.getElementById('${Y}');
643
643
  if (!$el) return;
@@ -746,16 +746,16 @@ else {
746
746
  }
747
747
 
748
748
  // Event listeners
749
- ${$.map(eW).join(`
749
+ ${$.map($q).join(`
750
750
  `)}
751
751
  })();
752
- </script>`}function $q($){let Z=YZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(U,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function JZ($,Z,Y){if(e7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=$q($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let J=YZ($);if(J.length===0)return $;let X=$;for(let K=J.length-1;K>=0;K--){let W=J[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let z of W.events)z.elementId=U[1]}for(let U of W.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");q=q.replace(j,""),q=q.replace(H,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let Q=Z3(J.flatMap((K)=>K.events)),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
753
- `+X.slice(G);else X+=Q;return X}var t8,e8,rW,ZZ;var Y3=b(()=>{Q1();t8=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"]),e8={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"},rW=new Set(["ctrl","alt","shift","meta"]),ZZ={left:0,middle:1,right:2}});function g0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
752
+ </script>`}function Zq($){let Z=YZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(U,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function JZ($,Z,Y){if(e7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=Zq($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let J=YZ($);if(J.length===0)return $;let X=$;for(let K=J.length-1;K>=0;K--){let W=J[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let z of W.events)z.elementId=U[1]}for(let U of W.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");q=q.replace(j,""),q=q.replace(H,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let Q=Z3(J.flatMap((K)=>K.events)),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
753
+ `+X.slice(G);else X+=Q;return X}var t8,e8,aW,ZZ;var Y3=b(()=>{Q1();t8=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"]),e8={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"},aW=new Set(["ctrl","alt","shift","meta"]),ZZ={left:0,middle:1,right:2}});function h0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
754
754
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
755
- `}),$}function s$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Zq(){let $=globalThis;return $[XZ]??=new Map,$[XZ]}function $0($,Z){let Y=Zq(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var XZ;var X$=b(()=>{XZ=Symbol.for("stx.lazy-module-promises")});function R5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Yq,"<\\/$1")}var Yq;var J3=b(()=>{Yq=/<\/(script)/gi});import Jq from"process";function P0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(Jq.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var E1=()=>{};import Q$ from"path";function GZ($){QZ=$?.trim()||null}function G$(){return process.env[Xq]?.trim()||QZ||A5}function K$($=process.cwd(),...Z){let Y=G$();return Q$.isAbsolute(Y)?Q$.join(Y,...Z):Q$.join($,Y,...Z)}function W$($){if(!$||Q$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==A5&&!Z.startsWith(`${A5}/`))return $;let Y=Z.slice(A5.length+1);return Y?Q$.join(G$(),Y):G$()}var A5=".stx",Xq="STX_DIR",QZ=null;var o$=()=>{};function Qq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function Gq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function X3($,Z){let Y=[];for(let J of Gq($)){if(Qq(J)){let X=J.position||void 0;Y.push({file:Z||X?.file,line:X?.line,column:X?.column,message:J.message??"",lineText:X?.lineText});continue}Y.push({file:Z,message:J instanceof Error?J.message:String(J)})}return Y}function KZ($,Z){return X3($,Z).map((Y)=>{let J=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",X=Y.lineText?`
755
+ `}),$}function s$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Yq(){let $=globalThis;return $[XZ]??=new Map,$[XZ]}function $0($,Z){let Y=Yq(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var XZ;var X$=b(()=>{XZ=Symbol.for("stx.lazy-module-promises")});function R5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Jq,"<\\/$1")}var Jq;var J3=b(()=>{Jq=/<\/(script)/gi});import Xq from"process";function P0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(Xq.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var E1=()=>{};import Q$ from"path";function GZ($){QZ=$?.trim()||null}function G$(){return process.env[Qq]?.trim()||QZ||A5}function K$($=process.cwd(),...Z){let Y=G$();return Q$.isAbsolute(Y)?Q$.join(Y,...Z):Q$.join($,Y,...Z)}function W$($){if(!$||Q$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==A5&&!Z.startsWith(`${A5}/`))return $;let Y=Z.slice(A5.length+1);return Y?Q$.join(G$(),Y):G$()}var A5=".stx",Qq="STX_DIR",QZ=null;var o$=()=>{};function Gq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function Kq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function X3($,Z){let Y=[];for(let J of Kq($)){if(Gq(J)){let X=J.position||void 0;Y.push({file:Z||X?.file,line:X?.line,column:X?.column,message:J.message??"",lineText:X?.lineText});continue}Y.push({file:Z,message:J instanceof Error?J.message:String(J)})}return Y}function KZ($,Z){return X3($,Z).map((Y)=>{let J=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",X=Y.lineText?`
756
756
  ${Y.lineText.trim()}`:"";return J?`${J}: ${Y.message}${X}`:`${Y.message}${X}`}).join(`
757
- `)}var q$={};t(q$,{shouldLogBundlerDiagnostics:()=>zZ,setBundlerFallbackMode:()=>Uq,resolveBundlerFallback:()=>BZ,recordBundleFailure:()=>jZ,queueClientBundleBuild:()=>HZ,hasUserImports:()=>zq,getBundleFailures:()=>Wq,clearBundleFailures:()=>qq,bundleClientScript:()=>Bq});import F0 from"path";import C0 from"fs";function zZ($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function s1(...$){if(zZ())console.log("[stx:bundler]",...$)}function jZ($,Z,Y){K3.push({filePath:$||"<inline>",message:Z,details:Y})}function Wq(){return K3.slice()}function qq(){K3.length=0}function Uq($){G3=$}function BZ(){if(G3)return G3;try{return z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function zq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!WZ.some((G)=>G.test(X)))return s1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!WZ.some((G)=>G.test(X)))return s1("detected side-effect import:",X),!0}return!1}function jq($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let U of q)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:W}})}}}function HZ($){let Z=globalThis,J=(Z[qZ]??Promise.resolve()).then($,$);return Z[qZ]=J.then(()=>{return},()=>{return}),J}async function Bq($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||K$(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Kq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),U=Bun.file(W);if(await U.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==UZ||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return s1("cache hit:",K),await U.text();s1("cache invalidated by dep change:",K)}let z=Q3.get(K);if(z)return await z;let j=HZ(()=>Hq($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));Q3.set(K,j);try{return await j}finally{Q3.delete(K)}}async function Hq($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=K$(J,"bundle-tmp"),U=F0.join(q,`${G}.ts`),z=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let j=F0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
758
- export { ${H.join(", ")} }`:"";await Bun.write(U,$+F),s1("bundling:",G,"from:",F0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:X,plugins:[jq(J,j,U,L)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...P0()},root:J});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let A=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${G}`,N=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
757
+ `)}var q$={};t(q$,{shouldLogBundlerDiagnostics:()=>zZ,setBundlerFallbackMode:()=>zq,resolveBundlerFallback:()=>BZ,recordBundleFailure:()=>jZ,queueClientBundleBuild:()=>HZ,hasUserImports:()=>jq,getBundleFailures:()=>qq,clearBundleFailures:()=>Uq,bundleClientScript:()=>Hq});import F0 from"path";import C0 from"fs";function zZ($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function s1(...$){if(zZ())console.log("[stx:bundler]",...$)}function jZ($,Z,Y){K3.push({filePath:$||"<inline>",message:Z,details:Y})}function qq(){return K3.slice()}function Uq(){K3.length=0}function zq($){G3=$}function BZ(){if(G3)return G3;try{return z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function jq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!WZ.some((G)=>G.test(X)))return s1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!WZ.some((G)=>G.test(X)))return s1("detected side-effect import:",X),!0}return!1}function Bq($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let U of q)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:W}})}}}function HZ($){let Z=globalThis,J=(Z[qZ]??Promise.resolve()).then($,$);return Z[qZ]=J.then(()=>{return},()=>{return}),J}async function Hq($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||K$(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Wq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),U=Bun.file(W);if(await U.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==UZ||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return s1("cache hit:",K),await U.text();s1("cache invalidated by dep change:",K)}let z=Q3.get(K);if(z)return await z;let j=HZ(()=>_q($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));Q3.set(K,j);try{return await j}finally{Q3.delete(K)}}async function _q($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=K$(J,"bundle-tmp"),U=F0.join(q,`${G}.ts`),z=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let j=F0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
758
+ export { ${H.join(", ")} }`:"";await Bun.write(U,$+F),s1("bundling:",G,"from:",F0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:X,plugins:[Bq(J,j,U,L)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...P0()},root:J});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let A=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${G}`,N=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
759
759
  `),T=R.map(([D])=>`${D} = ${M}[${JSON.stringify(D)}];`).join(`
760
760
  `);if(w=`${A.join(`
761
761
  `)}
@@ -764,7 +764,7 @@ var ${M} = (function() {
764
764
  ${w}
765
765
  return { ${N} };
766
766
  })();
767
- ${T}`.trim(),s1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:C0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:UZ,files:k})),w}catch(V){let w=X3(V,Z||void 0),R=KZ(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),jZ(Z||"",R,w),BZ()==="error")throw V;return $}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var Kq=5,UZ=1,K3,G3,WZ,Q3,qZ;var U$=b(()=>{E1();o$();O1();K3=[];WZ=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Q3=new Map,qZ=Symbol.for("stx.client-bundle-build-queue")});var MZ={};t(MZ,{stripCommentsAndLiterals:()=>t$,renderVendorStyleTags:()=>a$,processClientScript:()=>a1,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>e$,generateBrowserAutoImportDestructuring:()=>Tq,generateAutoImportDestructuring:()=>W3,extractBridgeData:()=>r1,extractAndStripCssImports:()=>r$,STX_AUTO_IMPORTS:()=>LZ});import o1 from"path";import j$ from"fs";function Oq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Fq($,Z){let Y=Z;while(!0){let J=o1.join(Y,"node_modules",$,"package.json");if(j$.existsSync(J))return o1.dirname(J);let X=o1.dirname(Y);if(X===Y)return null;Y=X}}function Lq($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function Vq($,Z){let Y=Oq($);if(!Y||!Y.subpath)return null;let J=Fq(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(j$.readFileSync(o1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Lq(X.exports,Q);if(!G)return null;let K=o1.resolve(J,G);return j$.existsSync(K)?K:null}function r$($,Z){let Y=Z.filePath?o1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(_q,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:o1.resolve(Y,W),!j$.existsSync(q))throw Error(`file not found: ${q}`)}else{let U=null;try{U=Bun.resolveSync(W,J)}catch{U=Vq(W,J)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(X.has(q))return"";X.add(q);try{let U=j$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${q}: ${U?.message||U}`)}return""}),styles:Q}}function wq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${wq(Z.source)}" data-stx-layer="vendor">
767
+ ${T}`.trim(),s1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:C0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:UZ,files:k})),w}catch(V){let w=X3(V,Z||void 0),R=KZ(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),jZ(Z||"",R,w),BZ()==="error")throw V;return $}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var Wq=5,UZ=1,K3,G3,WZ,Q3,qZ;var U$=b(()=>{E1();o$();O1();K3=[];WZ=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Q3=new Map,qZ=Symbol.for("stx.client-bundle-build-queue")});var MZ={};t(MZ,{stripCommentsAndLiterals:()=>t$,renderVendorStyleTags:()=>a$,processClientScript:()=>a1,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>e$,generateBrowserAutoImportDestructuring:()=>Iq,generateAutoImportDestructuring:()=>W3,extractBridgeData:()=>r1,extractAndStripCssImports:()=>r$,STX_AUTO_IMPORTS:()=>LZ});import o1 from"path";import j$ from"fs";function Fq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Lq($,Z){let Y=Z;while(!0){let J=o1.join(Y,"node_modules",$,"package.json");if(j$.existsSync(J))return o1.dirname(J);let X=o1.dirname(Y);if(X===Y)return null;Y=X}}function Vq($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function wq($,Z){let Y=Fq($);if(!Y||!Y.subpath)return null;let J=Lq(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(j$.readFileSync(o1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Vq(X.exports,Q);if(!G)return null;let K=o1.resolve(J,G);return j$.existsSync(K)?K:null}function r$($,Z){let Y=Z.filePath?o1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(Oq,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:o1.resolve(Y,W),!j$.existsSync(q))throw Error(`file not found: ${q}`)}else{let U=null;try{U=Bun.resolveSync(W,J)}catch{U=wq(W,J)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(X.has(q))return"";X.add(q);try{let U=j$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${q}: ${U?.message||U}`)}return""}),styles:Q}}function Rq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Rq(Z.source)}" data-stx-layer="vendor">
768
768
  @layer vendor {
769
769
  ${Z.contents}
770
770
  }
@@ -772,7 +772,7 @@ ${Z.contents}
772
772
  `)}
773
773
  `}function M5($){let Z=t$($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of K[1].split(",")){let q=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Y.add(q)}let J=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of K[1].split(",")){let q=W.trim().split(/[:=]/).pop()?.trim();if(q)J.add(q)}let X=VZ.filter((K)=>{if(Y.has(K)||J.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),Q=RZ(Z).filter((K)=>!Y.has(K)&&!J.has(K));if(X.length===0&&Q.length===0)return{code:$,imports:X,models:Q};return{code:`${[X.length>0?`import { ${X.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
774
774
  `)}
775
- ${$}`,imports:X,models:Q}}function Aq($,Z){let Y=$[Z],J=Z+1;while(J<$.length){if($[J]==="\\"){J+=2;continue}if($[J]===Y)return J+1;J++}return $.length}function Mq($,Z){let Y=Z+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`")return Y+1;if($[Y]==="$"&&$[Y+1]==="{"){if(Y=wZ($,Y+2),Y<$.length)Y++;continue}Y++}return $.length}function wZ($,Z){let Y=1,J=Z;while(J<$.length){let X=$[J];if(X==="\\"){J+=2;continue}if(X==='"'||X==="'"){J=Aq($,J);continue}if(X==="`"){J=Mq($,J);continue}if(X==="/"&&$[J+1]==="/"){while(J<$.length&&$[J]!==`
775
+ ${$}`,imports:X,models:Q}}function Mq($,Z){let Y=$[Z],J=Z+1;while(J<$.length){if($[J]==="\\"){J+=2;continue}if($[J]===Y)return J+1;J++}return $.length}function Nq($,Z){let Y=Z+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`")return Y+1;if($[Y]==="$"&&$[Y+1]==="{"){if(Y=wZ($,Y+2),Y<$.length)Y++;continue}Y++}return $.length}function wZ($,Z){let Y=1,J=Z;while(J<$.length){let X=$[J];if(X==="\\"){J+=2;continue}if(X==='"'||X==="'"){J=Mq($,J);continue}if(X==="`"){J=Nq($,J);continue}if(X==="/"&&$[J+1]==="/"){while(J<$.length&&$[J]!==`
776
776
  `)J++;continue}if(X==="/"&&$[J+1]==="*"){J+=2;while(J<$.length&&$.slice(J,J+2)!=="*/")J++;J+=2;continue}if(X==="{"){Y++,J++;continue}if(X==="}"){if(Y--,Y===0)return J;J++;continue}J++}return $.length}function t$($){let Z="",Y=0;while(Y<$.length){let J=$.slice(Y,Y+2);if(J==="//"){while(Y<$.length&&$[Y]!==`
777
777
  `)Z+=" ",Y++;continue}if(J==="/*"){while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Z+=$[Y]===`
778
778
  `?`
@@ -780,10 +780,10 @@ ${$}`,imports:X,models:Q}}function Aq($,Z){let Y=$[Z],J=Z+1;while(J<$.length){if
780
780
  `?`
781
781
  `:" ",Y++}Z+=" ",Y++;continue}if(X==="`"){Z+=" ",Y++;while(Y<$.length&&$[Y]!=="`"){if($[Y]==="\\"){Z+=" ",Y+=2;continue}if($[Y]==="$"&&$[Y+1]==="{"){let Q=Y+2,G=wZ($,Q);if(Z+=" ",Z+=t$($.slice(Q,G)),G<$.length)Z+=" ";Y=G+1;continue}Z+=$[Y]===`
782
782
  `?`
783
- `:" ",Y++}Z+=" ",Y++;continue}Z+=X,Y++}return Z}function RZ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!Rq.has(J[1]))Z.add(J[1]);return Array.from(Z)}function Nq($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Y[1].split(",")){let X=J.trim().split(/[:=]/).pop()?.trim();if(X&&/^[A-Za-z_$][\w$]*$/.test(X))Z.add(X)}return Z}function AZ($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let H of q.split(",")){let B=H.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],F=_[2]||O;if(X.add(O),X.add(F),U==="stx"||U==="@stacksjs/stx")Z.add(O);else Y.add(O);if(F!==O)z.push(`${F} = ${O}`)}let j=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let K=Nq(J);for(let q of LZ){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(q)}for(let q of VZ){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let W=RZ(J);for(let q of W)if(!X.has(q)&&!K.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function W3($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
783
+ `:" ",Y++}Z+=" ",Y++;continue}Z+=X,Y++}return Z}function RZ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!Aq.has(J[1]))Z.add(J[1]);return Array.from(Z)}function Tq($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Y[1].split(",")){let X=J.trim().split(/[:=]/).pop()?.trim();if(X&&/^[A-Za-z_$][\w$]*$/.test(X))Z.add(X)}return Z}function AZ($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let H of q.split(",")){let B=H.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],F=_[2]||O;if(X.add(O),X.add(F),U==="stx"||U==="@stacksjs/stx")Z.add(O);else Y.add(O);if(F!==O)z.push(`${F} = ${O}`)}let j=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let K=Tq(J);for(let q of LZ){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(q)}for(let q of VZ){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let W=RZ(J);for(let q of W)if(!X.has(q)&&!K.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function W3($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
784
784
  ${Y.join(`
785
785
  `)}
786
- ${Iq($,Z)}`;return""}function Tq($,Z=[]){let{browserImports:Y}=AZ($),J=new Set(Z);return W3([],Y.filter((X)=>!J.has(X)))}function Iq($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
786
+ ${Dq($,Z)}`;return""}function Iq($,Z=[]){let{browserImports:Y}=AZ($),J=new Set(Z);return W3([],Y.filter((X)=>!J.has(X)))}function Dq($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
787
787
  [${Y.join(", ")}].forEach(function (e) {
788
788
  if (e[1] !== 'undefined') return;
789
789
  console.error(
@@ -792,10 +792,10 @@ ${Iq($,Z)}`;return""}function Tq($,Z=[]){let{browserImports:Y}=AZ($),J=new Set(Z
792
792
  + 'or it should be imported from a relative path so the bundler includes it.'
793
793
  );
794
794
  });
795
- `}function r1($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let X in Z){let Q=Z[X];if(typeof Q==="function")continue;J[X]=Q}return J.__stxDeclaredPayload=!0,J}let Y={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let X=$[J];if(typeof X==="function")continue;Y[J]=X}return Y}function _Z($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function Dq($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(_Z(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(_Z(Y[1],!1).has(Z))return!0;return!1}function Eq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}function bq($,Z){let Y=kq.test($),J=Z.length>32768;if(!Y&&!J)return;if(OZ.has($))return;if(OZ.add($),Y)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function e$($,Z){if(!Z)return"";let Y=t$($),J=Z.__stxDeclaredPayload===!0,X=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!J&&!Eq(Y,Q))continue;if(Dq($,Q))continue;let K;try{K=JSON.stringify(G)}catch{continue}if(K===void 0)continue;bq(Q,K),X.push(` var ${Q} = ${K.replace(/</g,"\\u003c")};`)}if(X.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
795
+ `}function r1($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let X in Z){let Q=Z[X];if(typeof Q==="function")continue;J[X]=Q}return J.__stxDeclaredPayload=!0,J}let Y={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let X=$[J];if(typeof X==="function")continue;Y[J]=X}return Y}function _Z($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function Eq($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(_Z(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(_Z(Y[1],!1).has(Z))return!0;return!1}function kq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}function Sq($,Z){let Y=bq.test($),J=Z.length>32768;if(!Y&&!J)return;if(OZ.has($))return;if(OZ.add($),Y)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function e$($,Z){if(!Z)return"";let Y=t$($),J=Z.__stxDeclaredPayload===!0,X=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!J&&!kq(Y,Q))continue;if(Eq($,Q))continue;let K;try{K=JSON.stringify(G)}catch{continue}if(K===void 0)continue;Sq(Q,K),X.push(` var ${Q} = ${K.replace(/</g,"\\u003c")};`)}if(X.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
796
796
  ${X.join(`
797
797
  `)}
798
- `}function yq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=Sq[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Pq($,Z){let{elementId:Y,event:J,modifiers:X}=$,Q=$3($.handler),G=yq(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
798
+ `}function Pq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=yq[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Cq($,Z){let{elementId:Y,event:J,modifiers:X}=$,Q=$3($.handler),G=Pq(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
799
799
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
800
800
  };`;function j(H){if(/\$emit\s*\(/.test(H))return`${z}
801
801
  ${H}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -838,11 +838,11 @@ else {
838
838
  else {
839
839
  ${Q}
840
840
  }
841
- }${W})`}function Cq($){if($.length===0)return"";return`
841
+ }${W})`}function vq($){if($.length===0)return"";return`
842
842
  // STX: auto-generated event bindings
843
- ${$.map((Y,J)=>Pq(Y,J)).join(`
843
+ ${$.map((Y,J)=>Cq(Y,J)).join(`
844
844
  `)}`}function FZ($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&q===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){q++,G+=2;continue}if(J[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
845
- `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function xq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!vq.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function a1($,Z={}){let Y=$,J="",X=!1,Q=[],G=r$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=a$(G.styles),W=M5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:U}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(q(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=AZ(Y);Y=L.code,J=W3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(J=`${e$(Y,Z.serverData)}${J}`,Y=g0(Y),!X&&t1(Z.attrs||""))Y=e1(Y);let z=Cq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
845
+ `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function fq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!xq.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function a1($,Z={}){let Y=$,J="",X=!1,Q=[],G=r$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=a$(G.styles),W=M5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:U}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(q(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=AZ(Y);Y=L.code,J=W3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(J=`${e$(Y,Z.serverData)}${J}`,Y=h0(Y),!X&&t1(Z.attrs||""))Y=e1(Y);let z=vq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
846
846
  ${R5(`${J}${Y}
847
847
  ${z}`)}
848
848
  </script>`}let B=t7($),_=/function __stx_setup_/.test(Y),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let V=L.length>0?`
@@ -851,12 +851,12 @@ window.stx.mount(function() {
851
851
  'use strict';
852
852
  ${R5(`${J}${Y}
853
853
  ${z}${V}`)}
854
- })</script>`}if(!O&&!_){if(B)return F(FZ($));if(Z.templateContent){let L=FZ($);if(L.length>0){let V=xq(Z.templateContent);if(L.some((R)=>V.has(R)))return F(L)}}}return`${K}<script data-stx-scoped data-stx-run="always">
854
+ })</script>`}if(!O&&!_){if(B)return F(FZ($));if(Z.templateContent){let L=FZ($);if(L.length>0){let V=fq(Z.templateContent);if(L.some((R)=>V.has(R)))return F(L)}}}return`${K}<script data-stx-scoped data-stx-run="always">
855
855
  ;(function() {
856
856
  'use strict';
857
857
  ${R5(`${J}${Y}
858
858
  ${z}`)}
859
- })()</script>`}var _q,LZ,VZ,Rq,kq,OZ,Sq,vq;var N5=b(()=>{Y3();M0();X$();Q1();J3();_q=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;LZ=_1,VZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Rq=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"]);kq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,OZ=new Set;Sq={left:0,middle:1,right:2};vq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as fq}from"crypto";function NZ($){let Z=$[$4];return Z instanceof Map?Z:null}function TZ($){$[$4]=new Map}function IZ($,Z){let Y=NZ($);if(!Y)return null;let J=fq("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function DZ($,Z){let Y=NZ(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(z,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
859
+ })()</script>`}var Oq,LZ,VZ,Aq,bq,OZ,yq,xq;var N5=b(()=>{Y3();M0();X$();Q1();J3();Oq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;LZ=_1,VZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Aq=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"]);bq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,OZ=new Set;yq={left:0,middle:1,right:2};xq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as gq}from"crypto";function NZ($){let Z=$[$4];return Z instanceof Map?Z:null}function TZ($){$[$4]=new Map}function IZ($,Z){let Y=NZ($);if(!Y)return null;let J=gq("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function DZ($,Z){let Y=NZ(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(z,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
860
860
  (function() {
861
861
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
862
862
  ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
@@ -865,7 +865,7 @@ ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
865
865
  })();
866
866
  </script>`,K=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
867
867
  ${J}`;return`${J.slice(0,K)}${G}
868
- ${J.slice(K)}`}var $4="__stx_component_client_factories";var q3=()=>{};function mq($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function dq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(hq.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&SZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function lq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!SZ.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function Z4($){let Z=$.trim(),Y=mq(Z);dq(Y,Z),lq(Z);for(let J of bZ)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!kZ.allowBracketNotation&&uq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function pq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||bZ.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U3(J);else Z[Y]=J}return Z}function U3($,Z=0){if(Z>=kZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U3(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U3(X,Z+1);else Y[J]=X}return Y}function J0($,Z){try{let Y=pq(Z),J=Object.keys(Y),X=Object.values(Y);return q0($,J)(...X)}catch{return}}function W0($){try{return Z4($),!0}catch{return!1}}function L0($,Z){try{let Y=J0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=Z4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let U=Z[q];if(!J.test(U))continue;if(yZ.has(U))continue;X.push(q),Q.push(U)}let G=(q)=>Function(...Q,...q,`
868
+ ${J.slice(K)}`}var $4="__stx_component_client_factories";var q3=()=>{};function dq($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function lq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(uq.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&SZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function pq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!SZ.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function Z4($){let Z=$.trim(),Y=dq(Z);lq(Y,Z),pq(Z);for(let J of bZ)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!kZ.allowBracketNotation&&mq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function cq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||bZ.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U3(J);else Z[Y]=J}return Z}function U3($,Z=0){if(Z>=kZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U3(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U3(X,Z+1);else Y[J]=X}return Y}function J0($,Z){try{let Y=cq(Z),J=Object.keys(Y),X=Object.values(Y);return q0($,J)(...X)}catch{return}}function W0($){try{return Z4($),!0}catch{return!1}}function L0($,Z){try{let Y=J0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=Z4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let U=Z[q];if(!J.test(U))continue;if(yZ.has(U))continue;X.push(q),Q.push(U)}let G=(q)=>Function(...Q,...q,`
869
869
  'use strict';
870
870
  try {
871
871
  return ${Y};
@@ -876,7 +876,7 @@ catch (e) {
876
876
  }
877
877
  throw e;
878
878
  }
879
- `),K=G([]);if(Q.length===Z.length)return EZ(K,Q,G);return EZ((...q)=>{let U=Array(X.length);for(let z=0;z<X.length;z++)U[z]=q[X[z]];return K(...U)},Q,G,(q)=>{K=G(q)})}function EZ($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let U=0;U<=8;U++)try{return G(...q)}catch(z){let j=z instanceof Error?z.message:"",H=Q.exec(j);if(!(z instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||yZ.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function Y4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var gq,kZ,bZ,hq,SZ,uq,yZ;var V0=b(()=>{gq={maxSanitizeDepth:10,allowBracketNotation:!1},kZ={...gq},bZ=[/\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/],hq=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),SZ=new Set(["__proto__","constructor","prototype"]),uq=/[\w)\]]\s*\[\s*['"]/;yZ=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function J4($,Z){let Y=cq++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return iq.set(J,{type:$,expression:Z}),J}var cq=0,iq;var PZ=b(()=>{iq=new Map});function gZ($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return gZ($,Z,CZ,vZ)}function T5($,Z){return gZ($,Z,xZ,fZ)}function B$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function nq($,Z){if($.startsWith("<!--",Z)){let Y=B$($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[CZ,vZ],[xZ,fZ]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function z3($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=nq($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function G1($,Z,Y){let J=z3($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function b1($){let{output:Z,tokens:Y}=G1($,k1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function H$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var CZ,vZ,xZ,fZ;var $5=b(()=>{CZ=/<script\b[^>]*>/iy,vZ=/<\/script\s*>/ig,xZ=/<style\b[^>]*>/iy,fZ=/<\/style\s*>/ig});var pZ={};t(pZ,{usesSignalsInScript:()=>F1,unescapeHtml:()=>ZU,registerFilters:()=>oq,registerFilter:()=>mZ,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>aq,interpolateScriptExpressions:()=>X4,getAllFilters:()=>dZ,evaluateExpression:()=>c0,escapeHtml:()=>t0,defaultFilters:()=>O$,clearCustomFilters:()=>rq,applyFilters:()=>lZ});function sq($){let Z=hZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),hZ.set($,Z)}return Z.lastIndex=0,Z}function mZ($,Z){if($ in O$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);_$[$]=Z}function oq($){for(let[Z,Y]of Object.entries($))mZ(Z,Y)}function dZ(){return{...O$,..._$}}function rq(){for(let $ of Object.keys(_$))delete _$[$]}function t0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F1($){let{scripts:Z}=b1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function uZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let U=J[q];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){X+=U;continue}continue}X+=U}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function X4($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),Y}function aq($,Z,Y={}){let{output:J,scripts:X}=b1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=X4(z,Z);return W[0]+j+G.slice(q)});return H$(J,Q)}function S1($,Z,Y){let J=$,X=(z,j)=>{let H=T5(z,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(j,H))?-1:H},Q=(z,j,H,B)=>{let _=H.length,{output:O,tokens:F}=G1(z,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let K=[];J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=Z?.__stx_signals_gate===!0||F1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,j,H)=>{try{let B=c0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,j,H)=>{try{let B=c0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return J4("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return J4("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,z)}}),J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,j,H)=>{let B=j.trim();if(U.has(B))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&q.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,A=B.match(R),M=A&&!_.includes(A[1])&&!(A[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=c0(j,Z);if(w)return z;if(W&&!uZ(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return J4("expr",B);return N!==void 0&&N!==null?t0(String(N)):""}catch(N){if(w)return z;if(W&&!uZ(B,Z))return z;if(M)return z;let I=N instanceof Error?N.message:String(N);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,z)}});for(let z=0;z<K.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>K[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function lZ($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=_$[G]||O$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(dZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,U=1;while(q>0&&U<X.length){if(X[U]==="(")q++;if(X[U]===")")q--;U++}if(q===0){let z=X.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[c0(`(${z})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((V)=>{let w=V.trim();return c0(w,Y,!0)})}}catch{W=[z]}X=X.substring(U).trim()}}try{J=K(J,Y,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${U}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function tq($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=tq(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return lZ(K,G,Z)}if(!W0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=eq(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function eq($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=$U($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function $U($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function ZU($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var _$,hZ,O$;var K1=b(()=>{V0();M0();PZ();$5();_$={},hZ=new Map;O$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(sq(W),String(q))}),K},t:($,Z,Y={})=>{return O$.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});class Z5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!I5.has(Y)){if(I5.size>=YU){let J=I5.keys().next().value;if(J)I5.delete(J)}I5.set(Y,new RegExp($,Z))}return I5.get(Y)}class cZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,U=X.get(q);if(!U){if(X.size>=Q){let z=X.keys().next().value;if(z)X.delete(z)}U=Function(...Z,`
879
+ `),K=G([]);if(Q.length===Z.length)return EZ(K,Q,G);return EZ((...q)=>{let U=Array(X.length);for(let z=0;z<X.length;z++)U[z]=q[X[z]];return K(...U)},Q,G,(q)=>{K=G(q)})}function EZ($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let U=0;U<=8;U++)try{return G(...q)}catch(z){let j=z instanceof Error?z.message:"",H=Q.exec(j);if(!(z instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||yZ.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function Y4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var hq,kZ,bZ,uq,SZ,mq,yZ;var V0=b(()=>{hq={maxSanitizeDepth:10,allowBracketNotation:!1},kZ={...hq},bZ=[/\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/],uq=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),SZ=new Set(["__proto__","constructor","prototype"]),mq=/[\w)\]]\s*\[\s*['"]/;yZ=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function J4($,Z){let Y=iq++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return nq.set(J,{type:$,expression:Z}),J}var iq=0,nq;var PZ=b(()=>{nq=new Map});function gZ($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return gZ($,Z,CZ,vZ)}function T5($,Z){return gZ($,Z,xZ,fZ)}function B$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function sq($,Z){if($.startsWith("<!--",Z)){let Y=B$($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[CZ,vZ],[xZ,fZ]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function z3($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=sq($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function G1($,Z,Y){let J=z3($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function b1($){let{output:Z,tokens:Y}=G1($,k1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function H$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var CZ,vZ,xZ,fZ;var $5=b(()=>{CZ=/<script\b[^>]*>/iy,vZ=/<\/script\s*>/ig,xZ=/<style\b[^>]*>/iy,fZ=/<\/style\s*>/ig});var cZ={};t(cZ,{usesSignalsInScript:()=>F1,unescapeHtml:()=>YU,registerFilters:()=>rq,registerFilter:()=>mZ,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>tq,interpolateScriptExpressions:()=>X4,interpolateScriptAttributes:()=>lZ,getAllFilters:()=>dZ,evaluateExpression:()=>v0,escapeHtml:()=>t0,defaultFilters:()=>O$,clearCustomFilters:()=>aq,applyFilters:()=>pZ});function oq($){let Z=hZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),hZ.set($,Z)}return Z.lastIndex=0,Z}function mZ($,Z){if($ in O$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);_$[$]=Z}function rq($){for(let[Z,Y]of Object.entries($))mZ(Z,Y)}function dZ(){return{...O$,..._$}}function aq(){for(let $ of Object.keys(_$))delete _$[$]}function t0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F1($){let{scripts:Z}=b1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function uZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let U=J[q];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){X+=U;continue}continue}X+=U}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function X4($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=v0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=v0(X,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),Y}function lZ($,Z){if(!$.includes("{"))return $;let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=v0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=v0(X,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),Y}function tq($,Z,Y={}){let{output:J,scripts:X}=b1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let U=K[1],z=K[2];if(/\bdata-raw\b/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let H=`<script${lZ(U,Z)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return H+z+G.slice(q);return H+X4(z,Z)+G.slice(q)});return H$(J,Q)}function S1($,Z,Y){let J=$,X=(z,j)=>{let H=T5(z,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(j,H))?-1:H},Q=(z,j,H,B)=>{let _=H.length,{output:O,tokens:F}=G1(z,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let K=[];J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=Z?.__stx_signals_gate===!0||F1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,j,H)=>{try{let B=v0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,j,H)=>{try{let B=v0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return J4("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return J4("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,z)}}),J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,j,H)=>{let B=j.trim();if(U.has(B))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&q.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,A=B.match(R),M=A&&!_.includes(A[1])&&!(A[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=v0(j,Z);if(w)return z;if(W&&!uZ(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return J4("expr",B);return N!==void 0&&N!==null?t0(String(N)):""}catch(N){if(w)return z;if(W&&!uZ(B,Z))return z;if(M)return z;let I=N instanceof Error?N.message:String(N);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,z)}});for(let z=0;z<K.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>K[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function pZ($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=_$[G]||O$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(dZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,U=1;while(q>0&&U<X.length){if(X[U]==="(")q++;if(X[U]===")")q--;U++}if(q===0){let z=X.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[v0(`(${z})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((V)=>{let w=V.trim();return v0(w,Y,!0)})}}catch{W=[z]}X=X.substring(U).trim()}}try{J=K(J,Y,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${U}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function eq($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function v0($,Z,Y=!1){try{let J=$.trim(),X=eq(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=v0(Q,Z,!0);return pZ(K,G,Z)}if(!W0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=$U(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function $U($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=ZU($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function ZU($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function YU($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var _$,hZ,O$;var K1=b(()=>{V0();M0();PZ();$5();_$={},hZ=new Map;O$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(oq(W),String(q))}),K},t:($,Z,Y={})=>{return O$.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});class Z5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!I5.has(Y)){if(I5.size>=JU){let J=I5.keys().next().value;if(J)I5.delete(J)}I5.set(Y,new RegExp($,Z))}return I5.get(Y)}class iZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,U=X.get(q);if(!U){if(X.size>=Q){let z=X.keys().next().value;if(z)X.delete(z)}U=Function(...Z,`
880
880
  'use strict';
881
881
  try {
882
882
  return ${W};
@@ -887,14 +887,14 @@ catch (e) {
887
887
  }
888
888
  throw e;
889
889
  }
890
- `),X.set(q,U)}return U(...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 iZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function JU(){if(!j3)j3=new iZ;return j3}var I5,YU=500,dV,j3=null,nZ;var E5=b(()=>{I5=new Map;dV=new cZ;nZ=new Proxy({},{get($,Z){return JU()[Z]}})});function sZ($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function B3($,Z){let Y={...$};for(let[J,X]of Object.entries(Z))Y[J]=sZ(X)&&sZ(Y[J])?B3(Y[J],X):X;return Y}function oZ($={},Z={}){let Y=$.theme||{},J=Z.theme||{},{extend:X,...Q}=J,{extend:G,...K}=Y,W=B3(K,Q),q=B3(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let U=[...$.safelist||[],...Z.safelist||[]],z={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:U,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:U,shortcuts:z,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}var H0;var rZ=b(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var Y2={};t(Y2,{resetCssCache:()=>zU,resetCrosswindCache:()=>jU,rebuildCrosswindCSS:()=>BU,loadCrosswindConfig:()=>F3,loadCrosswind:()=>O3,injectCrosswindCSS:()=>L3,getCrosswindServeAsset:()=>GU,getCachedCSS:()=>HU,generateCrosswindCSS:()=>Z2,extractClassNames:()=>$2,buildCrosswindCSS:()=>eZ});import X0 from"path";import{hasLocalConfig as XU}from"bunfig";function G4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function H3($,Z){if(L1.has($))L1.delete($);else if(L1.size>=tZ)L1.delete(L1.keys().next().value);L1.set($,Z)}function QU($){let Z=G4($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=tZ)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function GU($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function KU($){if(!y1)return null;try{let Z=Bun.file(X0.join(y1,`cw-${G4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function WU($,Z){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(X0.join(y1,`cw-${G4($)}.css`),Z)}catch{}}async function aZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function qU(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function UU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function O3(){if(_3)return W1;_3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await aZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return W1=Q,W1}let Z=await $(qU());if(Z)return W1=Z,W1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await aZ(X);if(Q){if(W1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return W1}}let J=await $(UU());if(J)return W1=J,W1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function zU(){L1.clear(),e0.clear()}function jU(){W1=null,_3=!1,$1=null,F$="",L1.clear(),e0.clear(),Q4=null}async function F3($){try{if(!XU({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function eZ($){if(k5)return F$;k5=!0;try{let Z=await O3();if(!Z||!Z.build)return k5=!1,"";if(!$1)$1=await F3($);if(!$1)return k5=!1,"";let Y=Z.defaultConfig?.theme||{},J=$1.theme||{},X={...Z.defaultConfig,...$1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(F$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return k5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),k5=!1,F$}}async function BU($){$1=null,await eZ($)}function HU(){return F$}function $2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function Z2($,Z){try{let Y=await O3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):$2($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!y1)y1=K$(X,"cache");let Q=[...J].sort().join(" "),G=`${Q4||"default"}::${Q}`,K=L1.get(G);if(K!==void 0)return H3(G,K),K;let W=await KU(G);if(W!==null)return H3(G,W),W;if(!$1){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (O1(),J2)),A=await R(X);if(A.css)if(typeof A.css==="string"){let M=X0.isAbsolute(A.css)?A.css:X0.resolve(X,A.css);if(await Bun.file(M).exists()){let N=await import(M);w=N.default||N,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${A.css}`)}}else{if(w={...A.css,content:A.css.content||[],preflight:A.css.preflight??!0,minify:A.css.minify??!1},A.css.config){let M=X0.isAbsolute(A.css.config)?A.css.config:X0.resolve(X,A.css.config);if(await Bun.file(M).exists()){let N=await import(M);w={...N.default||N,...w}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=w||await F3(X);try{Q4=G4(JSON.stringify($1??{}))}catch{Q4="unhashable"}}let q=Y.defaultConfig||Y.config,U=$1||{},z=oZ(q,U),{safelist:j,includePreflight:H,minify:B}=z,_=z.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of J)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||U.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean);for(let M of A)O.generate(M)}F=O.toCSS(H,B);let V=F.split(`
890
+ `),X.set(q,U)}return U(...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 nZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function XU(){if(!j3)j3=new nZ;return j3}var I5,JU=500,lV,j3=null,sZ;var E5=b(()=>{I5=new Map;lV=new iZ;sZ=new Proxy({},{get($,Z){return XU()[Z]}})});function oZ($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function B3($,Z){let Y={...$};for(let[J,X]of Object.entries(Z))Y[J]=oZ(X)&&oZ(Y[J])?B3(Y[J],X):X;return Y}function rZ($={},Z={}){let Y=$.theme||{},J=Z.theme||{},{extend:X,...Q}=J,{extend:G,...K}=Y,W=B3(K,Q),q=B3(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let U=[...$.safelist||[],...Z.safelist||[]],z={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:U,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:U,shortcuts:z,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}var H0;var aZ=b(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var J2={};t(J2,{resetCssCache:()=>jU,resetCrosswindCache:()=>BU,rebuildCrosswindCSS:()=>HU,loadCrosswindConfig:()=>F3,loadCrosswind:()=>O3,injectCrosswindCSS:()=>L3,getCrosswindServeAsset:()=>KU,getCachedCSS:()=>_U,generateCrosswindCSS:()=>Y2,extractClassNames:()=>Z2,buildCrosswindCSS:()=>$2});import X0 from"path";import{hasLocalConfig as QU}from"bunfig";function G4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function H3($,Z){if(L1.has($))L1.delete($);else if(L1.size>=eZ)L1.delete(L1.keys().next().value);L1.set($,Z)}function GU($){let Z=G4($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=eZ)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function KU($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function WU($){if(!y1)return null;try{let Z=Bun.file(X0.join(y1,`cw-${G4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function qU($,Z){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(X0.join(y1,`cw-${G4($)}.css`),Z)}catch{}}async function tZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function UU(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function zU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function O3(){if(_3)return W1;_3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await tZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return W1=Q,W1}let Z=await $(UU());if(Z)return W1=Z,W1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await tZ(X);if(Q){if(W1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return W1}}let J=await $(zU());if(J)return W1=J,W1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function jU(){L1.clear(),e0.clear()}function BU(){W1=null,_3=!1,$1=null,F$="",L1.clear(),e0.clear(),Q4=null}async function F3($){try{if(!QU({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function $2($){if(k5)return F$;k5=!0;try{let Z=await O3();if(!Z||!Z.build)return k5=!1,"";if(!$1)$1=await F3($);if(!$1)return k5=!1,"";let Y=Z.defaultConfig?.theme||{},J=$1.theme||{},X={...Z.defaultConfig,...$1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(F$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return k5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),k5=!1,F$}}async function HU($){$1=null,await $2($)}function _U(){return F$}function Z2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function Y2($,Z){try{let Y=await O3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):Z2($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!y1)y1=K$(X,"cache");let Q=[...J].sort().join(" "),G=`${Q4||"default"}::${Q}`,K=L1.get(G);if(K!==void 0)return H3(G,K),K;let W=await WU(G);if(W!==null)return H3(G,W),W;if(!$1){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (O1(),X2)),A=await R(X);if(A.css)if(typeof A.css==="string"){let M=X0.isAbsolute(A.css)?A.css:X0.resolve(X,A.css);if(await Bun.file(M).exists()){let N=await import(M);w=N.default||N,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${A.css}`)}}else{if(w={...A.css,content:A.css.content||[],preflight:A.css.preflight??!0,minify:A.css.minify??!1},A.css.config){let M=X0.isAbsolute(A.css.config)?A.css.config:X0.resolve(X,A.css.config);if(await Bun.file(M).exists()){let N=await import(M);w={...N.default||N,...w}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=w||await F3(X);try{Q4=G4(JSON.stringify($1??{}))}catch{Q4="unhashable"}}let q=Y.defaultConfig||Y.config,U=$1||{},z=rZ(q,U),{safelist:j,includePreflight:H,minify:B}=z,_=z.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of J)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||U.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean);for(let M of A)O.generate(M)}F=O.toCSS(H,B);let V=F.split(`
891
891
  `);for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean),M=[],N=[];for(let I of A){let T=I.startsWith("dark:"),P=`.${(T?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let S=V[y].trim();if(S===`${P} {`||S.startsWith(`${P} {`)){let C=y,x="";while(C<V.length){if(x+=V[C],V[C].includes("}"))break;C++}let m=x.match(/\{([^}]+)\}/);if(m)if(T)N.push(m[1].trim());else M.push(m[1].trim());break}}}if(M.length)F+=`
892
892
  .${w} { ${M.join(" ")} }`;if(N.length)F+=`
893
- @media (prefers-color-scheme: dark) { .dark .${w} { ${N.join(" ")} } }`}return H3(G,F),WU(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function L3($,Z,Y=!1){let J=await Z2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${QU(J)}.css">`:`<style data-crosswind="generated">
893
+ @media (prefers-color-scheme: dark) { .dark .${w} { ${N.join(" ")} } }`}return H3(G,F),qU(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function L3($,Z,Y=!1){let J=await Y2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${GU(J)}.css">`:`<style data-crosswind="generated">
894
894
  ${J}
895
895
  </style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
896
896
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
897
- ${X}`);return X+$}var W1=null,_3=!1,$1=null,F$="",k5=!1,tZ=256,L1,e0,y1=null,Q4=null;var V3=b(()=>{o$();rZ();L1=new Map,e0=new Map});function K4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=/<body\b([^>]*)>/i.exec(Y);if(!J)return null;let X=Z+J.index,Q=-1,G="";for(let W of _U){let q=W.open.exec(Y);if(!q)continue;let U=Z+q.index;if(U<X&&(Q===-1||U<Q))Q=U,G=W.close}if(Q===-1)return{index:X,tag:J[0],attrs:J[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function w3($,Z){let Y=K4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var _U;var R3=b(()=>{_U=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function X2(){return`
897
+ ${X}`);return X+$}var W1=null,_3=!1,$1=null,F$="",k5=!1,eZ=256,L1,e0,y1=null,Q4=null;var V3=b(()=>{o$();aZ();L1=new Map,e0=new Map});function K4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=/<body\b([^>]*)>/i.exec(Y);if(!J)return null;let X=Z+J.index,Q=-1,G="";for(let W of OU){let q=W.open.exec(Y);if(!q)continue;let U=Z+q.index;if(U<X&&(Q===-1||U<Q))Q=U,G=W.close}if(Q===-1)return{index:X,tag:J[0],attrs:J[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function w3($,Z){let Y=K4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var OU;var R3=b(()=>{OU=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function Q2(){return`
898
898
  // STX Lifecycle Runtime
899
899
  (function() {
900
900
  if (typeof window === 'undefined') return;
@@ -1239,7 +1239,7 @@ else {
1239
1239
 
1240
1240
  console.log('[stx] Lifecycle runtime initialized');
1241
1241
  })();
1242
- `}function A3($){return Symbol($)}var tV,eV,$w;var Q2=b(()=>{tV=A3("theme"),eV=A3("router"),$w=A3("i18n")});import*as K2 from"crypto";function G2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function OU(){return`stx-${K2.randomBytes(4).toString("hex")}`}function FU($){return/\$\w+\./.test($)}function LU($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],U=!1,z=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,H=[...K.matchAll(j)];for(let O of H){let F=O[0],L=O[1],V=O[2];if(FU(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(q.push({attr:L,expr:R,fullMatch:F,originalAttr:L}),G2(R).forEach((M)=>Y.add(M)),L==="text")z=z.replace(F,"");else if(L==="class")z=z.replace(F,'class=""');else if(L==="disabled"||L==="hidden")z=z.replace(F,"");else z=z.replace(F,`${L}=""`)}}}if(!U)return Q;let B=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=OU(),z=` id="${_}"${z}`;for(let O of q)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:G2(O.expr)});return`<${G}${z}${W}`}),{html:X,bindings:Z,stores:Y}}function VU($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1242
+ `}function A3($){return Symbol($)}var eV,$w,Zw;var G2=b(()=>{eV=A3("theme"),$w=A3("router"),Zw=A3("i18n")});import*as W2 from"crypto";function K2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function FU(){return`stx-${W2.randomBytes(4).toString("hex")}`}function LU($){return/\$\w+\./.test($)}function VU($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],U=!1,z=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,H=[...K.matchAll(j)];for(let O of H){let F=O[0],L=O[1],V=O[2];if(LU(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(q.push({attr:L,expr:R,fullMatch:F,originalAttr:L}),K2(R).forEach((M)=>Y.add(M)),L==="text")z=z.replace(F,"");else if(L==="class")z=z.replace(F,'class=""');else if(L==="disabled"||L==="hidden")z=z.replace(F,"");else z=z.replace(F,`${L}=""`)}}}if(!U)return Q;let B=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=FU(),z=` id="${_}"${z}`;for(let O of q)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:K2(O.expr)});return`<${G}${z}${W}`}),{html:X,bindings:Z,stores:Y}}function wU($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1243
1243
  <script>
1244
1244
  (function() {
1245
1245
  'use strict';
@@ -1397,10 +1397,10 @@ else {
1397
1397
  }
1398
1398
  })();
1399
1399
  </script>
1400
- `,J}function W2($){let{html:Z,bindings:Y,stores:J}=LU($);if(Y.length===0)return $;let X=VU(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var q2=()=>{};function wU($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return RU(Z);case"google-analytics":return AU(Z);case"plausible":return MU(Z);case"self-hosted":return NU(Z);case"custom":return TU(Z);default:return""}}function RU($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${h0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${h0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
1400
+ `,J}function q2($){let{html:Z,bindings:Y,stores:J}=VU($);if(Y.length===0)return $;let X=wU(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var U2=()=>{};function RU($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return AU(Z);case"google-analytics":return MU(Z);case"plausible":return NU(Z);case"self-hosted":return TU(Z);case"custom":return IU(Z);default:return""}}function AU($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${u0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${u0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
1401
1401
  <!-- Fathom Analytics -->
1402
- <script src="${h0(Y)}" ${X.join(" ")}${J}></script>
1403
- `}function AU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=h0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1402
+ <script src="${u0(Y)}" ${X.join(" ")}${J}></script>
1403
+ `}function MU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1404
1404
  <!-- Google Analytics -->
1405
1405
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
1406
1406
  <script>
@@ -1410,10 +1410,10 @@ else {
1410
1410
  gtag('config', '${Y}');
1411
1411
  ${J}
1412
1412
  </script>
1413
- `}function MU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${h0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
1413
+ `}function NU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${u0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
1414
1414
  <!-- Plausible Analytics -->
1415
- <script defer data-domain="${h0(Z.domain)}" src="${h0(X)}"></script>
1416
- `}function NU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=h0(Z.siteId),J=h0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
1415
+ <script defer data-domain="${u0(Z.domain)}" src="${u0(X)}"></script>
1416
+ `}function TU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),J=u0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
1417
1417
  d.addEventListener('click',function(e){
1418
1418
  var a=e.target.closest('a');
1419
1419
  if(a&&a.hostname!==location.hostname){
@@ -1446,15 +1446,15 @@ else {
1446
1446
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
1447
1447
  })();
1448
1448
  </script>
1449
- `}function TU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1449
+ `}function IU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1450
1450
  <!-- Custom Analytics -->
1451
1451
  <script>
1452
1452
  ${Z.inlineScript}
1453
1453
  </script>
1454
- `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${h0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${h0(X)}="${h0(Q)}"`);return`
1454
+ `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${u0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${u0(X)}="${u0(Q)}"`);return`
1455
1455
  <!-- Custom Analytics -->
1456
- <script${Y.length>0?` ${Y.join(" ")}`:""} src="${h0(Z.scriptUrl)}" defer></script>
1457
- `}function U2($,Z){let Y=wU(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var z2=()=>{};function j2($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function B2($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}function H2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function DU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=H2(G,"x-data");if(!W)continue;let q=`__stx_scope_${O2++}`,U=H2(G,"x-init"),z=EU($,Q,K+X.length),j=$.slice(K,z.endIndex),H=kU(j);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:U,bindings:[],refs:H})}return Z}function EU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),q=G.exec($),U=K.exec($);if(U&&U.index<(W?.index??1/0)){X=U.index+U[0].length;continue}if(!q)return{endIndex:$.length};if(W&&W.index<q.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};X=q.index+q[0].length}}return{endIndex:$.length}}function kU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=bU(Q);Z.set(G,K)}return Z}function bU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${IU++}`}function SU(){return`
1456
+ <script${Y.length>0?` ${Y.join(" ")}`:""} src="${u0(Z.scriptUrl)}" defer></script>
1457
+ `}function z2($,Z){let Y=RU(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var j2=()=>{};function B2($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function H2($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}function _2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function EU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=_2(G,"x-data");if(!W)continue;let q=`__stx_scope_${F2++}`,U=_2(G,"x-init"),z=kU($,Q,K+X.length),j=$.slice(K,z.endIndex),H=bU(j);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:U,bindings:[],refs:H})}return Z}function kU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),q=G.exec($),U=K.exec($);if(U&&U.index<(W?.index??1/0)){X=U.index+U[0].length;continue}if(!q)return{endIndex:$.length};if(W&&W.index<q.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};X=q.index+q[0].length}}return{endIndex:$.length}}function bU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=SU(Q);Z.set(G,K)}return Z}function SU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${DU++}`}function yU(){return`
1458
1458
  // STX Reactive Runtime - x-cloak and transition CSS
1459
1459
  (function() {
1460
1460
  var style = document.createElement('style');
@@ -1661,7 +1661,7 @@ window.__stx_reactive = (function() {
1661
1661
 
1662
1662
  return { initScope: initScope, reactive: reactive };
1663
1663
  })();
1664
- `}function _2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(K,W)=>{try{let q=c0(W,Z,!0);if(q===void 0)return K;return String(q)}catch{return K}}),J="",X=0,Q=null;while(X<Y.length){let K=Y[X];if(Q&&K==="\\"){J+=K+(Y[X+1]??""),X+=2;continue}if(K==="{"&&Y[X+1]==="{"){let W=Y.indexOf("}}",X+2);if(W!==-1){let q=Y.slice(X,W+2);J+=G(Y.slice(X+2,W),q,Q),X=W+2;continue}}if(Q){if(K===Q)Q=null}else if(K==="'"||K==='"'||K==="`")Q=K;J+=K,X++}return J;function G(K,W,q){let U;try{U=c0(K,Z,!0)}catch{return W}if(U===void 0)return W;if(q){let z=String(U).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof U==="string"){let z=U.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(U)}}function yU($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=_2(J.stateExpr,Z),G=J.initExpr?_2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1664
+ `}function O2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(K,W)=>{try{let q=v0(W,Z,!0);if(q===void 0)return K;return String(q)}catch{return K}}),J="",X=0,Q=null;while(X<Y.length){let K=Y[X];if(Q&&K==="\\"){J+=K+(Y[X+1]??""),X+=2;continue}if(K==="{"&&Y[X+1]==="{"){let W=Y.indexOf("}}",X+2);if(W!==-1){let q=Y.slice(X,W+2);J+=G(Y.slice(X+2,W),q,Q),X=W+2;continue}}if(Q){if(K===Q)Q=null}else if(K==="'"||K==='"'||K==="`")Q=K;J+=K,X++}return J;function G(K,W,q){let U;try{U=v0(K,Z,!0)}catch{return W}if(U===void 0)return W;if(q){let z=String(U).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof U==="string"){let z=U.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(U)}}function PU($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=O2(J.stateExpr,Z),G=J.initExpr?O2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1665
1665
  (function() {
1666
1666
  var scopeEl = document.querySelector('${J.selector}');
1667
1667
  if (!scopeEl) return;
@@ -1670,42 +1670,42 @@ window.__stx_reactive = (function() {
1670
1670
  })();`}).join(`
1671
1671
  `);return`
1672
1672
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1673
- ${SU()}
1673
+ ${yU()}
1674
1674
  ${Y}
1675
- </script>`}function F2($,Z,Y){if(O2=0,!CU($))return $;let J=DU($);if(J.length===0)return $;let X=PU($,J),Q=yU(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
1676
- `+X.slice(G);else X+=Q;return X}function PU($,Z){let Y=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[Y++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return 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 CU($){return/x-data\s*=\s*["']/.test($)}var O2=0,IU=0;var L2=b(()=>{K1()});import vU from"fs";import M3 from"path";import{createHighlighter as xU}from"ts-syntax-highlighter";async function fU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let J=(await vU.promises.stat($)).mtime.getTime();if(Z.cache&&N3.has($)){let z=N3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let X=await Bun.file($).text(),{data:Q,content:G}=n$(X),K=Z.markdown||z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await gU(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:q,data:Q||{}};if(Z.cache)N3.set($,{...U,updatedAt:J});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function gU($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W4)try{W4=await xU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!W4.getSupportedLanguages().includes(j))return K;return(await W4.highlight(z,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,U,z]=K,j=await X(W,q,U,z);Q=Q.replace(W,j)}return Q}async function V2($,Z,Y="",J={}){return await hU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let U=K;if(!M3.isAbsolute(K))U=M3.resolve(M3.dirname(Y),K);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),M=A.startsWith('"')&&A.endsWith('"'),N=A.startsWith("'")&&A.endsWith("'");if(M||N)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await fU(U,J),B={...Z,...H,...z},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(U){let z=U instanceof Error?U.message:String(U);return z0("Markdown File",`Error including markdown file: ${z}`,Y,$,q,G)}})}async function hU($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((U)=>({match:K,replacement:U,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var N3,W4=null;var w2=b(()=>{O1();M0();N3=new Map});function P1($,Z){try{let Y=$.trim();if(W0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var R2=b(()=>{V0()});function T3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var q4=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function L$(){return!1}function V$(){return!L$()||process.env.STX_DEBUG==="true"}function U4(){return!1}import uU from"path";function z4(){return{...I3}}function j4($){if(!I3.showRelativePaths||!$)return $;let Z=I3.baseDir||process.cwd();try{let Y=uU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mU,I3,B4,Y5,H4;var _4=b(()=>{q4();mU={showRelativePaths:!1,enableAutoRecovery:V$(),logRecoveryWarnings:!0},I3={...mU};B4=class B4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=j4(this.filePath)}};Y5=class Y5 extends B4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};H4=class H4 extends B4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function M2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:U,format:z="text"}=$,j=Q,H=G;if(!j&&K&&W!==void 0){let L=nU(K,W);j=L.line,H=L.column}let B=X?j4(X):void 0,_=J?T3(J):void 0,O={type:Z,code:J,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:q,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lU(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=pU(O,K,W);break;case"text":default:F=dU(O,K,W);break}return{formatted:F,data:O}}function dU($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
1677
- ${$.message}`),Z&&$.line){let Q=cU(Z,$.line,2);if(Q)J.push(`
1675
+ </script>`}function L2($,Z,Y){if(F2=0,!vU($))return $;let J=EU($);if(J.length===0)return $;let X=CU($,J),Q=PU(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
1676
+ `+X.slice(G);else X+=Q;return X}function CU($,Z){let Y=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[Y++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return 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 vU($){return/x-data\s*=\s*["']/.test($)}var F2=0,DU=0;var V2=b(()=>{K1()});import xU from"fs";import M3 from"path";import{createHighlighter as fU}from"ts-syntax-highlighter";async function gU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let J=(await xU.promises.stat($)).mtime.getTime();if(Z.cache&&N3.has($)){let z=N3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let X=await Bun.file($).text(),{data:Q,content:G}=n$(X),K=Z.markdown||z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await hU(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:q,data:Q||{}};if(Z.cache)N3.set($,{...U,updatedAt:J});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function hU($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W4)try{W4=await fU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!W4.getSupportedLanguages().includes(j))return K;return(await W4.highlight(z,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,U,z]=K,j=await X(W,q,U,z);Q=Q.replace(W,j)}return Q}async function w2($,Z,Y="",J={}){return await uU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let U=K;if(!M3.isAbsolute(K))U=M3.resolve(M3.dirname(Y),K);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),M=A.startsWith('"')&&A.endsWith('"'),N=A.startsWith("'")&&A.endsWith("'");if(M||N)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await gU(U,J),B={...Z,...H,...z},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(U){let z=U instanceof Error?U.message:String(U);return z0("Markdown File",`Error including markdown file: ${z}`,Y,$,q,G)}})}async function uU($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((U)=>({match:K,replacement:U,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var N3,W4=null;var R2=b(()=>{O1();M0();N3=new Map});function P1($,Z){try{let Y=$.trim();if(W0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var A2=b(()=>{V0()});function T3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var q4=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function L$(){return!1}function V$(){return!L$()||process.env.STX_DEBUG==="true"}function U4(){return!1}import mU from"path";function z4(){return{...I3}}function j4($){if(!I3.showRelativePaths||!$)return $;let Z=I3.baseDir||process.cwd();try{let Y=mU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var dU,I3,B4,Y5,H4;var _4=b(()=>{q4();dU={showRelativePaths:!1,enableAutoRecovery:V$(),logRecoveryWarnings:!0},I3={...dU};B4=class B4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=j4(this.filePath)}};Y5=class Y5 extends B4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};H4=class H4 extends B4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function N2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:U,format:z="text"}=$,j=Q,H=G;if(!j&&K&&W!==void 0){let L=sU(K,W);j=L.line,H=L.column}let B=X?j4(X):void 0,_=J?T3(J):void 0,O={type:Z,code:J,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:q,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=pU(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=cU(O,K,W);break;case"text":default:F=lU(O,K,W);break}return{formatted:F,data:O}}function lU($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
1677
+ ${$.message}`),Z&&$.line){let Q=iU(Z,$.line,2);if(Q)J.push(`
1678
1678
  ${Q}`)}if($.snippet)J.push(`
1679
1679
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
1680
- Suggestion: ${$.suggestion}`);return J.join(" ")}function lU($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${A2($.message)}`;if($.suggestion)J+=` | Suggestion: ${A2($.suggestion)}`;return J+=" -->",J}function pU($,Z,Y){let q=[],U=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
1680
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function pU($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${M2($.message)}`;if($.suggestion)J+=` | Suggestion: ${M2($.suggestion)}`;return J+=" -->",J}function cU($,Z,Y){let q=[],U=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
1681
1681
  \x1B[90mat\x1B[0m ${z}`)}if(q.push(`
1682
1682
 
1683
- ${$.message}`),Z&&$.line){let z=iU(Z,$.line,2);if(z)q.push(`
1683
+ ${$.message}`),Z&&$.line){let z=nU(Z,$.line,2);if(z)q.push(`
1684
1684
 
1685
1685
  \x1B[90mContext:\x1B[0m
1686
1686
  ${z}`)}if($.suggestion)q.push(`
1687
1687
 
1688
1688
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return q.push(`
1689
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),q.join("")}function cU($,Z,Y){let J=$.split(`
1689
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),q.join("")}function iU($,Z,Y){let J=$.split(`
1690
1690
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G=[];for(let K=X;K<=Q;K++){let W=(K+1).toString().padStart(4),q=K===Z-1?">":" ";G.push(`${q}${W} | ${J[K]}`)}return G.join(`
1691
- `)}function iU($,Z,Y){let J=$.split(`
1691
+ `)}function nU($,Z,Y){let J=$.split(`
1692
1692
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",q=[];for(let U=X;U<=Q;U++){let z=(U+1).toString().padStart(4),j=U===Z-1,H=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${J[U]}\x1B[0m`:`\x1B[90m${J[U]}\x1B[0m`;q.push(`${H}\x1B[90m${z}\x1B[0m | ${B}`)}return q.join(`
1693
- `)}function A2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function nU($,Z){let J=$.substring(0,Z).split(`
1694
- `);return{line:J.length,column:J[J.length-1].length}}function Z0($,Z,Y){return M2({type:$,message:Z,code:Y,format:"html"}).formatted}async function b5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var N2=b(()=>{q4();_4()});class E3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1693
+ `)}function M2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function sU($,Z){let J=$.substring(0,Z).split(`
1694
+ `);return{line:J.length,column:J[J.length-1].length}}function Z0($,Z,Y){return N2({type:$,message:Z,code:Y,format:"html"}).formatted}async function b5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var T2=b(()=>{q4();_4()});class E3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1695
1695
  `).slice(1).join(`
1696
1696
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1697
1697
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
1698
1698
  `;Z.appendFileSync(this.logFilePath,X,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,X=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,X)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let X=Y.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),X=(await import("path")).dirname($);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
1699
1699
 
1700
- `),"utf-8")}}async flush(){await this.writeQueue}}var D3,Z1,k3;var T2=b(()=>{_4();D3={isEnabled(){return z4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=z4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let U=W-q;for(let z=0;z<U;z++)Y+=`
1700
+ `),"utf-8")}}async flush(){await this.writeQueue}}var D3,Z1,k3;var I2=b(()=>{_4();D3={isEnabled(){return z4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=z4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let U=W-q;for(let z=0;z<U;z++)Y+=`
1701
1701
  @end${K}`;J.push(`Added ${U} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(V$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new E3,k3={isDevelopment(){return V$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1702
- `)}}});var I2=()=>{};var D2=b(()=>{q4();N2();T2();I2();_4()});var V1=b(()=>{D2()});function T0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}function C1($,Z){let Y=sU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function sU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=T0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function oU($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function J5($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),U=W?W.index:1/0,z=q?q.index:1/0;if(U<z)X++,Q=U+W[0].length;else if(z<1/0){if(X--,X===0)return z;Q=z+q[0].length}else break}return-1}function E2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U="if",z=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(oU(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q});let F=q+O[0].length,L=C1(K,F);if(!L){q++;continue}U="elseif",z=L.expression,q=L.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q}),U="else",z=void 0,q+=5,j=q;continue}}q++}return W.push({type:U,condition:z,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function w$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=E2($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function O4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=T0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let U=$.slice(W+1,q),z=q+1,j=J5($,Z,Y,z);if(j===-1){Q=X.exec($);continue}let H=$.slice(z,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:U,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function b3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U=null,z=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(z++,U)U.content+=H[0];q+=H[0].length;continue}if(B){if(z--,U)U.content+=B[0];q+=B[0].length;continue}if(z>0){if(U)U.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,V=C1(K,L);if(!V){q++;continue}U={type:"case",value:V.expression,content:""},q=V.endPos}else if(O&&j.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=O[0].length}else if(F&&j.startsWith("@break"))q+=F[0].length;else{if(U)U.content+=K[q];q++}}if(U)W.push(U);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var k2=()=>{};var b2=()=>{};var F4=b(()=>{k2();b2()});function eU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=b3(J,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=J0(K.expression,Z);let q="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)q=z.content.trim()}else try{let j;if(z.value&&W0(z.value))j=q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=J0(z.value,Z);if(W===j){q=z.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(K.end);break}}return J}function $z($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function Zz($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,J)=>Z[Number(J)]??Y)}function X5($,Z,Y){let{masked:J,scripts:X}=$z($);return Zz(Yz(J,Z,Y),X)}function Yz($,Z,Y){let J=$;J=eU(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=C1(J,K+7);if(!W)break;let q=W.endPos,U=J5(J,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(q,U),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=z.slice(0,H),O=z.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${z}@endif`;J=J.substring(0,K)+B+J.substring(U+10),Q=!0}}J=y3(J,Z,Y),J=P3(J,Z,Y),J=S3(J,Z);let X=()=>{let Q=w$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let U of K.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let z;if(U.condition&&W0(U.condition))z=q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=J0(U.condition,Z);if(z)W=U.content,q=!0}catch(z){W=Z0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,K.start)+U+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function S2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let Y=$;function J(K,W,q,U){let z=1,j=U,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&z>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)z++,j=F+_[0].length;else if(L<1/0){if(z--,z===0)return L;j=L+O[0].length}else break}return-1}function X(K,W,q){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=z.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+5),H=S2(j);if(H)U=H.value,z=q+5+H.consumed;else z=q+5;let B=J(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?P1(`auth?.check && auth?.user?.[${U}]`,Z):P1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+6),H=S2(j);if(H)U=H.value,z=q+6+H.consumed;else z=q+6;let B=J(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?P1(`!auth?.check || !auth?.user?.[${U}]`,Z):P1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(W)U.push(W);if(q){let z=P1(q,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=J(Y,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),A=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,N=[],I;while((I=w.exec(F))!==null)N.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)N.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)N.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)N.push({pos:I.index,type:"else"});N.sort((S,C)=>S.pos-C.pos);for(let S of N){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${q}`.length),m=G(x);if(m){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${q}`.length+m.paramsEnd,T.push({content:"",ability:m.ability,type:m.type,id:m.id}),T.pop();let l=L[S+1],G0=l?l.pos:F.length;T.push({content:F.slice(k,G0),ability:m.ability,type:m.type,id:m.id}),k=G0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let m=Q(x.ability,x.type,x.id);if(K==="can"?m:!m){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${W}`.length),U=!0}}return Y}function y3($,Z,Y){let J=$;function X(Q,G,K,W,q){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=Q.match(z);if(!j||j.index===void 0)break;let H=j.index,B=C1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=J5(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let M=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){V=A;break}R=A+1}try{let A=W(L.trim()),M;if(V!==-1){let N=F.slice(0,V),I=F.slice(V+5);M=A?N:I}else M=A?F:"";Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length),U=!0}catch(A){let M=A instanceof Error?A.message:String(A),N=Z0(q,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+N+Q.substring(O+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=P1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=P1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function P3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,q=X===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),P=z.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let A=B.substring(L,R),M=-1,N=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(j.test(P)){N++,I=D+1;continue}if(H.test(P)){N--,I=D+1;continue}if(N===0&&/^@else(?![a-z])/.test(P)){M=D;break}I=D+1}let T;if(M!==-1){let D=A.slice(0,M),P=A.slice(M+5);T=q?D:P}else T=q?A:"";let k=`@${W}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var L4=b(()=>{R2();V1();F4();V0()});function P2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function V4($,Z){if(!$)return Z?.nonceGenerator?.()??P2();let Y=y2.get($);if(!Y)Y=Z?.nonceGenerator?.()??P2(),y2.set($,Y);return Y}function Jz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function C2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Jz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function v2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?V4(Y,Z):void 0,X=C2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
1703
- ${X}`)}function x2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function f2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?V4(Z,Q):void 0;return C2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return V4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=V4(Z,Q);return X}var y2;var g2=b(()=>{y2=new WeakMap});import Xz from"crypto";function Gz($=Qz){let Z=Xz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return C3=Z,Z}function Kz(){if(!C3)Gz();return C3}function Wz($=h2){let Z=Kz();return`<input type="hidden" name="${$}" value="${Z}">`}function u2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Wz(J||h2)})}var Qz=40,h2="_token",C3=null;var m2=()=>{};async function d2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await qz(X,Q,Z,Y,J);else X=await Uz(X,Q,Z,Y,J)}return X}async function qz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,U=D5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],j=U.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?l2(B):[],L=_.trim(),V=await G(L,F,Y,J);z.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}j=U.exec(q)}for(let H=z.length-1;H>=0;H--){let{original:B,processed:_}=z[H];q=q.replace(B,_)}return q}async function Uz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=D5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(K);while(U!==null){let[H,B=""]=U,_=U.index||0;try{let O=l2(B),F=await G("",O,Y,J);q.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(K)}let z=D5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,J);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function l2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var p2=b(()=>{V1();E5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function jz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Y.key,"appearance.key"),Q5(Y.attribute,"appearance.attribute"),Q5(Y.default,"appearance.default"),Q5(J.key,"colorMode.key"),Q5(J.attribute,"colorMode.attribute"),Q5(J.default,"colorMode.default"),!i2.test(Y.key)||!i2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!c2.test(Y.attribute)||!c2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!zz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function Bz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Hz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Bz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function _z($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function n2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=_z(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=J0(`(${K})`,Z),q=Hz(jz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var c2,i2,zz;var s2=b(()=>{V0();c2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,i2=/^[A-Za-z_$][\w$]*$/,zz=new Set(["light","dark","system"])});var f3={};t(f3,{useTitle:()=>wz,useSeoMeta:()=>o2,usePageTitle:()=>wz,useHead:()=>x3,seoMetaToHeadConfig:()=>R4,resetHead:()=>Lz,renderHtmlAttrs:()=>Az,renderHead:()=>Rz,renderBodyAttrs:()=>Mz,processTitleDirective:()=>Iz,processMetaDirective:()=>Dz,processHeadDirective:()=>Tz,mergeHeadConfigs:()=>S5,getPageMeta:()=>Fz,getHead:()=>v3,definePageMeta:()=>Vz,applyHead:()=>Nz});function v3(){return v1}function Fz(){return w4}function Lz(){v1={},Oz.length=0,w4={}}function x3($){v1=S5(v1,$)}function S5($,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 o2($){x3(R4($))}function R4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function Vz($){if(w4={...w4,...$},$.title||$.description)o2({title:$.title,description:$.description})}function wz($){let Z=typeof $==="function"?$():$;x3({title:Z})}function Rz($=v1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${G5(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${G5(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${G5(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${G5(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G5(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
1704
- `)}function Az($=v1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function Mz($=v1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function G5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Nz($=v1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let J of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function Tz($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
1705
- `,""}),headContent:Z.trim()}}function Iz($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(K,{title:G}),""})}function Dz($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,z=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(j,{meta:[z]}),""})}var v1,Oz,w4;var R$=b(()=>{v1={},Oz=[],w4={}});import Ez from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function i0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function y5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function g3($,Z,Y){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(Y))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))J+=` aria-describedby="${O0(`${i0($)}-error`)}"`;return J}function kz(){return Ez.randomUUID()}function M4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=kz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return J}),Y}function t2($,Z,Y=a2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"POST",z=K||W||"",j=x1(q),H=U.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${O0(B)}" action="${O0(z)}"${j?` ${j}`:""}>`;if(_+=`
1702
+ `)}}});var D2=()=>{};var E2=b(()=>{q4();T2();I2();D2();_4()});var V1=b(()=>{E2()});function T0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}function C1($,Z){let Y=oU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function oU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=T0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function rU($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function J5($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),U=W?W.index:1/0,z=q?q.index:1/0;if(U<z)X++,Q=U+W[0].length;else if(z<1/0){if(X--,X===0)return z;Q=z+q[0].length}else break}return-1}function k2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U="if",z=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(rU(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q});let F=q+O[0].length,L=C1(K,F);if(!L){q++;continue}U="elseif",z=L.expression,q=L.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q}),U="else",z=void 0,q+=5,j=q;continue}}q++}return W.push({type:U,condition:z,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function w$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=k2($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function O4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=T0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let U=$.slice(W+1,q),z=q+1,j=J5($,Z,Y,z);if(j===-1){Q=X.exec($);continue}let H=$.slice(z,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:U,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function b3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U=null,z=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(z++,U)U.content+=H[0];q+=H[0].length;continue}if(B){if(z--,U)U.content+=B[0];q+=B[0].length;continue}if(z>0){if(U)U.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,V=C1(K,L);if(!V){q++;continue}U={type:"case",value:V.expression,content:""},q=V.endPos}else if(O&&j.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=O[0].length}else if(F&&j.startsWith("@break"))q+=F[0].length;else{if(U)U.content+=K[q];q++}}if(U)W.push(U);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var b2=()=>{};var S2=()=>{};var F4=b(()=>{b2();S2()});function $z($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=b3(J,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=J0(K.expression,Z);let q="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)q=z.content.trim()}else try{let j;if(z.value&&W0(z.value))j=q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=J0(z.value,Z);if(W===j){q=z.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(K.end);break}}return J}function Zz($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function Yz($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,J)=>Z[Number(J)]??Y)}function X5($,Z,Y){let{masked:J,scripts:X}=Zz($);return Yz(Jz(J,Z,Y),X)}function Jz($,Z,Y){let J=$;J=$z(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=C1(J,K+7);if(!W)break;let q=W.endPos,U=J5(J,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(q,U),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=z.slice(0,H),O=z.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${z}@endif`;J=J.substring(0,K)+B+J.substring(U+10),Q=!0}}J=y3(J,Z,Y),J=P3(J,Z,Y),J=S3(J,Z);let X=()=>{let Q=w$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let U of K.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let z;if(U.condition&&W0(U.condition))z=q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=J0(U.condition,Z);if(z)W=U.content,q=!0}catch(z){W=Z0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,K.start)+U+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function y2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let Y=$;function J(K,W,q,U){let z=1,j=U,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&z>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)z++,j=F+_[0].length;else if(L<1/0){if(z--,z===0)return L;j=L+O[0].length}else break}return-1}function X(K,W,q){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=z.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+5),H=y2(j);if(H)U=H.value,z=q+5+H.consumed;else z=q+5;let B=J(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?P1(`auth?.check && auth?.user?.[${U}]`,Z):P1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+6),H=y2(j);if(H)U=H.value,z=q+6+H.consumed;else z=q+6;let B=J(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?P1(`!auth?.check || !auth?.user?.[${U}]`,Z):P1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(W)U.push(W);if(q){let z=P1(q,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=J(Y,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),A=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,N=[],I;while((I=w.exec(F))!==null)N.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)N.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)N.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)N.push({pos:I.index,type:"else"});N.sort((S,C)=>S.pos-C.pos);for(let S of N){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${q}`.length),m=G(x);if(m){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${q}`.length+m.paramsEnd,T.push({content:"",ability:m.ability,type:m.type,id:m.id}),T.pop();let l=L[S+1],G0=l?l.pos:F.length;T.push({content:F.slice(k,G0),ability:m.ability,type:m.type,id:m.id}),k=G0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let m=Q(x.ability,x.type,x.id);if(K==="can"?m:!m){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${W}`.length),U=!0}}return Y}function y3($,Z,Y){let J=$;function X(Q,G,K,W,q){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=Q.match(z);if(!j||j.index===void 0)break;let H=j.index,B=C1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=J5(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let M=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){V=A;break}R=A+1}try{let A=W(L.trim()),M;if(V!==-1){let N=F.slice(0,V),I=F.slice(V+5);M=A?N:I}else M=A?F:"";Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length),U=!0}catch(A){let M=A instanceof Error?A.message:String(A),N=Z0(q,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+N+Q.substring(O+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=P1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=P1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function P3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,q=X===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),P=z.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let A=B.substring(L,R),M=-1,N=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(j.test(P)){N++,I=D+1;continue}if(H.test(P)){N--,I=D+1;continue}if(N===0&&/^@else(?![a-z])/.test(P)){M=D;break}I=D+1}let T;if(M!==-1){let D=A.slice(0,M),P=A.slice(M+5);T=q?D:P}else T=q?A:"";let k=`@${W}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var L4=b(()=>{A2();V1();F4();V0()});function C2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function V4($,Z){if(!$)return Z?.nonceGenerator?.()??C2();let Y=P2.get($);if(!Y)Y=Z?.nonceGenerator?.()??C2(),P2.set($,Y);return Y}function Xz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function v2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Xz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function x2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?V4(Y,Z):void 0,X=v2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
1703
+ ${X}`)}function f2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function g2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?V4(Z,Q):void 0;return v2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return V4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=V4(Z,Q);return X}var P2;var h2=b(()=>{P2=new WeakMap});import Qz from"crypto";function Kz($=Gz){let Z=Qz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return C3=Z,Z}function Wz(){if(!C3)Kz();return C3}function qz($=u2){let Z=Wz();return`<input type="hidden" name="${$}" value="${Z}">`}function m2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return qz(J||u2)})}var Gz=40,u2="_token",C3=null;var d2=()=>{};async function l2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await Uz(X,Q,Z,Y,J);else X=await zz(X,Q,Z,Y,J)}return X}async function Uz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,U=D5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],j=U.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?p2(B):[],L=_.trim(),V=await G(L,F,Y,J);z.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}j=U.exec(q)}for(let H=z.length-1;H>=0;H--){let{original:B,processed:_}=z[H];q=q.replace(B,_)}return q}async function zz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=D5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(K);while(U!==null){let[H,B=""]=U,_=U.index||0;try{let O=p2(B),F=await G("",O,Y,J);q.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(K)}let z=D5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,J);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function p2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var c2=b(()=>{V1();E5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Bz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Y.key,"appearance.key"),Q5(Y.attribute,"appearance.attribute"),Q5(Y.default,"appearance.default"),Q5(J.key,"colorMode.key"),Q5(J.attribute,"colorMode.attribute"),Q5(J.default,"colorMode.default"),!n2.test(Y.key)||!n2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!i2.test(Y.attribute)||!i2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!jz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function Hz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function _z($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Hz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function Oz($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function s2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=Oz(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=J0(`(${K})`,Z),q=_z(Bz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var i2,n2,jz;var o2=b(()=>{V0();i2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,n2=/^[A-Za-z_$][\w$]*$/,jz=new Set(["light","dark","system"])});var f3={};t(f3,{useTitle:()=>Rz,useSeoMeta:()=>r2,usePageTitle:()=>Rz,useHead:()=>x3,seoMetaToHeadConfig:()=>R4,resetHead:()=>Vz,renderHtmlAttrs:()=>Mz,renderHead:()=>Az,renderBodyAttrs:()=>Nz,processTitleDirective:()=>Dz,processMetaDirective:()=>Ez,processHeadDirective:()=>Iz,mergeHeadConfigs:()=>S5,getPageMeta:()=>Lz,getHead:()=>v3,definePageMeta:()=>wz,applyHead:()=>Tz});function v3(){return v1}function Lz(){return w4}function Vz(){v1={},Fz.length=0,w4={}}function x3($){v1=S5(v1,$)}function S5($,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 r2($){x3(R4($))}function R4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function wz($){if(w4={...w4,...$},$.title||$.description)r2({title:$.title,description:$.description})}function Rz($){let Z=typeof $==="function"?$():$;x3({title:Z})}function Az($=v1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${G5(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${G5(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${G5(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${G5(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G5(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
1704
+ `)}function Mz($=v1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function Nz($=v1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function G5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Tz($=v1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let J of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function Iz($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
1705
+ `,""}),headContent:Z.trim()}}function Dz($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(K,{title:G}),""})}function Ez($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,z=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(j,{meta:[z]}),""})}var v1,Fz,w4;var R$=b(()=>{v1={},Fz=[],w4={}});import kz from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function i0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function y5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function g3($,Z,Y){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(Y))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))J+=` aria-describedby="${O0(`${i0($)}-error`)}"`;return J}function bz(){return kz.randomUUID()}function M4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=bz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return J}),Y}function e2($,Z,Y=t2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"POST",z=K||W||"",j=x1(q),H=U.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${O0(B)}" action="${O0(z)}"${j?` ${j}`:""}>`;if(_+=`
1706
1706
  ${M4("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
1707
- ${M4(`@method('${H}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"",z=K||W||"",j=x1(q),H=A$(U,Z),B=H!==void 0&&H!==null?H:z||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=M$(U,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=A4(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(O)}" name="${O0(U)}"${y5(j,i0(U))} value="${O0(B)}" class="${V}"${g3(U,F,j)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=x1(G),q=A$(Q,Z)||K.trim(),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${O0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=x1(G),q=A$(Q,Z),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(q)?q.some((V)=>String(V)===F):String(q)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?i0(Q):`${i0(Q)}-${i0(W)}`,U=x1(K),z=A$(Q,Z),j=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===W):z===!0||String(z)===W),H=U.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${y5(U,q)} value="${O0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=x1(K),q=A$(Q,Z),U=q!==void 0&&q===G,z=W.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${y5(W,`${i0(Q)}-${i0(G)}`)} value="${O0(G)}" class="${j}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=x1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",U=K.includes("multiple"),z=M$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=A4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(Q)}"${y5(K,i0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${O0(q)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=x1(G),q=W.match(/class=['"]([^'"]+)['"]/i),U=q?q[1]:Y.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(i0(Q))}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),J}function e2($,Z,Y=a2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(M$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return r2(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return r2(X,Z)}let q=W.trim();if(W0(q)){let U=J0(q,Z);return U!==void 0?String(U):q}return q}catch{return W}});return`<div id="${O0(`${i0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function M$($,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 r2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function A$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function x1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var a2;var $Y=b(()=>{V0();a2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import m3 from"path";async function bz(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function Sz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function yz($,Z){if({...p3,...Z.i18n}.cache&&d3[$]){let X=d3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Sz(X,Q))return X.translations}if(T$[$]?.state==="loading")return T$[$].promise;h3[$]="loading";let J=l3($,Z).then((X)=>{return h3[$]="loaded",delete T$[$],X}).catch((X)=>{throw h3[$]="error",T$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return T$[$]={promise:J,state:"loading"},J}async function l3($,Z){let Y={...p3,...Z.i18n},J=m3.isAbsolute(Y.translationsDir)?Y.translationsDir:m3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await bz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:fz(Y.format)}):await Pz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)d3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}}async function Pz($,Z,Y){let J=m3.join(Y,`${$}${Cz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return vz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Cz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function vz($){let Z={},Y=$.split(`
1708
- `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,z=q.trim(),j=U.trim();if(j==="")K[z]={},J.push({obj:K[z],indent:G});else K[z]=xz(j)}}return Z}function xz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function fz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function gz($,Z){return yz($,Z)}function hz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function uz($,Z={}){return JY($,Z)}function JY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=mz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=dz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function mz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function dz($,Z){let Y=lz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return pz(X,Y.slice(2).join(","),Z);case"select":return iz(X,Y.slice(2).join(","));case"selectordinal":return nz(X,Y.slice(2).join(","));case"number":return oz(X,Y[2]?.trim());case"date":return rz(X,Y[2]?.trim());case"time":return az(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function lz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function pz($,Z,Y){let J=Number($)||0,X=c3(Z),Q=`=${J}`;if(X[Q])return u3(X[Q],J,Y);let G=cz(J);if(X[G])return u3(X[G],J,Y);if(X.other)return u3(X.other,J,Y);return String(J)}function u3($,Z,Y){let J=$.replace(/#/g,String(Z));return JY(J,Y)}function cz($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function iz($,Z){let Y=String($||""),J=c3(Z);if(J[Y])return J[Y];return J.other||String($)}function nz($,Z){let Y=Number($)||0,J=c3(Z),X=sz(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function sz($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function c3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function oz($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function rz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function az($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function tz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(tz(G))return uz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=hz(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function XY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...J.i18n},K=await gz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await YY(X,Q,async(U,z,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return L0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return ZY(z,K,G.fallbackToKey,_)||H.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...X.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return X=await YY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return L0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return ZY(z,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return Z0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function YY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,p3,d3,T$,h3;var QY=b(()=>{V1();V0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},T$={},h3={}});function $j($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return ez.test(Z)}function P5($){I$.lastIndex=0;let Z;while((Z=I$.exec($))!==null){if(Z[0].startsWith("</")||$j(Z[0]))continue;let Y=Z.index,J=I$.lastIndex,X=1,Q;while((Q=I$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:I$.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var I$,ez;var N4=b(()=>{I$=/<\/?template\b[^>]*>/gi,ez=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var s3={};t(s3,{streamingSuspenseDirective:()=>WY,streamToResponse:()=>jj,streamTemplateSimple:()=>Wj,streamTemplate:()=>Yj,renderStreamingPage:()=>Xj,registerStreamingDirectives:()=>Uj,processStreamDirectives:()=>Gj,processSectionDirectives:()=>zj,islandDirective:()=>qY,generateHydrationRuntime:()=>Bj,extractStreamBoundaries:()=>Kj,createStreamRenderer:()=>qj,buildSuspenseResolveScript:()=>n3,SUSPENSE_RESOLVER_RUNTIME:()=>KY});import T4 from"path";function Zj($){let Z=[],Y=0,J;GY.lastIndex=0;while((J=GY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Yj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=Zj(q),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",_=new RegExp(K5.source,"g");if(!(B!=="manual"&&_.test(q))){let F=await w0(q,U,$,J,j);for(let L=0;L<F.length;L+=X)Q.enqueue(F.slice(L,L+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(K5.source,"g"),V;while((V=L.exec(q))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let M=q.slice(w,R.start);if(M.trim()){let N=await w0(M,U,$,J,j);Q.enqueue(N),await new Promise((I)=>setTimeout(I,0))}}let A=await w0(R.content,U,$,J,j);Q.enqueue(A),await new Promise((M)=>setTimeout(M,0)),w=R.end}if(w<q.length){let R=q.slice(w);if(R.trim()){let A=await w0(R,U,$,J,j);Q.enqueue(A)}}}}else{let B=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let F=await w0(O.content,U,$,J,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
1707
+ ${M4(`@method('${H}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"",z=K||W||"",j=x1(q),H=A$(U,Z),B=H!==void 0&&H!==null?H:z||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=M$(U,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=A4(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(O)}" name="${O0(U)}"${y5(j,i0(U))} value="${O0(B)}" class="${V}"${g3(U,F,j)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=x1(G),q=A$(Q,Z)||K.trim(),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${O0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=x1(G),q=A$(Q,Z),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(q)?q.some((V)=>String(V)===F):String(q)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?i0(Q):`${i0(Q)}-${i0(W)}`,U=x1(K),z=A$(Q,Z),j=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===W):z===!0||String(z)===W),H=U.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${y5(U,q)} value="${O0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=x1(K),q=A$(Q,Z),U=q!==void 0&&q===G,z=W.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${y5(W,`${i0(Q)}-${i0(G)}`)} value="${O0(G)}" class="${j}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=x1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",U=K.includes("multiple"),z=M$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=A4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(Q)}"${y5(K,i0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${O0(q)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=x1(G),q=W.match(/class=['"]([^'"]+)['"]/i),U=q?q[1]:Y.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(i0(Q))}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),J}function $Y($,Z,Y=t2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(M$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return a2(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return a2(X,Z)}let q=W.trim();if(W0(q)){let U=J0(q,Z);return U!==void 0?String(U):q}return q}catch{return W}});return`<div id="${O0(`${i0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function M$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function a2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function A$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function x1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var t2;var ZY=b(()=>{V0();t2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import m3 from"path";async function Sz(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function yz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Pz($,Z){if({...p3,...Z.i18n}.cache&&d3[$]){let X=d3[$],Q=Z.i18n?.cacheMaxAge??0;if(!yz(X,Q))return X.translations}if(T$[$]?.state==="loading")return T$[$].promise;h3[$]="loading";let J=l3($,Z).then((X)=>{return h3[$]="loaded",delete T$[$],X}).catch((X)=>{throw h3[$]="error",T$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return T$[$]={promise:J,state:"loading"},J}async function l3($,Z){let Y={...p3,...Z.i18n},J=m3.isAbsolute(Y.translationsDir)?Y.translationsDir:m3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Sz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:gz(Y.format)}):await Cz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)d3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}}async function Cz($,Z,Y){let J=m3.join(Y,`${$}${vz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return xz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function vz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function xz($){let Z={},Y=$.split(`
1708
+ `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,z=q.trim(),j=U.trim();if(j==="")K[z]={},J.push({obj:K[z],indent:G});else K[z]=fz(j)}}return Z}function fz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function gz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function hz($,Z){return Pz($,Z)}function uz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function mz($,Z={}){return XY($,Z)}function XY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=dz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=lz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function dz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function lz($,Z){let Y=pz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return cz(X,Y.slice(2).join(","),Z);case"select":return nz(X,Y.slice(2).join(","));case"selectordinal":return sz(X,Y.slice(2).join(","));case"number":return rz(X,Y[2]?.trim());case"date":return az(X,Y[2]?.trim());case"time":return tz(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function pz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function cz($,Z,Y){let J=Number($)||0,X=c3(Z),Q=`=${J}`;if(X[Q])return u3(X[Q],J,Y);let G=iz(J);if(X[G])return u3(X[G],J,Y);if(X.other)return u3(X.other,J,Y);return String(J)}function u3($,Z,Y){let J=$.replace(/#/g,String(Z));return XY(J,Y)}function iz($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function nz($,Z){let Y=String($||""),J=c3(Z);if(J[Y])return J[Y];return J.other||String($)}function sz($,Z){let Y=Number($)||0,J=c3(Z),X=oz(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function oz($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function c3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function rz($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function az($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function tz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function ez($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function YY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(ez(G))return mz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=uz(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function QY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...J.i18n},K=await hz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await JY(X,Q,async(U,z,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return L0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return YY(z,K,G.fallbackToKey,_)||H.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...X.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return X=await JY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return L0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return YY(z,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return Z0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function JY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,p3,d3,T$,h3;var GY=b(()=>{V1();V0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},T$={},h3={}});function Zj($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return $j.test(Z)}function P5($){I$.lastIndex=0;let Z;while((Z=I$.exec($))!==null){if(Z[0].startsWith("</")||Zj(Z[0]))continue;let Y=Z.index,J=I$.lastIndex,X=1,Q;while((Q=I$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:I$.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var I$,$j;var N4=b(()=>{I$=/<\/?template\b[^>]*>/gi,$j=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var s3={};t(s3,{streamingSuspenseDirective:()=>qY,streamToResponse:()=>Bj,streamTemplateSimple:()=>qj,streamTemplate:()=>Jj,renderStreamingPage:()=>Qj,registerStreamingDirectives:()=>zj,processStreamDirectives:()=>Kj,processSectionDirectives:()=>jj,islandDirective:()=>UY,generateHydrationRuntime:()=>Hj,extractStreamBoundaries:()=>Wj,createStreamRenderer:()=>Uj,buildSuspenseResolveScript:()=>n3,SUSPENSE_RESOLVER_RUNTIME:()=>WY});import T4 from"path";function Yj($){let Z=[],Y=0,J;KY.lastIndex=0;while((J=KY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Jj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=Yj(q),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",_=new RegExp(K5.source,"g");if(!(B!=="manual"&&_.test(q))){let F=await w0(q,U,$,J,j);for(let L=0;L<F.length;L+=X)Q.enqueue(F.slice(L,L+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(K5.source,"g"),V;while((V=L.exec(q))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let M=q.slice(w,R.start);if(M.trim()){let N=await w0(M,U,$,J,j);Q.enqueue(N),await new Promise((I)=>setTimeout(I,0))}}let A=await w0(R.content,U,$,J,j);Q.enqueue(A),await new Promise((M)=>setTimeout(M,0)),w=R.end}if(w<q.length){let R=q.slice(w);if(R.trim()){let A=await w0(R,U,$,J,j);Q.enqueue(A)}}}}else{let B=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let F=await w0(O.content,U,$,J,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
1709
1709
  <template data-suspense-fallback>Loading...</template>
1710
1710
  </div>`),B.set(O.name,w0(O.content,U,$,J,j))}Q.enqueue(`
1711
1711
  <script>
@@ -1729,7 +1729,7 @@ window.__stxSuspense.resolve('${$}', \`${J}\`);
1729
1729
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
1730
1730
  <script>
1731
1731
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(J)}</div>');
1732
- </script>`}}function Jj($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function Xj($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(KY),await Promise.all(Z.map(async(Q)=>{let G=Jj(Q.render(),J,Q.id);X.enqueue(await n3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function Gj($,Z){return $.replace(Qj,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function Kj($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function Wj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=new Set,j=J.streaming?.strategy||"auto",H=new RegExp(K5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await w0(q,U,$,J,z);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(K5.source,"g"),F;while((F=O.exec(q))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=q.slice(L,V.start);if(R.trim()){let A=await w0(R,U,$,J,z);Q.enqueue(A)}}let w=await w0(V.content,U,$,J,z);Q.enqueue(w),L=V.end}if(L<q.length){let V=q.slice(L);if(V.trim()){let w=await w0(V,U,$,J,z);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function qj($,Z={}){let Y={...R1,...Z,streaming:{...i3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;K5.lastIndex=0;while((q=K5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let U=G.replace(K5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:T4.dirname($)};return await w1(Q,H,$),w0(U,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${t0(j)}" not found in template "${t0($)}"</div>`;let B={...H,__filename:$,__dirname:T4.dirname($)};await w1(Q,B,$);let _=new Set;return await w0(W[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function Uj($={}){let Z=[];if($.streaming?.enabled)Z.push(WY);if($.hydration?.enabled)Z.push(qY);return Z}async function zj($,Z,Y,J={}){return $}function jj($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function Bj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
1732
+ </script>`}}function Xj($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function Qj($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(WY),await Promise.all(Z.map(async(Q)=>{let G=Xj(Q.render(),J,Q.id);X.enqueue(await n3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function Kj($,Z){return $.replace(Gj,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function Wj($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function qj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=new Set,j=J.streaming?.strategy||"auto",H=new RegExp(K5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await w0(q,U,$,J,z);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(K5.source,"g"),F;while((F=O.exec(q))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=q.slice(L,V.start);if(R.trim()){let A=await w0(R,U,$,J,z);Q.enqueue(A)}}let w=await w0(V.content,U,$,J,z);Q.enqueue(w),L=V.end}if(L<q.length){let V=q.slice(L);if(V.trim()){let w=await w0(V,U,$,J,z);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function Uj($,Z={}){let Y={...R1,...Z,streaming:{...i3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;K5.lastIndex=0;while((q=K5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let U=G.replace(K5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:T4.dirname($)};return await w1(Q,H,$),w0(U,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${t0(j)}" not found in template "${t0($)}"</div>`;let B={...H,__filename:$,__dirname:T4.dirname($)};await w1(Q,B,$);let _=new Set;return await w0(W[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function zj($={}){let Z=[];if($.streaming?.enabled)Z.push(qY);if($.hydration?.enabled)Z.push(UY);return Z}async function jj($,Z,Y,J={}){return $}function Bj($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function Hj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
1733
1733
  `);if(Z==="loader")return`
1734
1734
  (function() {
1735
1735
  window.__stx = window.__stx || {};
@@ -1871,7 +1871,7 @@ else {
1871
1871
  else {
1872
1872
  stx.hydrate();
1873
1873
  }
1874
- })();`}var i3,K5,GY,KY=`
1874
+ })();`}var i3,K5,KY,WY=`
1875
1875
  <script>
1876
1876
  (function(){
1877
1877
  window.__stxSuspense = window.__stxSuspense || {
@@ -1891,25 +1891,25 @@ else {
1891
1891
  }
1892
1892
  };
1893
1893
  })();
1894
- </script>`,Qj,WY,qY;var o3=b(()=>{O1();K1();I4();M0();i3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},K5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,GY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Qj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;WY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},qY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
1894
+ </script>`,Gj,qY,UY;var o3=b(()=>{O1();K1();I4();M0();i3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},K5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,KY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Gj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;qY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},UY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
1895
1895
  ${q}
1896
1896
  <script type="application/json" data-island-props="${G}">
1897
1897
  ${W?`{${W}}`:"{}"}
1898
1898
  </script>
1899
- </div>`}}});var jY={};t(jY,{warnUnbalancedTags:()=>r3,findUnbalancedTags:()=>zY});function C5($){return $.replace(/[^\n]/g," ")}function zY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,C5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,C5).replace(/<!--[\s\S]*?-->/g,C5).replace(/\{\{\{[\s\S]*?\}\}\}/g,C5).replace(/\{\{[\s\S]*?\}\}/g,C5).replace(/\{!![\s\S]*?!!\}/g,C5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(Hj.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let U=Y.get(W);if(U)U.count++;else{let z=Z.slice(0,Q.index).split(`
1900
- `).length;Y.set(W,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(_j.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,q=J.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function r3($,Z){let Y;try{Y=zY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(UY.has(J))return;UY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var Hj,_j,UY;var a3=b(()=>{Hj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_j=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);UY=new Set});import n0 from"path";import t3 from"fs";function BY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function HY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class _Y{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let H=[X,X.toLowerCase(),BY(X),HY(X)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${BY(X)}.stx`,`${HY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let H=n0.resolve(n0.dirname(Z),`${X}.stx`);if(await i(H))return H;return null}let K=[],W=Y.componentsDir||"",q=J?.__originalFilePath;if(q)K.push(n0.join(n0.dirname(q),"components"));if(W)K.push(W);let U=n0.join(n0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[n0.resolve(z,"src/components"),n0.resolve(z,"components"),n0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=n0.join(H,B);if(await i(_))return _}try{if(!t3.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=t3.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let F=n0.join(H,O.name);for(let L of G){let V=n0.join(F,L);if(await i(V))return V}}}catch{}}return null}}var v0;var e3=b(()=>{M0();v0=new _Y});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OY($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function v5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(I0(Q));continue}if(X===W5){Y.push(I0(Q));continue}Y.push(`${I0(Q)}="${I0(OY(String(X)))}"`)}return Y}var D4=()=>{};function D$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Oj($){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 $6;var Z6=b(()=>{D4();$6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=Oj($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${D$(J.value)}"`);else W.push(`href="${D$(J.value)}"`);if(X)W.push(`class="${D$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${D$(Q)}"`),W.push(`data-stx-exact-active-class="${D$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...v5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function J6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function FY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=Fj[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function X6($,Z,Y,J){return Z.map((X)=>`${E$($,X,void 0,Y,J)} ${X}w`).join(", ")}function Lj($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${E$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function E$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function Vj($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Fj,Y6,Q6;var G6=b(()=>{D4();Fj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Y6=[320,640,768,1024,1280,1536,1920];Q6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=b0($,"src")||"",X=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),W=b0($,"srcset"),q=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",H=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",_=b0($,"style")||"",O=b0($,"quality"),F=J6($,"lazy",!0),L=J6($,"preload",!1),V=J6($,"picture",!1)||!!U,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,A=W||"",M="";if(!A&&K)A=X6(J,Y6,H,U),M=FY(K);else if(!A&&q){let y=q.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=Lj(J,y,w,H,U)}else if(K)M=FY(K);let N=[];if(_)N.push(_);if(w&&R)N.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let y=Vj(w||16,R||9,j);N.push(`background-image:url(${y})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")N.push(`background-image:url(${D0(z)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let I=E$(J,w,R,H,U),T=[];if(T.push(`src="${D0(I)}"`),T.push(`alt="${D0(X)}"`),Q)T.push(`width="${D0(Q)}"`);if(G)T.push(`height="${D0(G)}"`);if(F)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${D0(B)}"`);if(N.length>0)T.push(`style="${D0(N.join(";"))}"`);if(A)T.push(`srcset="${D0(A)}"`);if(M)T.push(`sizes="${D0(M)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...v5($,k));let D=`<img ${T.join(" ")} />`,P="";if(L){let S=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${D0(I)}"${S?` type="${S}"`:""}${A?` imagesrcset="${D0(A)}"`:""}${M?` imagesizes="${D0(M)}"`:""} />
1899
+ </div>`}}});var BY={};t(BY,{warnUnbalancedTags:()=>r3,findUnbalancedTags:()=>jY});function C5($){return $.replace(/[^\n]/g," ")}function jY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,C5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,C5).replace(/<!--[\s\S]*?-->/g,C5).replace(/\{\{\{[\s\S]*?\}\}\}/g,C5).replace(/\{\{[\s\S]*?\}\}/g,C5).replace(/\{!![\s\S]*?!!\}/g,C5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(_j.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let U=Y.get(W);if(U)U.count++;else{let z=Z.slice(0,Q.index).split(`
1900
+ `).length;Y.set(W,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(Oj.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,q=J.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function r3($,Z){let Y;try{Y=jY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(zY.has(J))return;zY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var _j,Oj,zY;var a3=b(()=>{_j=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Oj=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);zY=new Set});import n0 from"path";import t3 from"fs";function HY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function _Y($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class OY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let H=[X,X.toLowerCase(),HY(X),_Y(X)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${HY(X)}.stx`,`${_Y(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let H=n0.resolve(n0.dirname(Z),`${X}.stx`);if(await i(H))return H;return null}let K=[],W=Y.componentsDir||"",q=J?.__originalFilePath;if(q)K.push(n0.join(n0.dirname(q),"components"));if(W)K.push(W);let U=n0.join(n0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[n0.resolve(z,"src/components"),n0.resolve(z,"components"),n0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=n0.join(H,B);if(await i(_))return _}try{if(!t3.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=t3.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let F=n0.join(H,O.name);for(let L of G){let V=n0.join(F,L);if(await i(V))return V}}}catch{}}return null}}var x0;var e3=b(()=>{M0();x0=new OY});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FY($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function v5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(I0(Q));continue}if(X===W5){Y.push(I0(Q));continue}Y.push(`${I0(Q)}="${I0(FY(String(X)))}"`)}return Y}var D4=()=>{};function D$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Fj($){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 $6;var Z6=b(()=>{D4();$6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=Fj($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${D$(J.value)}"`);else W.push(`href="${D$(J.value)}"`);if(X)W.push(`class="${D$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${D$(Q)}"`),W.push(`data-stx-exact-active-class="${D$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...v5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function J6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function LY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=Lj[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function X6($,Z,Y,J){return Z.map((X)=>`${E$($,X,void 0,Y,J)} ${X}w`).join(", ")}function Vj($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${E$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function E$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function wj($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Lj,Y6,Q6;var G6=b(()=>{D4();Lj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Y6=[320,640,768,1024,1280,1536,1920];Q6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=b0($,"src")||"",X=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),W=b0($,"srcset"),q=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",H=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",_=b0($,"style")||"",O=b0($,"quality"),F=J6($,"lazy",!0),L=J6($,"preload",!1),V=J6($,"picture",!1)||!!U,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,A=W||"",M="";if(!A&&K)A=X6(J,Y6,H,U),M=LY(K);else if(!A&&q){let y=q.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=Vj(J,y,w,H,U)}else if(K)M=LY(K);let N=[];if(_)N.push(_);if(w&&R)N.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let y=wj(w||16,R||9,j);N.push(`background-image:url(${y})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")N.push(`background-image:url(${D0(z)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let I=E$(J,w,R,H,U),T=[];if(T.push(`src="${D0(I)}"`),T.push(`alt="${D0(X)}"`),Q)T.push(`width="${D0(Q)}"`);if(G)T.push(`height="${D0(G)}"`);if(F)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${D0(B)}"`);if(N.length>0)T.push(`style="${D0(N.join(";"))}"`);if(A)T.push(`srcset="${D0(A)}"`);if(M)T.push(`sizes="${D0(M)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...v5($,k));let D=`<img ${T.join(" ")} />`,P="";if(L){let S=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${D0(I)}"${S?` type="${S}"`:""}${A?` imagesrcset="${D0(A)}"`:""}${M?` imagesizes="${D0(M)}"`:""} />
1901
1901
  `}if(V){let y=[];if(U==="avif"||U==="auto"){let S=E$(J,w,R,H,"avif"),C=A?X6(J,Y6,H,"avif"):`${S}`;y.push(`<source type="image/avif" srcset="${D0(C)}"${M?` sizes="${D0(M)}"`:""} />`)}if(U==="webp"||U==="auto"){let S=E$(J,w,R,H,"webp"),C=A?X6(J,Y6,H,"webp"):`${S}`;y.push(`<source type="image/webp" srcset="${D0(C)}"${M?` sizes="${D0(M)}"`:""} />`)}return`${P}<picture>
1902
1902
  ${y.join(`
1903
1903
  `)}
1904
1904
  ${D}
1905
- </picture>`}return`${P}${D}`}}});function k$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var LY="/images/safe-image-default.svg",wj,K6;var W6=b(()=>{D4();wj=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${LY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,K6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=x5($,"src")||"",X=x5($,"alt")||"",Q=x5($,"fallback")||LY,G=x5($,"class")||x5($,"className")||"",K=x5($,"fallbackClassName")||"",W=[];if(W.push(`src="${k$(J)}"`),W.push(`alt="${k$(X)}"`),G)W.push(`class="${k$(G)}"`);if(W.push(`data-fallback="${k$(Q)}"`),K)W.push(`data-fallback-class="${k$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...v5($,q));let U=`<img ${W.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${wj}${U}`;return U}}});function q6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function b$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function E4($,Z,Y){let J=b$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var U6;var z6=b(()=>{U6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=q6(b$($,"color")||"#6366f1"),X=q6(b$($,"initialColor")||b$($,"initial-color")||""),Q=q6(b$($,"height")||"3px"),G=E4($,"duration",2000),K=E4($,"throttle",200),W=E4($,"zIndex",999999)||E4($,"z-index",999999),q=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
1905
+ </picture>`}return`${P}${D}`}}});function k$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var VY="/images/safe-image-default.svg",Rj,K6;var W6=b(()=>{D4();Rj=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${VY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,K6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=x5($,"src")||"",X=x5($,"alt")||"",Q=x5($,"fallback")||VY,G=x5($,"class")||x5($,"className")||"",K=x5($,"fallbackClassName")||"",W=[];if(W.push(`src="${k$(J)}"`),W.push(`alt="${k$(X)}"`),G)W.push(`class="${k$(G)}"`);if(W.push(`data-fallback="${k$(Q)}"`),K)W.push(`data-fallback-class="${k$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...v5($,q));let U=`<img ${W.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Rj}${U}`;return U}}});function q6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function b$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function E4($,Z,Y){let J=b$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var U6;var z6=b(()=>{U6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=q6(b$($,"color")||"#6366f1"),X=q6(b$($,"initialColor")||b$($,"initial-color")||""),Q=q6(b$($,"height")||"3px"),G=E4($,"duration",2000),K=E4($,"throttle",200),W=E4($,"zIndex",999999)||E4($,"z-index",999999),q=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
1906
1906
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
1907
1907
  <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>
1908
1908
  </div>
1909
1909
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
1910
1910
  <script>
1911
1911
  (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()})})();
1912
- </script>`}}});function wY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Rj($,Z,Y){let J=wY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var VY,j6;var B6=b(()=>{VY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},j6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=I0(wY($,"position")||"top-right"),X=Rj($,"max",5),Q=VY[J]||VY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1912
+ </script>`}}});function RY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Aj($,Z,Y){let J=RY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var wY,j6;var B6=b(()=>{wY={"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%)"},j6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=I0(RY($,"position")||"top-right"),X=Aj($,"max",5),Q=wY[J]||wY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1913
1913
  <style>
1914
1914
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
1915
1915
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -1917,7 +1917,7 @@ ${D}
1917
1917
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
1918
1918
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
1919
1919
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
1920
- </style>`}}});function k4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var RY,H6;var _6=b(()=>{RY={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)"},H6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=k4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=I0(J),Q=k4($,"size")||"md",G=k4($,"closeOnBackdrop")!=="false",K=k4($,"closeOnEscape")!=="false",W=RY[Q]||RY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
1920
+ </style>`}}});function k4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var AY,H6;var _6=b(()=>{AY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},H6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=k4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=I0(J),Q=k4($,"size")||"md",G=k4($,"closeOnBackdrop")!=="false",K=k4($,"closeOnEscape")!=="false",W=AY[Q]||AY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
1921
1921
  <div class="stx-modal-panel" style="${W};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
1922
1922
  <div style="padding:1.5rem">${Z}</div>
1923
1923
  </div>
@@ -1926,7 +1926,7 @@ ${D}
1926
1926
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
1927
1927
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
1928
1928
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
1929
- </style>`}}});function f5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var AY,O6;var F6=b(()=>{AY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},O6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=f5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=I0(J),Q=f5($,"side")||"right",G=f5($,"size")||"md",K=f5($,"closeOnBackdrop")!=="false",W=f5($,"closeOnEscape")!=="false",q=f5($,"overlay")!=="false",U=AY[G]||AY.md,z=Q==="left",j=z?"left:0":"right:0",H=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
1929
+ </style>`}}});function f5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var MY,O6;var F6=b(()=>{MY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},O6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=f5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=I0(J),Q=f5($,"side")||"right",G=f5($,"size")||"md",K=f5($,"closeOnBackdrop")!=="false",W=f5($,"closeOnEscape")!=="false",q=f5($,"overlay")!=="false",U=MY[G]||MY.md,z=Q==="left",j=z?"left:0":"right:0",H=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
1930
1930
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${U};max-width:100vw;transform:${H};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
1931
1931
  <div style="padding:1.5rem">${Z}</div>
1932
1932
  </div>
@@ -1935,37 +1935,37 @@ ${D}
1935
1935
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
1936
1936
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
1937
1937
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
1938
- </style>`}}});import{existsSync as Aj,readFileSync as Mj}from"fs";function Nj($){if(MY.has($))return;MY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Tj($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Aj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return e.resolve(Y)}catch{}return null}function Ij($){if(b4.has($))return b4.get($);let Z=Tj($);if(!Z)return Nj($),null;try{let Y=JSON.parse(Mj(Z,"utf8"));return b4.set($,Y.icons),Y.icons}catch{return null}}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var b4,MY,L6;var V6=b(()=>{b4=new Map,MY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=g5($,"name")??g5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let L=J.split(":");X=L[0],Q=L[1]}let G=I0(g5($,"size")||"24"),K=I0(g5($,"color")||"currentColor"),W=I0(g5($,"class")||""),q=I0(g5($,"style")||""),U=b4.get(X)??Ij(X);if(!U)return`<!-- Icon: collection "${X}" not loaded -->`;let z=U[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=z.width||24,H=z.height||24,B=`0 0 ${j} ${H}`,_=z.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function NY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function TY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var w6;var R6=b(()=>{w6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=TY(Z,"fallback"),X=J.rest,Q=TY(X,"error"),G=Q.rest,K=J.region??NY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??NY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function S4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var A6;var M6=b(()=>{A6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(S4($,"name")||"v").replace(/["'<>]/g,""),X=(S4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=S4($,"class"),G=S4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function IY(){v0.registerBuiltin($6),v0.registerBuiltin(Q6),v0.registerBuiltin(K6),v0.registerBuiltin(U6),v0.registerBuiltin(j6),v0.registerBuiltin(H6),v0.registerBuiltin(O6),v0.registerBuiltin(L6),v0.registerBuiltin(w6),v0.registerBuiltin(A6)}var DY=b(()=>{Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6();e3();Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6()});function y4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function EY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,U=null,z=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(U){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===U)U=null;q++;continue}if(_==='"'||_==="'"){U=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(z,H?j-2:j-1).trim();if(H)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let A=$.indexOf(_,L),M=$.indexOf(O,L);if(M===-1)break;if(A!==-1&&A<M){let N=$[A+_.length];if(N===" "||N===">"||N==="/"||N===`
1939
- `||N==="\t")F++;L=A+_.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){X=j;continue}let w=$.slice(j,V),R=V+O.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),X=R}}return J}function kY($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function bY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var SY=b(()=>{V0();M0();$5()});var gY={};t(gY,{processESImports:()=>xY,processComponents:()=>v4});import C4 from"fs";import u0 from"path";function Ej($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(o8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));J.serverDynamic[U]=bY(W,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),z=W===W5?U:W;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=z;continue}try{if(!W0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);J.clientReactive[U]=z;continue}let j=Object.keys(Z),B=q0(z,j)(...Object.values(Z));if(B===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[U]=z;continue}}J.serverDynamic[U]=B}catch{J.clientReactive[U]=z}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let U=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(W0(z)){let H=q0(z,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);G(q,W)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);G(q,W)}else{let z=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,z)}continue}G(q,W===W5?"true":kY(W))}return J}function kj($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=W5}return Z}function PY($){return Object.entries($).map(([Z,Y])=>Y===W5?Z:`${Z}="${bj(Y)}"`).join(" ")}function bj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sj($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(v0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function yj($){let Z=CY.get($);if(Z)return Z;let Y=new Map,J=[u0.join($,"src"),u0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=C4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=u0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Y.has(U))Y.set(U,q);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,q);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return CY.set($,Y),Y}function Pj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=u0.join(Y,"node_modules",$);try{if(C4.statSync(J).isDirectory())return J}catch{}let X=u0.dirname(Y);if(X===Y)return null;Y=X}}async function xY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=u0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=z,B,_=[];while((B=j.exec(z))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let N=u0.resolve(G,V);if(N.endsWith(".stx"))R=N;else{let I=`${N}.stx`;try{if(C4.statSync(I).isFile())R=I}catch{try{if(C4.statSync(N).isDirectory())w=N}catch{}}}}else w=Pj(V,G);if(!w&&!R)continue;let A=!1,M=(N,I)=>{Q.set(N,I),Q.set(N.toLowerCase(),I);let T=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),X.add(I)};if(L&&R)M(L,R),A=!0;else if(F){let N=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?yj(w):null;for(let{source:T,local:k}of N){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)M(k,D),A=!0}}if(A)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${U}>${H}</script>`}),K}async function Cj($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,U]=W,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[u0.resolve(u0.dirname(Y),`${j}.stx`),u0.resolve(u0.dirname(Y),j),u0.resolve(J.componentsDir||"components",`${j}.stx`),u0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function vj($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let U=q.index,z=U+q[0].length-1,j=1,H=z+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(z+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=L0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${D}]`);continue}let A="",M=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),M=_+I[0].length;let T=await q5(F,R,A,G,Z,Y,J,K,X);Q=Q.substring(0,U)+T+Q.substring(M),W.lastIndex=0}return Q}async function xj($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=b1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,Dj),Q=H$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=EY(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?y4(w.tagName):w.tagName,A=kj(w.attributes),M=Ej(A,Z,J),N=v0.getBuiltin(w.tagName),I=N?await P4(R,G,Z,Y,J):!1;if(N&&!I){let P={context:Z,filePath:Y,options:J,dependencies:X},y=N.render(M,w.content,P);if(Object.keys(M.clientReactive).length>0)y=vY(y,M.clientReactive);if(Object.keys(M.events).length>0){let S=PY(M.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await P4(R,G,Z,Y,J))continue;let T={};for(let[P,y]of Object.entries(M.static))T[P]=y;for(let[P,y]of Object.entries(M.serverDynamic))T[P]=y;let D=await q5(R,T,w.content,G,Z,Y,J,K,X);if(Object.keys(M.clientReactive).length>0)D=vY(D,M.clientReactive);if(Object.keys(M.events).length>0){let P=fY(D);if(P){let y=PY(M.events),S=Object.keys(M.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function vY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([U])=>!Y.has(U)),Q=X.filter(([U])=>!J.has(U)).map(([U])=>y4(U)).join(" "),G=$,K=X.length>0?fY(G):null;if(K){let U=X.map(([j,H])=>`:${y4(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function fY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function v4($,Z,Y,J,X){if(!yY)IY(),yY=!0;let Q=await xY($,Z,Y,J,X);Q=await Cj(Q,Z,Y,J,X),Q=await vj(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=G1(Q,B$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...W.tokens);let q=Q;if(Q=await xj(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=Sj(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var yY=!1,Dj,CY;var N6=b(()=>{e3();DY();SY();$5();M0();V0();Q1();Dj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);CY=new Map});var x4={};t(x4,{stripTypeScript:()=>lY,splitDeclaration:()=>oY,isModuleResolutionFailure:()=>pY,isMissingBindingFailure:()=>cY,isCompleteImport:()=>iY,hasVariables:()=>eY,extractVariables:()=>w1,extractScriptFromTemplate:()=>tY,convertToCommonJS:()=>I6});import f1 from"path";import h5 from"process";function fj($){let Z=[],Y=0,J=$.split(`
1940
- `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let z=q[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function lY($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<J.length;q++){let U=J[q];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=U}if(Q)X.push(Q);return X.map((q)=>{let U=q.trim(),z=U.startsWith("..."),j=z?U.slice(3):U,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return q;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){L=R;break}let w=z?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,U=null;while(W<Z.length&&K>0){let H=Z[W];if(U){if(H===U)U=null;W++;continue}if(H==='"'||H==="'"||H==="`"){U=H,W++;continue}if(H==="<")q++;else if(H===">"&&q>0)q--;else if(q===0){if(H==="(")K++;else if(H===")")K--}if(K>0)W++}if(K!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let j=Y(z);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1938
+ </style>`}}});import{existsSync as Mj,readFileSync as Nj}from"fs";function Tj($){if(NY.has($))return;NY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Ij($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Mj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return e.resolve(Y)}catch{}return null}function Dj($){if(b4.has($))return b4.get($);let Z=Ij($);if(!Z)return Tj($),null;try{let Y=JSON.parse(Nj(Z,"utf8"));return b4.set($,Y.icons),Y.icons}catch{return null}}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var b4,NY,L6;var V6=b(()=>{b4=new Map,NY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=g5($,"name")??g5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let L=J.split(":");X=L[0],Q=L[1]}let G=I0(g5($,"size")||"24"),K=I0(g5($,"color")||"currentColor"),W=I0(g5($,"class")||""),q=I0(g5($,"style")||""),U=b4.get(X)??Dj(X);if(!U)return`<!-- Icon: collection "${X}" not loaded -->`;let z=U[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=z.width||24,H=z.height||24,B=`0 0 ${j} ${H}`,_=z.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function TY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function IY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var w6;var R6=b(()=>{w6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=IY(Z,"fallback"),X=J.rest,Q=IY(X,"error"),G=Q.rest,K=J.region??TY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??TY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function S4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var A6;var M6=b(()=>{A6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(S4($,"name")||"v").replace(/["'<>]/g,""),X=(S4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=S4($,"class"),G=S4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function DY(){x0.registerBuiltin($6),x0.registerBuiltin(Q6),x0.registerBuiltin(K6),x0.registerBuiltin(U6),x0.registerBuiltin(j6),x0.registerBuiltin(H6),x0.registerBuiltin(O6),x0.registerBuiltin(L6),x0.registerBuiltin(w6),x0.registerBuiltin(A6)}var EY=b(()=>{Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6();e3();Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6()});function y4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function kY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,U=null,z=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(U){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===U)U=null;q++;continue}if(_==='"'||_==="'"){U=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(z,H?j-2:j-1).trim();if(H)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let A=$.indexOf(_,L),M=$.indexOf(O,L);if(M===-1)break;if(A!==-1&&A<M){let N=$[A+_.length];if(N===" "||N===">"||N==="/"||N===`
1939
+ `||N==="\t")F++;L=A+_.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){X=j;continue}let w=$.slice(j,V),R=V+O.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),X=R}}return J}function bY($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function SY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var yY=b(()=>{V0();M0();$5()});var hY={};t(hY,{processESImports:()=>fY,processComponents:()=>v4});import C4 from"fs";import m0 from"path";function kj($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(o8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));J.serverDynamic[U]=SY(W,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),z=W===W5?U:W;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=z;continue}try{if(!W0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);J.clientReactive[U]=z;continue}let j=Object.keys(Z),B=q0(z,j)(...Object.values(Z));if(B===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[U]=z;continue}}J.serverDynamic[U]=B}catch{J.clientReactive[U]=z}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let U=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(W0(z)){let H=q0(z,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);G(q,W)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);G(q,W)}else{let z=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,z)}continue}G(q,W===W5?"true":bY(W))}return J}function bj($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=W5}return Z}function CY($){return Object.entries($).map(([Z,Y])=>Y===W5?Z:`${Z}="${Sj(Y)}"`).join(" ")}function Sj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yj($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(x0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function Pj($){let Z=vY.get($);if(Z)return Z;let Y=new Map,J=[m0.join($,"src"),m0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=C4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=m0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Y.has(U))Y.set(U,q);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,q);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return vY.set($,Y),Y}function Cj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=m0.join(Y,"node_modules",$);try{if(C4.statSync(J).isDirectory())return J}catch{}let X=m0.dirname(Y);if(X===Y)return null;Y=X}}async function fY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=z,B,_=[];while((B=j.exec(z))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let N=m0.resolve(G,V);if(N.endsWith(".stx"))R=N;else{let I=`${N}.stx`;try{if(C4.statSync(I).isFile())R=I}catch{try{if(C4.statSync(N).isDirectory())w=N}catch{}}}}else w=Cj(V,G);if(!w&&!R)continue;let A=!1,M=(N,I)=>{Q.set(N,I),Q.set(N.toLowerCase(),I);let T=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),X.add(I)};if(L&&R)M(L,R),A=!0;else if(F){let N=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?Pj(w):null;for(let{source:T,local:k}of N){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)M(k,D),A=!0}}if(A)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${U}>${H}</script>`}),K}async function vj($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,U]=W,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(J.componentsDir||"components",`${j}.stx`),m0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function xj($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let U=q.index,z=U+q[0].length-1,j=1,H=z+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(z+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=L0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${D}]`);continue}let A="",M=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),M=_+I[0].length;let T=await q5(F,R,A,G,Z,Y,J,K,X);Q=Q.substring(0,U)+T+Q.substring(M),W.lastIndex=0}return Q}async function fj($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=b1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,Ej),Q=H$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=kY(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?y4(w.tagName):w.tagName,A=bj(w.attributes),M=kj(A,Z,J),N=x0.getBuiltin(w.tagName),I=N?await P4(R,G,Z,Y,J):!1;if(N&&!I){let P={context:Z,filePath:Y,options:J,dependencies:X},y=N.render(M,w.content,P);if(Object.keys(M.clientReactive).length>0)y=xY(y,M.clientReactive);if(Object.keys(M.events).length>0){let S=CY(M.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await P4(R,G,Z,Y,J))continue;let T={};for(let[P,y]of Object.entries(M.static))T[P]=y;for(let[P,y]of Object.entries(M.serverDynamic))T[P]=y;let D=await q5(R,T,w.content,G,Z,Y,J,K,X);if(Object.keys(M.clientReactive).length>0)D=xY(D,M.clientReactive);if(Object.keys(M.events).length>0){let P=gY(D);if(P){let y=CY(M.events),S=Object.keys(M.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function xY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([U])=>!Y.has(U)),Q=X.filter(([U])=>!J.has(U)).map(([U])=>y4(U)).join(" "),G=$,K=X.length>0?gY(G):null;if(K){let U=X.map(([j,H])=>`:${y4(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function gY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function v4($,Z,Y,J,X){if(!PY)DY(),PY=!0;let Q=await fY($,Z,Y,J,X);Q=await vj(Q,Z,Y,J,X),Q=await xj(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=G1(Q,B$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...W.tokens);let q=Q;if(Q=await fj(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=yj(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var PY=!1,Ej,vY;var N6=b(()=>{e3();EY();yY();$5();M0();V0();Q1();Ej=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);vY=new Map});var x4={};t(x4,{stripTypeScript:()=>pY,splitDeclaration:()=>rY,isModuleResolutionFailure:()=>cY,isMissingBindingFailure:()=>iY,isCompleteImport:()=>nY,hasVariables:()=>$J,extractVariables:()=>w1,extractScriptFromTemplate:()=>eY,convertToCommonJS:()=>I6});import f1 from"path";import h5 from"process";function gj($){let Z=[],Y=0,J=$.split(`
1940
+ `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let z=q[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function pY($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<J.length;q++){let U=J[q];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=U}if(Q)X.push(Q);return X.map((q)=>{let U=q.trim(),z=U.startsWith("..."),j=z?U.slice(3):U,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return q;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){L=R;break}let w=z?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,U=null;while(W<Z.length&&K>0){let H=Z[W];if(U){if(H===U)U=null;W++;continue}if(H==='"'||H==="'"||H==="`"){U=H,W++;continue}if(H==="<")q++;else if(H===">"&&q>0)q--;else if(q===0){if(H==="(")K++;else if(H===")")K--}if(K>0)W++}if(K!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let j=Y(z);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1941
1941
 
1942
- `),Z}function pY($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function cY($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function w1($,Z,Y,J={}){if(!$.trim())return;let X;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=E.transformSync(v)}catch{X=lY($)}let Q={exports:{}},G=Q.exports,K=h5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of q)try{let v=f1.resolve(K,"node_modules",E),u=f1.join(v,"package.json"),g=JSON.parse(e("fs").readFileSync(u,"utf8")),a=g.main||"index.js";if(g.exports){let Q0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Q0==="string")a=Q0;else if(Q0?.bun)a=Q0.bun;else if(Q0?.import)a=Q0.import;else if(Q0?.default)a=Q0.default}W[E]=await import(f1.resolve(v,a))}catch{}let U=(E)=>{if(W[E])return W[E];return e(E)},z=Z.props||{},j=(E)=>{if(!E)return z;let v={};for(let[u,g]of Object.entries(E)){let a=z[u];if(a!==void 0)v[u]=a;else if(typeof g==="function")v[u]=g();else v[u]=g}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return z;let v={...z};for(let[u,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[u]===void 0&&a.default!==void 0)v[u]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let u={...E};for(let[g,a]of Object.entries(v))if(u[g]===void 0)if(typeof a==="function")u[g]=a();else u[g]=a;return u},O=(E)=>{let v=()=>E;return v.set=(u)=>{},v.update=(u)=>{},v},F=(E)=>{let v,u=!1;return()=>{if(!u)try{v=E(),u=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function A(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function M(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let N=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",u=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Q0=Object.keys(g).length>0?g:a??{},r0=v||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:Z.params??{},query:Q0,path:u,name:"",fullPath:u+r0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=S5(v,E||{})},k=(E)=>{T(R4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...u)=>{},G0=(E)=>{},l0=(E,v)=>{},A0=(E,v)=>v,o0=()=>({value:"light"}),p=()=>O(!1),_0=(E)=>O(!1),p0=()=>O(!1),N1=()=>_0("(prefers-color-scheme: dark)"),O5=()=>_0("(prefers-color-scheme: light)"),F5=()=>_0("(prefers-reduced-motion: reduce)"),s=()=>_0("(prefers-contrast: more)"),r={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:{}},U0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,u){return E[v]=u,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K0=console;try{let E=I6(X,Y),v=new Set(Object.keys(z)),u=(n)=>/^[a-z_$][\w$]*$/i.test(n),g=Object.keys(Z).filter((n)=>!v.has(n)&&n!=="props"&&u(n)),a=g.map((n)=>Z[n]),Q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),r0=[],y0=[];for(let[n,X1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(Q0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;r0.push(n),y0.push(X1)}let a0=fj(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
1942
+ `),Z}function cY($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function iY($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function w1($,Z,Y,J={}){if(!$.trim())return;let X;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=E.transformSync(v)}catch{X=pY($)}let Q={exports:{}},G=Q.exports,K=h5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of q)try{let v=f1.resolve(K,"node_modules",E),u=f1.join(v,"package.json"),g=JSON.parse(e("fs").readFileSync(u,"utf8")),a=g.main||"index.js";if(g.exports){let Q0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Q0==="string")a=Q0;else if(Q0?.bun)a=Q0.bun;else if(Q0?.import)a=Q0.import;else if(Q0?.default)a=Q0.default}W[E]=await import(f1.resolve(v,a))}catch{}let U=(E)=>{if(W[E])return W[E];return e(E)},z=Z.props||{},j=(E)=>{if(!E)return z;let v={};for(let[u,g]of Object.entries(E)){let a=z[u];if(a!==void 0)v[u]=a;else if(typeof g==="function")v[u]=g();else v[u]=g}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return z;let v={...z};for(let[u,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[u]===void 0&&a.default!==void 0)v[u]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let u={...E};for(let[g,a]of Object.entries(v))if(u[g]===void 0)if(typeof a==="function")u[g]=a();else u[g]=a;return u},O=(E)=>{let v=()=>E;return v.set=(u)=>{},v.update=(u)=>{},v},F=(E)=>{let v,u=!1;return()=>{if(!u)try{v=E(),u=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function A(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function M(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let N=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",u=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Q0=Object.keys(g).length>0?g:a??{},r0=v||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:Z.params??{},query:Q0,path:u,name:"",fullPath:u+r0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=S5(v,E||{})},k=(E)=>{T(R4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...u)=>{},G0=(E)=>{},p0=(E,v)=>{},A0=(E,v)=>v,o0=()=>({value:"light"}),p=()=>O(!1),_0=(E)=>O(!1),c0=()=>O(!1),N1=()=>_0("(prefers-color-scheme: dark)"),O5=()=>_0("(prefers-color-scheme: light)"),F5=()=>_0("(prefers-reduced-motion: reduce)"),s=()=>_0("(prefers-contrast: more)"),r={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:{}},U0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,u){return E[v]=u,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K0=console;try{let E=I6(X,Y),v=new Set(Object.keys(z)),u=(n)=>/^[a-z_$][\w$]*$/i.test(n),g=Object.keys(Z).filter((n)=>!v.has(n)&&n!=="props"&&u(n)),a=g.map((n)=>Z[n]),Q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),r0=[],y0=[];for(let[n,X1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(Q0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;r0.push(n),y0.push(X1)}let a0=gj(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
1943
1943
  `),L5=Z.params??{},T1=[],I1=[];for(let n=0;n<g.length;n++){if(g[n]==="params")continue;T1.push(g[n]),I1.push(a[n])}let J1=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...r0,...T1,`return (async () => {
1944
1944
  ${E}
1945
1945
  ${a0}
1946
1946
  return module.exports
1947
- })()`)(Q,G,U,z,j,H,_,M,O,F,L,V,w,R,A,N,I,T,k,D,P,y,S,C,x,m,l,G0,B,l0,A0,o0,p,_0,p0,N1,O5,F5,s,U0,N0,K0,r.confirm,r.alert,r.fetch,L5,...y0,...I1);if(J.preserveExisting){for(let[n,X1]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=X1}else Object.assign(Z,J1);for(let[n,X1]of Object.entries(z))if(!(n in Z))Z[n]=X1}catch(E){let v=E instanceof Error?E.message:String(E);if(pY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(cY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(h5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await dj(X,Z,Y)}catch(u){if(h5.env.STX_DEBUG){let g=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function iY($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function I6($,Z){let Y=Z?f1.dirname(Z):h5.cwd(),J=h5.cwd(),X=$.split(`
1947
+ })()`)(Q,G,U,z,j,H,_,M,O,F,L,V,w,R,A,N,I,T,k,D,P,y,S,C,x,m,l,G0,B,p0,A0,o0,p,_0,c0,N1,O5,F5,s,U0,N0,K0,r.confirm,r.alert,r.fetch,L5,...y0,...I1);if(J.preserveExisting){for(let[n,X1]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=X1}else Object.assign(Z,J1);for(let[n,X1]of Object.entries(z))if(!(n in Z))Z[n]=X1}catch(E){let v=E instanceof Error?E.message:String(E);if(cY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(iY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(h5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await lj(X,Z,Y)}catch(u){if(h5.env.STX_DEBUG){let g=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function nY($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function I6($,Z){let Y=Z?f1.dirname(Z):h5.cwd(),J=h5.cwd(),X=$.split(`
1948
1948
  `),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1,U=G;for(let H=G;H<X.length&&!q;H++){let B=null,_=!1,O=X[H];for(let F=0;F<O.length;F++){let L=O[F];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")W++;else if(L===")"){if(W--,W===0){G=H+1,q=!0;break}}}}if(!q)G=X.length;let z=X.slice(U,G).join(`
1949
- `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!iY(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),H=W,B=(_)=>{if(_.startsWith("."))return f1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return f1.resolve(J,_.slice(2));return _};if(U){let[,_,O]=U,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,O]=z,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let A=R.split(/\s+as\s+/);if(A.length===2){let[M,N]=[A[0].trim(),A[1].trim()];L.push(`${M}: ${N}`),V.push(N)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=hY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=hY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let U=T6(q,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],U=X[G].replace(/^export\s+/,""),z=0,j=G;for(;j<X.length;j++){let H=X[j];for(let B of H)if(B==="{")z++;else if(B==="}")z--;if(j>G)U+=`
1950
- `+H;if(z<=0&&j>=G)break}Q.push(U),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return gj(Q.join(`
1951
- `),Y,J)}function gj($,Z,Y){let J=$.length,X="",Q=0,G=null,K=!1,W=!1,q=0;while(Q<J){let U=$[Q],z=$[Q+1];if(K){if(X+=U,U===`
1952
- `)K=!1;Q++;continue}if(W){if(X+=U,U==="*"&&z==="/"){X+=z,Q+=2,W=!1;continue}Q++;continue}if(!G&&U==="/"&&z==="/"){K=!0,X+=U,Q++;continue}if(!G&&U==="/"&&z==="*"){W=!0,X+=U,Q++;continue}if(G){if(X+=U,U==="\\"){X+=z,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&z==="{"){q++,X+=z,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(U==="{")q++;else if(U==="}")q--}if(U==='"'||U==="'"||U==="`"){G=U,X+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let j=hj($,Q);if(j){let{quote:H,path:B,end:_}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?f1.resolve(Z,B):f1.resolve(Y,B.slice(2));X+=`await import(${H}${O}${H})`,Q=_;continue}}}X+=U,Q++}return X}function hj($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function nY($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=T0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function sY($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=nY(Y,J);if(K){let W=sY(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function oY($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){X++;continue}if(G===")"||G==="]"||G==="}"||G===">"){X--;continue}if(G==="="&&X<=0){let K=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function hY($,Z){let Y=$[Z].trim(),J=oY(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",_=z;for(let O=Z+1;O<$.length;O++)if(_+=" "+$[O].trim(),j=O,$[O].includes(B))break;z=_}let H=nY(z,0);if(H){let B=U[1],_=H.pattern,O=z.slice(H.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,V=Math.max(j,Z);if(uY(F)){let M=mY($,V,F);L=M.value,V=M.nextIndex}else V=V+1;L=L.trim().replace(/;$/,"");let w=sY(_),R=`__stx_src_${Z}`,A=w.map((M)=>`module.exports.${M} = ${M};`).join(`
1949
+ `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!nY(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),H=W,B=(_)=>{if(_.startsWith("."))return f1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return f1.resolve(J,_.slice(2));return _};if(U){let[,_,O]=U,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,O]=z,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let A=R.split(/\s+as\s+/);if(A.length===2){let[M,N]=[A[0].trim(),A[1].trim()];L.push(`${M}: ${N}`),V.push(N)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=uY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=uY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let U=T6(q,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],U=X[G].replace(/^export\s+/,""),z=0,j=G;for(;j<X.length;j++){let H=X[j];for(let B of H)if(B==="{")z++;else if(B==="}")z--;if(j>G)U+=`
1950
+ `+H;if(z<=0&&j>=G)break}Q.push(U),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return hj(Q.join(`
1951
+ `),Y,J)}function hj($,Z,Y){let J=$.length,X="",Q=0,G=null,K=!1,W=!1,q=0;while(Q<J){let U=$[Q],z=$[Q+1];if(K){if(X+=U,U===`
1952
+ `)K=!1;Q++;continue}if(W){if(X+=U,U==="*"&&z==="/"){X+=z,Q+=2,W=!1;continue}Q++;continue}if(!G&&U==="/"&&z==="/"){K=!0,X+=U,Q++;continue}if(!G&&U==="/"&&z==="*"){W=!0,X+=U,Q++;continue}if(G){if(X+=U,U==="\\"){X+=z,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&z==="{"){q++,X+=z,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(U==="{")q++;else if(U==="}")q--}if(U==='"'||U==="'"||U==="`"){G=U,X+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let j=uj($,Q);if(j){let{quote:H,path:B,end:_}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?f1.resolve(Z,B):f1.resolve(Y,B.slice(2));X+=`await import(${H}${O}${H})`,Q=_;continue}}}X+=U,Q++}return X}function uj($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function sY($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=T0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function oY($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=sY(Y,J);if(K){let W=oY(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function rY($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){X++;continue}if(G===")"||G==="]"||G==="}"||G===">"){X--;continue}if(G==="="&&X<=0){let K=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function uY($,Z){let Y=$[Z].trim(),J=rY(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",_=z;for(let O=Z+1;O<$.length;O++)if(_+=" "+$[O].trim(),j=O,$[O].includes(B))break;z=_}let H=sY(z,0);if(H){let B=U[1],_=H.pattern,O=z.slice(H.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,V=Math.max(j,Z);if(mY(F)){let M=dY($,V,F);L=M.value,V=M.nextIndex}else V=V+1;L=L.trim().replace(/;$/,"");let w=oY(_),R=`__stx_src_${Z}`,A=w.map((M)=>`module.exports.${M} = ${M};`).join(`
1953
1953
  `);return{type:B,name:R,value:`${L}; ${B} ${_} = ${R};
1954
- ${A}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,q=Z;if(uY(K)){let U=mY($,Z,K);W=U.value,q=U.nextIndex}else q=Z+1;while(q<$.length){let U=$[q].trim();if(U.startsWith(".")||U.startsWith("?."))W+=`
1955
- ${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function T6($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(uj(Y)){let K=mj($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function uY($){let Z=$.trim();if(Z.startsWith("{"))return T0(Z,"{","}",0)===-1;if(Z.startsWith("["))return T0(Z,"[","]",0)===-1;return!rY(Z)}function rY($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function aY($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=T0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function uj($){let Z=aY($);if(Z===-1)return!0;return T0($,"{","}",Z)===-1}function mY($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!rY(J)){let Q=$[X];J+=`
1954
+ ${A}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,q=Z;if(mY(K)){let U=dY($,Z,K);W=U.value,q=U.nextIndex}else q=Z+1;while(q<$.length){let U=$[q].trim();if(U.startsWith(".")||U.startsWith("?."))W+=`
1955
+ ${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function T6($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(mj(Y)){let K=dj($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function mY($){let Z=$.trim();if(Z.startsWith("{"))return T0(Z,"{","}",0)===-1;if(Z.startsWith("["))return T0(Z,"[","]",0)===-1;return!aY(Z)}function aY($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function tY($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=T0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function mj($){let Z=tY($);if(Z===-1)return!0;return T0($,"{","}",Z)===-1}function dY($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!aY(J)){let Q=$[X];J+=`
1956
1956
  ${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
1957
- ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function mj($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=aY(J);if(Q!==-1){if(T0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
1958
- ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...h5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function dj($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function tY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function eY($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=b(()=>{R$();E1();V0()});var GJ={};t(GJ,{processLoops:()=>E6,parseLoopBinding:()=>D6});function cj($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=T0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let j=L0(q,Z);if(!j||typeof j!=="object")continue;z=JSON.stringify(j)}catch{continue}J+=$.slice(X,G)+z,X=W,Y.lastIndex=W}return X===0?$:J+$.slice(X)}function ij($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=J.substring(K+1,q),z=q+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=U.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=L0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function f4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,U=null,z=!1;while(q<J.length&&W>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&U){z=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),H=Y(j);J=J.substring(0,G)+H+J.substring(q+1)}return J}function nj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);Z4(Q);let q=q0(Q,G)(...K),U=JSON.stringify(q),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${X}="${z}"`}catch(G){return J}}),Y}function sj($,Z){let Y=$;return Y=f4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?g4:""}catch{return""}}),Y=f4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?h4:""}catch{return""}}),Y}function oj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,g4),Z=Z.replace(/@continue(?!\()/g,h4),Z}function $J($){let Z=$.includes(g4),Y=Z?$.substring(0,$.indexOf(g4)):$;return{hasBreak:Z,content:Y}}function ZJ($){let Z=$.includes(h4),Y=Z?$.substring(0,$.indexOf(h4)):$;return{hasContinue:Z,content:Y}}function JJ($){let Z=$;return Z=f4(Z,"@break",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=f4(Z,"@continue",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function rj($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,z)=>U.pos-z.pos);let K=[],W=0;for(let U of J)W+=U.delta,K.push({pos:U.pos,depth:W});function q(U){let z=0,j=K.length-1,H=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)H=K[B].depth,z=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,H=z+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(z+1,B),O=D6(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,A=/@forelse\s*\(/g,M=/@endforelse/g,N=-1;while(w>0&&R<$.length){A.lastIndex=R,M.lastIndex=R;let y=A.exec($),S=M.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){N=S.index;break}R=S.index+11}}if(N===-1)continue;let I=$.substring(V,N),T=N+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:U,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function YJ($,Z){let Y=$;while(!0){let J=rj(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let U;if(W0(G))U=q0(G,Object.keys(Z))(...Object.values(Z));else U=J0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=q;else z=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+z+Y.substring(Q)}catch(U){let z=U instanceof Error?U.message:String(U),j=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function D6($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let J=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=Y[2].trim();return J&&X?{arrayExpr:X,itemVar:J}:null}function E6($,Z,Y,J){let X=$;X=YJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let z=U.index,j=U.index+U[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),F=D6(O);if(!F)continue;let L=z,{arrayExpr:V,itemVar:w}=F,R=_+1,A=1,M=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&M<W.length){N.lastIndex=M,I.lastIndex=M;let T=N.exec(W),k=I.exec(W);if(!k)break;if(T&&T.index<k.index)A++,M=T.index+T[0].length;else{if(A--,A===0){let D=W.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}M=k.index+11}}}return null}function G(W,q){let U=W;while(!0){let z=Q(U);if(!z)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=z;try{let F=B.trim(),L;if(W0(F))L=q0(F,Object.keys(q))(...Object.values(q));else L=J0(F,q);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=Z0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+k+U.substring(H);continue}let w=J?.loops?.useAltLoopVariable??pj,R=_.trim(),A=null,M,N=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],M=k[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])M=k[0],A=k[1],N=!0;else M=R}else M=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...q,loop:P,$loop:P};if(M.startsWith("[")&&M.endsWith("]")){let m=M.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(D))m.forEach((l,G0)=>{if(l)y[l]=D[G0]});else y[M]=D}else y[M]=D;if(A)if(!N&&V&&Array.isArray(D)&&D.length===2)y[A]=D[0],y[M]=D[1];else y[A]=k;let S=sj(O,y),C=ZJ(S);if(C.hasContinue){I+=C.content;continue}let x=$J(S);if(x.hasBreak){I+=x.content;break}if(S=YJ(S,y),S=G(S,y),S=X5(S,y,Y),S=oj(S),x=$J(S),x.hasBreak){I+=x.content;break}if(C=ZJ(S),C.hasContinue){I+=C.content;continue}S=S1(S,y,Y),S=nj(S,y),S=ij(S,y),S=cj(S,y),I+=S}U=U.substring(0,j)+I+U.substring(H)}catch(F){let L=Z0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+L+U.substring(H)}}return U}X=G(X,Z),X=QJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??lj;return X=ej(X,Z,K),X}function XJ($){return Y4($)}function QJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=T0(X,"(",")",W);if(q===-1)break;let U=X.slice(W+1,q),z=q+1,j=O4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!XJ(U)){let _=Z0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=aj(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let A=tj({forExpr:U,content:H,iterVarNames:_,context:Z,filePath:Y,options:J});X=X.substring(0,K)+A+X.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,M)=>{return`\${${M}}`});V=JJ(V);let R=Function(...F,`
1957
+ ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function dj($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=tY(J);if(Q!==-1){if(T0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
1958
+ ${G}`,X++}return{functionCode:J,nextIndex:X}}function lY($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...h5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function lj($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=lY(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=lY(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function eY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function $J($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=b(()=>{R$();E1();V0()});var KJ={};t(KJ,{processLoops:()=>E6,parseLoopBinding:()=>D6});function ij($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=T0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let j=L0(q,Z);if(!j||typeof j!=="object")continue;z=JSON.stringify(j)}catch{continue}J+=$.slice(X,G)+z,X=W,Y.lastIndex=W}return X===0?$:J+$.slice(X)}function nj($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=J.substring(K+1,q),z=q+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=U.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=L0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function f4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,U=null,z=!1;while(q<J.length&&W>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&U){z=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),H=Y(j);J=J.substring(0,G)+H+J.substring(q+1)}return J}function sj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);Z4(Q);let q=q0(Q,G)(...K),U=JSON.stringify(q),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${X}="${z}"`}catch(G){return J}}),Y}function oj($,Z){let Y=$;return Y=f4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?g4:""}catch{return""}}),Y=f4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?h4:""}catch{return""}}),Y}function rj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,g4),Z=Z.replace(/@continue(?!\()/g,h4),Z}function ZJ($){let Z=$.includes(g4),Y=Z?$.substring(0,$.indexOf(g4)):$;return{hasBreak:Z,content:Y}}function YJ($){let Z=$.includes(h4),Y=Z?$.substring(0,$.indexOf(h4)):$;return{hasContinue:Z,content:Y}}function XJ($){let Z=$;return Z=f4(Z,"@break",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=f4(Z,"@continue",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function aj($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,z)=>U.pos-z.pos);let K=[],W=0;for(let U of J)W+=U.delta,K.push({pos:U.pos,depth:W});function q(U){let z=0,j=K.length-1,H=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)H=K[B].depth,z=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,H=z+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(z+1,B),O=D6(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,A=/@forelse\s*\(/g,M=/@endforelse/g,N=-1;while(w>0&&R<$.length){A.lastIndex=R,M.lastIndex=R;let y=A.exec($),S=M.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){N=S.index;break}R=S.index+11}}if(N===-1)continue;let I=$.substring(V,N),T=N+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:U,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function JJ($,Z){let Y=$;while(!0){let J=aj(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let U;if(W0(G))U=q0(G,Object.keys(Z))(...Object.values(Z));else U=J0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=q;else z=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+z+Y.substring(Q)}catch(U){let z=U instanceof Error?U.message:String(U),j=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function D6($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let J=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=Y[2].trim();return J&&X?{arrayExpr:X,itemVar:J}:null}function E6($,Z,Y,J){let X=$;X=JJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let z=U.index,j=U.index+U[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),F=D6(O);if(!F)continue;let L=z,{arrayExpr:V,itemVar:w}=F,R=_+1,A=1,M=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&M<W.length){N.lastIndex=M,I.lastIndex=M;let T=N.exec(W),k=I.exec(W);if(!k)break;if(T&&T.index<k.index)A++,M=T.index+T[0].length;else{if(A--,A===0){let D=W.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}M=k.index+11}}}return null}function G(W,q){let U=W;while(!0){let z=Q(U);if(!z)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=z;try{let F=B.trim(),L;if(W0(F))L=q0(F,Object.keys(q))(...Object.values(q));else L=J0(F,q);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=Z0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+k+U.substring(H);continue}let w=J?.loops?.useAltLoopVariable??cj,R=_.trim(),A=null,M,N=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],M=k[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])M=k[0],A=k[1],N=!0;else M=R}else M=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...q,loop:P,$loop:P};if(M.startsWith("[")&&M.endsWith("]")){let m=M.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(D))m.forEach((l,G0)=>{if(l)y[l]=D[G0]});else y[M]=D}else y[M]=D;if(A)if(!N&&V&&Array.isArray(D)&&D.length===2)y[A]=D[0],y[M]=D[1];else y[A]=k;let S=oj(O,y),C=YJ(S);if(C.hasContinue){I+=C.content;continue}let x=ZJ(S);if(x.hasBreak){I+=x.content;break}if(S=JJ(S,y),S=G(S,y),S=X5(S,y,Y),S=rj(S),x=ZJ(S),x.hasBreak){I+=x.content;break}if(C=YJ(S),C.hasContinue){I+=C.content;continue}S=S1(S,y,Y),S=sj(S,y),S=nj(S,y),S=ij(S,y),I+=S}U=U.substring(0,j)+I+U.substring(H)}catch(F){let L=Z0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+L+U.substring(H)}}return U}X=G(X,Z),X=GJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??pj;return X=$B(X,Z,K),X}function QJ($){return Y4($)}function GJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=T0(X,"(",")",W);if(q===-1)break;let U=X.slice(W+1,q),z=q+1,j=O4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!QJ(U)){let _=Z0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=tj(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let A=ej({forExpr:U,content:H,iterVarNames:_,context:Z,filePath:Y,options:J});X=X.substring(0,K)+A+X.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,M)=>{return`\${${M}}`});V=XJ(V);let R=Function(...F,`
1959
1959
  let result = '';
1960
1960
  for (${U}) {
1961
1961
  result += \`${V}\`;
1962
1962
  }
1963
1963
  return result;
1964
- `)(...L);X=X.substring(0,K)+R+X.substring(B),Q=!0}catch(_){let O=Z0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,K)+O+X.substring(B),Q=!0}}return X}function aj($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&Q.startsWith("{")){let j=W.slice(q+1).trim(),H=j.indexOf("=");return(H>=0?j.slice(0,H):j).trim()}let U=W.indexOf("="),z=(U>=0?W.slice(0,U):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function tj($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),q=Function(...K,"__pushIter",`
1964
+ `)(...L);X=X.substring(0,K)+R+X.substring(B),Q=!0}catch(_){let O=Z0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,K)+O+X.substring(B),Q=!0}}return X}function tj($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&Q.startsWith("{")){let j=W.slice(q+1).trim(),H=j.indexOf("=");return(H>=0?j.slice(0,H):j).trim()}let U=W.indexOf("="),z=(U>=0?W.slice(0,U):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function ej($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),q=Function(...K,"__pushIter",`
1965
1965
  for (${Z}) {
1966
1966
  __pushIter([${J.join(", ")}])
1967
1967
  }
1968
- `),U=[];q(...W,(H)=>{U.push(H)});let z=Q??"inline.stx",j="";for(let H of U){let B={...X};J.forEach((O,F)=>{B[O]=H[F]});let _=QJ(Y,B,Q,G);_=X5(_,B,z),_=S1(_,B,z),j+=_}return j}function ej($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=T0(J,"(",")",K);if(W===-1)break;let q=J.slice(K+1,W),U=O4(J.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!XJ(q)){let H=Z0("While",`Unsafe expression in @while: ${q}`,o.UNSAFE_EXPRESSION);J=J.substring(0,G)+H+J.substring(j),X=!0;continue}try{let H=Object.keys(Z),B=Object.values(Z),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});_=JJ(_);let F=Function(...H,`
1968
+ `),U=[];q(...W,(H)=>{U.push(H)});let z=Q??"inline.stx",j="";for(let H of U){let B={...X};J.forEach((O,F)=>{B[O]=H[F]});let _=GJ(Y,B,Q,G);_=X5(_,B,z),_=S1(_,B,z),j+=_}return j}function $B($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=T0(J,"(",")",K);if(W===-1)break;let q=J.slice(K+1,W),U=O4(J.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!QJ(q)){let H=Z0("While",`Unsafe expression in @while: ${q}`,o.UNSAFE_EXPRESSION);J=J.substring(0,G)+H+J.substring(j),X=!0;continue}try{let H=Object.keys(Z),B=Object.values(Z),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});_=XJ(_);let F=Function(...H,`
1969
1969
  let result = '';
1970
1970
  let maxIterations = ${Y}; // Configurable safety limit
1971
1971
  let counter = 0;
@@ -1977,8 +1977,8 @@ ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(
1977
1977
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
1978
1978
  }
1979
1979
  return result;
1980
- `)(...B);J=J.substring(0,G)+F+J.substring(j),X=!0}catch(H){let B=Z0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var lj=1000,pj=!1,g4="<!--__STX_BREAK__-->",h4="<!--__STX_CONTINUE__-->";var k6=b(()=>{L4();V1();K1();F4();V0()});import B0 from"path";function b6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function $B($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let U=J.substring(K+1,q-1),z=`${Y}(${U})`;J=J.substring(0,G)+z+J.substring(q),X.lastIndex=G+z.length,Q=X.exec(J)}return J}function ZB($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function WJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
1981
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(X!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Y.push(B),J.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Y.push(B),J.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))U();Q++}return Y.join(", ")}function qJ($,Z=""){let Y=WJ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
1980
+ `)(...B);J=J.substring(0,G)+F+J.substring(j),X=!0}catch(H){let B=Z0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var pj=1000,cj=!1,g4="<!--__STX_BREAK__-->",h4="<!--__STX_CONTINUE__-->";var k6=b(()=>{L4();V1();K1();F4();V0()});import B0 from"path";function b6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function ZB($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let U=J.substring(K+1,q-1),z=`${Y}(${U})`;J=J.substring(0,G)+z+J.substring(q),X.lastIndex=G+z.length,Q=X.exec(J)}return J}function YB($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function qJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
1981
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(X!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Y.push(B),J.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Y.push(B),J.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))U();Q++}return Y.join(", ")}function UJ($,Z=""){let Y=qJ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
1982
1982
  (function() {
1983
1983
  ${w5("var",Y)}
1984
1984
  var __destroyHooks = [];
@@ -1987,11 +1987,11 @@ ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(
1987
1987
 
1988
1988
  ${$}
1989
1989
  ${Z}})();
1990
- `}function UJ($,Z){return`
1990
+ `}function zJ($,Z){return`
1991
1991
  // Register scope variables for STX runtime
1992
1992
  if (!window.stx._scopes) window.stx._scopes = {};
1993
1993
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
1994
- ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
1994
+ ${qJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
1995
1995
  `)}
1996
1996
  // #1767: when the bundler renamed a component const that collided with an
1997
1997
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -1999,7 +1999,7 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
1999
1999
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
2000
2000
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
2001
2001
  window.stx._scopes['${Z}'] = __scopeRegistration;
2002
- `}function YB($,Z){let Y=UJ($,Z),J=`
2002
+ `}function JB($,Z){let Y=zJ($,Z),J=`
2003
2003
  (function() {
2004
2004
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
2005
2005
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -2008,21 +2008,21 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
2008
2008
  } finally {
2009
2009
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2010
2010
  }
2011
- })();`;return J+qJ($,Y)+`
2011
+ })();`;return J+UJ($,Y)+`
2012
2012
  } finally {
2013
2013
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2014
2014
  }
2015
- })();`}function JB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function QB($){if($.__onceStore instanceof Set)return $.__onceStore;return XB}async function S6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=$B($,"@partial","@include"),W=QB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let A=R[1],M=q(A,G,Y),N="";if(M&&await Bun.file(M).exists())X.add(M),N=`@include(${w})`;K=K.substring(0,O)+N+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),M=b6(A,0);if(M===-1){O.lastIndex=R;continue}let N=A.substring(0,M).trim(),I=A.substring(M+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=b6(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${N})`,C;if(W0(S)){let l=q0(S,Object.keys(Z));C=Boolean(l(...Object.values(Z)))}else C=Boolean(J0(S,Z));let x=_?!C:C,m="";if(x){let l=q(k,G,Y);if(l&&await Bun.file(l).exists())X.add(l);m=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+m+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let[,M,N,I,T]=A;try{let k,D=N.trim();if(W0(D))k=q0(D,Object.keys(Z))(...Object.values(Z));else k=J0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await z(M,S,$,O);P+=C}else if(T)P=await z(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let M=A[1],N=w.slice(A[0].length),I,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let P=1,y=1;while(y<N.length&&P>0){if(N[y]==="{")P++;else if(N[y]==="}"){if(P--,P===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let k,D=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(M.replace(/'/g,'"')),y={};if(I)try{y=L0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(J.debug){let m=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>m)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=q(C,G,Y);if(!x)continue;if(await i(x)){let m=await z(C,y,$,O);K=K.replace(R,()=>m),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(J.debug){let C=z0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function q(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=B0.resolve(_),V=B0.resolve(B0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(_,F);else w=B0.resolve(V,F);let R=B0.normalize(w),A=R.startsWith(L+B0.sep)||R===L,M=R.startsWith(V+B0.sep)||R===V,N=!1,I=B0.dirname(V);if(R.startsWith(I+B0.sep)){if(!B0.relative(I,R).split(B0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))N=!0}if(!A&&!M&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=B0.resolve(Y);Q.add(U);async function z(B,_={},O,F){let L=q(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=B0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>B0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{X.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${m}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (o3(),s3));w=x(w,Z)}if(w&&(J.debug||!L$()&&!U4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (a3(),jY));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N6(),gY));await x(w,Z,L,J,X)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let A=P5(R);if(A)R=A.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=F1(w);for(let[x,m]of Object.entries(_))T[x]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let m=x[1]||"",l=x[2]||"",G0=m.includes("server"),l0=t1(m),A0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:_0}=await Promise.resolve().then(() => (N5(),MZ)),p0=p(l,{filePath:L,projectRoot:process.cwd()});l=p0.code,A0=_0(p0.styles)}catch(p){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(l0&&l.trim())l=e1(l);if(!G0)try{let{hasUserImports:p,bundleClientScript:_0}=await Promise.resolve().then(() => (U$(),q$));if(p(l))l=await _0(l,L,{projectRoot:process.cwd()})}catch(p){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let o0=ZB(l);if(o0&&!G0){y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let p=g0(l),_0=YB(p,y);P+=`${A0}<script data-stx-scoped data-stx-run="always">${_0}</script>
2016
- `;continue}if(G0)try{let{extractVariables:p}=await Promise.resolve().then(() => (u5(),x4));await p(l,T,L)}catch(p){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!G0&&!o0){let p=m.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let _0=g0(l),p0=UJ(_0,y),N1=qJ(_0,p0);P+=`${A0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${N1}</script>
2017
- `}}if(y){let x=JB(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await S6(R,T,L,J,X,Q);let{processLoops:S}=await Promise.resolve().then(() => (k6(),GJ)),C=S(R,T,L);if(C=X5(C,T,L),C=S1(C,T,L),I)C+=`
2015
+ })();`}function XB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function GB($){if($.__onceStore instanceof Set)return $.__onceStore;return QB}async function S6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=ZB($,"@partial","@include"),W=GB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let A=R[1],M=q(A,G,Y),N="";if(M&&await Bun.file(M).exists())X.add(M),N=`@include(${w})`;K=K.substring(0,O)+N+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),M=b6(A,0);if(M===-1){O.lastIndex=R;continue}let N=A.substring(0,M).trim(),I=A.substring(M+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=b6(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${N})`,C;if(W0(S)){let l=q0(S,Object.keys(Z));C=Boolean(l(...Object.values(Z)))}else C=Boolean(J0(S,Z));let x=_?!C:C,m="";if(x){let l=q(k,G,Y);if(l&&await Bun.file(l).exists())X.add(l);m=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+m+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let[,M,N,I,T]=A;try{let k,D=N.trim();if(W0(D))k=q0(D,Object.keys(Z))(...Object.values(Z));else k=J0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await z(M,S,$,O);P+=C}else if(T)P=await z(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let M=A[1],N=w.slice(A[0].length),I,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let P=1,y=1;while(y<N.length&&P>0){if(N[y]==="{")P++;else if(N[y]==="}"){if(P--,P===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let k,D=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(M.replace(/'/g,'"')),y={};if(I)try{y=L0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(J.debug){let m=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>m)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=q(C,G,Y);if(!x)continue;if(await i(x)){let m=await z(C,y,$,O);K=K.replace(R,()=>m),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(J.debug){let C=z0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function q(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=B0.resolve(_),V=B0.resolve(B0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(_,F);else w=B0.resolve(V,F);let R=B0.normalize(w),A=R.startsWith(L+B0.sep)||R===L,M=R.startsWith(V+B0.sep)||R===V,N=!1,I=B0.dirname(V);if(R.startsWith(I+B0.sep)){if(!B0.relative(I,R).split(B0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))N=!0}if(!A&&!M&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=B0.resolve(Y);Q.add(U);async function z(B,_={},O,F){let L=q(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=B0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>B0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{X.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${m}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (o3(),s3));w=x(w,Z)}if(w&&(J.debug||!L$()&&!U4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (a3(),BY));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N6(),hY));await x(w,Z,L,J,X)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let A=P5(R);if(A)R=A.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=F1(w);for(let[x,m]of Object.entries(_))T[x]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let m=x[1]||"",l=x[2]||"",G0=m.includes("server"),p0=t1(m),A0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:_0}=await Promise.resolve().then(() => (N5(),MZ)),c0=p(l,{filePath:L,projectRoot:process.cwd()});l=c0.code,A0=_0(c0.styles)}catch(p){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(p0&&l.trim())l=e1(l);if(!G0)try{let{hasUserImports:p,bundleClientScript:_0}=await Promise.resolve().then(() => (U$(),q$));if(p(l))l=await _0(l,L,{projectRoot:process.cwd()})}catch(p){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let o0=YB(l);if(o0&&!G0){y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++WJ}`;let p=h0(l),_0=JB(p,y);P+=`${A0}<script data-stx-scoped data-stx-run="always">${_0}</script>
2016
+ `;continue}if(G0)try{let{extractVariables:p}=await Promise.resolve().then(() => (u5(),x4));await p(l,T,L)}catch(p){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!G0&&!o0){let p=m.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++WJ}`;let _0=h0(l),c0=zJ(_0,y),N1=UJ(_0,c0);P+=`${A0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${N1}</script>
2017
+ `}}if(y){let x=XB(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await S6(R,T,L,J,X,Q);let{processLoops:S}=await Promise.resolve().then(() => (k6(),KJ)),C=S(R,T,L);if(C=X5(C,T,L),C=S1(C,T,L),I)C+=`
2018
2018
  `+I;if(P)C+=`
2019
2019
  `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],A,M=V.substring(w[0].length),N=b6(M,0);if(N!==-1)A=M.substring(N+1).trim();let I={};if(A)try{I=L0(A,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,z0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await z(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function y6($,Z){let Y=$;function J(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let j=z.index,H=z[1],B=j+z[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<W.length){let R=W.slice(L),A=R.match(_),M=R.match(O),N=A?L+A.index:1/0,I=M?L+M.index:1/0;if(N<I)F++,L=N+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=W.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);W=W.substring(0,j)+W.substring(V+`@${G}`.length),q=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function P6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2020
- `)})}var KJ=0,DM,XB;var zJ=b(()=>{N4();L4();K1();Q1();E5();V0();M0();DM=new Z5(500),XB=new Set});import*as C6 from"path";async function jJ($,Z,Y=""){if(C6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return HJ($,Z,Y,"@js","@endjs")}async function BJ($,Z,Y=""){if(C6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return HJ($,Z,Y,"@ts","@endts")}async function HJ($,Z,Y,J,X){let Q=$,G=D5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:U,index:z}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=U.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2020
+ `)})}var WJ=0,EM,QB;var jJ=b(()=>{N4();L4();K1();Q1();E5();V0();M0();EM=new Z5(500),QB=new Set});import*as C6 from"path";async function BJ($,Z,Y=""){if(C6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return _J($,Z,Y,"@js","@endjs")}async function HJ($,Z,Y=""){if(C6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return _J($,Z,Y,"@ts","@endts")}async function _J($,Z,Y,J,X){let Q=$,G=D5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:U,index:z}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=U.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2021
2021
  ${_}
2022
2022
  ${L}
2023
- `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${J} Directive`,`Error executing code: ${H}`,Y,$,z,q);console.error(B),Q=Q.replace(q,"")}return Q}var _J=b(()=>{E5();M0()});function GB($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function OJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return GB(J,Q||"_method")})}async function FJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=z0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2023
+ `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${J} Directive`,`Error executing code: ${H}`,Y,$,z,q);console.error(B),Q=Q.replace(q,"")}return Q}var OJ=b(()=>{E5();M0()});function KB($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function FJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return KB(J,Q||"_method")})}async function LJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=z0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2024
2024
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(q)}</div>
2025
- `)}}}return Q}async function LJ($,Z,Y,J){return FJ($,Z,Y,J,"before")}async function VJ($,Z,Y,J){return FJ($,Z,Y,J,"after")}var wJ=b(()=>{K1();M0()});import{defineRoute as uM,defineRoutes as mM,resetRoutes as dM,route as lM,setAppUrl as pM}from"stx-router";import{route as KB}from"stx-router";function RJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?L0(X,{}):{};return KB(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var AJ=b(()=>{V0()});function MJ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let U=W.split(":"),z=W,j=U.length>1?U[1]:"";if(j&&Z[j])q=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])q=Z.openGraph[U[1]];else q="";return q?`<meta property="${c(z)}" content="${c(q)}">`:""}return q?`<meta name="${c(W)}" content="${c(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,U=W+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(W+1,U).trim(),j=U+1,H=(()=>{try{let B=L0(z,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${c(String(B.name))}"`;if(B.property)_+=` property="${c(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${c(String(B.httpEquiv))}"`;if(B.content)_+=` content="${c(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function NJ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=J.substring(K+1,q).trim(),z=q+1,j=(()=>{try{let H=L0(U,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return Z0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(z),X.lastIndex=0}return J}function TJ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,U=null,z=!1;while(q<X.length&&W>0){let F=X[q];if(z){z=!1,q++;continue}if(F==="\\"&&U){z=!0,q++;continue}if(U){if(F===U)U=null;q++;continue}if(F==='"'||F==="'"||F==="`"){U=F,q++;continue}if(F==="{")W++;else if(F==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((F)=>{try{let L=L0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${c(L.title)}</title>
2025
+ `)}}}return Q}async function VJ($,Z,Y,J){return LJ($,Z,Y,J,"before")}async function wJ($,Z,Y,J){return LJ($,Z,Y,J,"after")}var RJ=b(()=>{K1();M0()});import{defineRoute as mM,defineRoutes as dM,resetRoutes as lM,route as pM,setAppUrl as cM}from"stx-router";import{route as WB}from"stx-router";function AJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?L0(X,{}):{};return WB(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var MJ=b(()=>{V0()});function NJ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let U=W.split(":"),z=W,j=U.length>1?U[1]:"";if(j&&Z[j])q=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])q=Z.openGraph[U[1]];else q="";return q?`<meta property="${c(z)}" content="${c(q)}">`:""}return q?`<meta name="${c(W)}" content="${c(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,U=W+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(W+1,U).trim(),j=U+1,H=(()=>{try{let B=L0(z,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${c(String(B.name))}"`;if(B.property)_+=` property="${c(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${c(String(B.httpEquiv))}"`;if(B.content)_+=` content="${c(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function TJ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=J.substring(K+1,q).trim(),z=q+1,j=(()=>{try{let H=L0(U,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return Z0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(z),X.lastIndex=0}return J}function IJ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,U=null,z=!1;while(q<X.length&&W>0){let F=X[q];if(z){z=!1,q++;continue}if(F==="\\"&&U){z=!0,q++;continue}if(U){if(F===U)U=null;q++;continue}if(F==='"'||F==="'"||F==="`"){U=F,q++;continue}if(F==="{")W++;else if(F==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((F)=>{try{let L=L0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${c(L.title)}</title>
2026
2026
  `,V+=`<meta name="title" content="${c(L.title)}">
2027
2027
  `;if(L.description)V+=`<meta name="description" content="${c(L.description)}">
2028
2028
  `;if(L.keywords){let w=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;V+=`<meta name="keywords" content="${c(w)}">
@@ -2044,7 +2044,7 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
2044
2044
  `}if(w.site)V+=`<meta name="twitter:site" content="${c(w.site)}">
2045
2045
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${c(w.creator)}">
2046
2046
  `}if(L.structuredData){let w=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
2047
- `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return Z0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+O+X.substring(H),Q.lastIndex=G.index+O.length}return X}function IJ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let q=`
2047
+ `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return Z0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+O+X.substring(H),Q.lastIndex=G.index+O.length}return X}function DJ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let q=`
2048
2048
  <!-- stx SEO Tags -->
2049
2049
  <meta name="title" content="${c(G)}">
2050
2050
  <meta name="description" content="${c(K)}">
@@ -2060,29 +2060,29 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
2060
2060
  `;let U=$;if(!Q)U=U.replace(/<head[^>]*>/,`$&
2061
2061
  <title>${c(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2062
2062
  ${q}
2063
- `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var DJ,EJ;var v6=b(()=>{V1();V0();DJ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(X)}" content="${c(Q)}">`},hasEndTag:!1},EJ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return Z0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function kJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(S$.exact[$])for(let J of S$.exact[$])await Promise.resolve(J(Z,$));if(S$.exact[Y])for(let J of S$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of S$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var S$;var bJ=b(()=>{S$={patterns:[],exact:{}}});function SJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>SJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function yJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([U,z])=>q>=U&&q<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=U,B=!1;while((j=z.exec(U))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let A=SJ(R);if(A){let M=H.match(/\sclass="([^"]*)"/);if(M)H=H.replace(M[0],` class="${M[1]} ${A}"`);else H=H.replace(j[0],` class="${A}"`)}else H=H.replace(j[0],"");B=!0;continue}if(WB.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${A}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:F})}}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var WB;var PJ=b(()=>{WB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function U5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&qB.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function zB($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function q1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=zB($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function CJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function m5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function g1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function h1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function jB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function BB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let q=g1(J.attrs,"v-for"),U=g1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${W})
2063
+ `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var EJ,kJ;var v6=b(()=>{V1();V0();EJ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(X)}" content="${c(Q)}">`},hasEndTag:!1},kJ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return Z0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function bJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(S$.exact[$])for(let J of S$.exact[$])await Promise.resolve(J(Z,$));if(S$.exact[Y])for(let J of S$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of S$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var S$;var SJ=b(()=>{S$={patterns:[],exact:{}}});function yJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>yJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function PJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([U,z])=>q>=U&&q<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=U,B=!1;while((j=z.exec(U))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let A=yJ(R);if(A){let M=H.match(/\sclass="([^"]*)"/);if(M)H=H.replace(M[0],` class="${M[1]} ${A}"`);else H=H.replace(j[0],` class="${A}"`)}else H=H.replace(j[0],"");B=!0;continue}if(qB.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${A}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:F})}}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var qB;var CJ=b(()=>{qB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function U5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&UB.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function jB($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function q1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=jB($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function vJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function m5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function g1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function h1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function BB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function HB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let q=g1(J.attrs,"v-for"),U=g1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${W})
2064
2064
  `,_=`${B}${H}
2065
- @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function HB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=q1(Z,J),K=g1(J.attrs,"v-if"),W=h1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,U=!0;while(U){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,F=U5(Z,q+O);if(!F){U=!1;break}let L=m5(F.attrs,"v-else-if"),V=CJ(F.attrs,"v-else");if(L!==null){let w=q1(Z,F),R=g1(F.attrs,"v-else-if"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),q=w.outerEnd}else if(V){let w=q1(Z,F),R=g1(F.attrs,"v-else"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
2065
+ @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function _B($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=q1(Z,J),K=g1(J.attrs,"v-if"),W=h1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,U=!0;while(U){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,F=U5(Z,q+O);if(!F){U=!1;break}let L=m5(F.attrs,"v-else-if"),V=vJ(F.attrs,"v-else");if(L!==null){let w=q1(Z,F),R=g1(F.attrs,"v-else-if"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),q=w.outerEnd}else if(V){let w=q1(Z,F),R=g1(F.attrs,"v-else"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
2066
2066
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
2067
2067
  ${_.element}`);else z.push(`@else
2068
2068
  ${_.element}`);z.push("@endif");let j=z.join(`
2069
- `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function _B($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function OB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let U=K[1],z=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=X.match(G)}if(Q){let U=q1(Z,J),z=Z.slice(U.outerStart,U.outerEnd),j=h1(z,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let W=m5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(UB.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}}return Z}function FB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function LB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function VB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function wB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function RB($){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 AB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;if(!CJ(J.attrs,"v-once")){Y=J.end;continue}let X=g1(J.attrs,"v-once"),Q=q1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
2069
+ `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function OB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function FB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let U=K[1],z=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=X.match(G)}if(Q){let U=q1(Z,J),z=Z.slice(U.outerStart,U.outerEnd),j=h1(z,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let W=m5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(zB.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}}return Z}function LB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function VB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function wB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function RB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function AB($){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 MB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;if(!vJ(J.attrs,"v-once")){Y=J.end;continue}let X=g1(J.attrs,"v-once"),Q=q1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
2070
2070
  ${h1(G,{...J,start:0,end:J.end-J.start},X)}
2071
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function MB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function NB($){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 vJ($){if(!jB($))return $;let Z=$;return Z=BB(Z),Z=HB(Z),Z=AB(Z),Z=FB(Z),Z=LB(Z),Z=OB(Z),Z=_B(Z),Z=NB(Z),Z=VB(Z),Z=wB(Z),Z=RB(Z),Z=MB(Z),Z}var qB,UB;var xJ=b(()=>{qB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),UB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function u4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fJ($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Y?Y[1]:$,X=J0(J,Z);if(X&&typeof X==="string")return X;let Q=J.trim();return x6.has(Q)?Q:null}function gJ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function hJ($,Z,Y){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),X=J?`<${$} ${J}>`:`<${$}>`;if(TB.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${X}${Y}</${$}>`}async function uJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=fJ(U.expr,Z);if(!z||typeof z!=="string"){let L=`<!-- dynamic component: could not resolve "${u4(gJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let L=hJ(z,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=J0(V,Z)}catch{H[L]=V}else H[L]=V}let O=J.componentsDir||"components",F=await q5(z,H,U.slotContent,O,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+F+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q=await IB(Q,Z,Y,J,X),Q}async function IB($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=fJ(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${u4(gJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let B=hJ(z,U.attrs,"");Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}let j=J.componentsDir||"components",H=await q5(z,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q}var x6,TB;var mJ=b(()=>{M0();V0();x6=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),TB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function dJ($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function lJ($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=f6($),W=[],q=new Map;if(Q)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let j=z[1],H=`${Z}_${j}`;q.set(j,H)}}for(let U of K){let z=pJ(U,Z,J,X,q,G);W.push(z)}return W.join(`
2071
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function NB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function TB($){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 xJ($){if(!BB($))return $;let Z=$;return Z=HB(Z),Z=_B(Z),Z=MB(Z),Z=LB(Z),Z=VB(Z),Z=FB(Z),Z=OB(Z),Z=TB(Z),Z=wB(Z),Z=RB(Z),Z=AB(Z),Z=NB(Z),Z}var UB,zB;var fJ=b(()=>{UB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function u4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gJ($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Y?Y[1]:$,X=J0(J,Z);if(X&&typeof X==="string")return X;let Q=J.trim();return x6.has(Q)?Q:null}function hJ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function uJ($,Z,Y){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),X=J?`<${$} ${J}>`:`<${$}>`;if(IB.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${X}${Y}</${$}>`}async function mJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=gJ(U.expr,Z);if(!z||typeof z!=="string"){let L=`<!-- dynamic component: could not resolve "${u4(hJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let L=uJ(z,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=J0(V,Z)}catch{H[L]=V}else H[L]=V}let O=J.componentsDir||"components",F=await q5(z,H,U.slotContent,O,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+F+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q=await DB(Q,Z,Y,J,X),Q}async function DB($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=gJ(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${u4(hJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let B=uJ(z,U.attrs,"");Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}let j=J.componentsDir||"components",H=await q5(z,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q}var x6,IB;var dJ=b(()=>{M0();V0();x6=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),IB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function lJ($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function pJ($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=f6($),W=[],q=new Map;if(Q)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let j=z[1],H=`${Z}_${j}`;q.set(j,H)}}for(let U of K){let z=cJ(U,Z,J,X,q,G);W.push(z)}return W.join(`
2072
2072
 
2073
2073
  `)}function f6($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let q=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,U,z,j]=q;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:j.trim()});else if(U==="media"||U==="supports"||U==="container"){let H=f6(j);Z.push({selector:`@${U} ${z.trim()}`,declarations:H.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
2074
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function pJ($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=f6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>pJ(j,Z,Y,J,X,Q)).join(`
2074
+ `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function cJ($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=f6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>cJ(j,Z,Y,J,X,Q)).join(`
2075
2075
  `);return`${G} {
2076
2076
  ${z}
2077
- }`}return`${G} { ${K} }`}let W=DB(G,Z,Y,J),q=K;for(let[U,z]of X)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function DB($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=EB(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function EB($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function iJ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function m4($,Z){if(!kB.test($))return{html:$,hasScoped:!1};let Y=dJ(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${g6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let U=bB(q,J),z=W.replace(new RegExp(g6,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return X=yB(X,J),{html:X,hasScoped:!0}}function bB($,Z){return lJ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function yB($,Z){let Y=G1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:T5(X,Q)},(X,Q)=>SB(Q)),J=PB(Y.output,Z);return cJ.lastIndex=0,J.replace(cJ,(X,Q)=>Y.tokens[Number(Q)])}function PB($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var g6,kB,SB=($)=>`\x00stx-scope-mask-${$}\x00`,cJ;var h6=b(()=>{$5();g6=String.raw`(?<![\w-])scoped(?![\w-])`,kB=new RegExp(`<style\\s+[^>]*${g6}`,"i");cJ=/\u0000stx-scope-mask-(\d+)\u0000/g});function gB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!CB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!fB.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!xB.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!vB.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:J,attribute:X,autoValue:Q}}function hB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function m6($={}){let Z=gB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${hB(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function nJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=u6($);if(Y===null)return $;let J=m6(Z);return`${$.slice(0,Y)}
2078
- ${J}${$.slice(Y)}`}function u6($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(J)Y+=J[0].length;return Y}function dB($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",Y),X=$.slice(Y,J===-1?$.length:J),Q=mB.exec(X);if(!Q||X.slice(0,Q.index).trim()==="")return $;let G=X.slice(0,Q.index)+X.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
2079
- ${Q[0]}`+G+$.slice(Y+X.length)}function sJ($){return lB(dB($))}function lB($){let Z=uB.exec($);if(!Z)return $;let Y=u6($);if(Y===null)return $;if(Z.index<=Y||$.slice(Y,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),X=u6(J);if(X===null)return $;return`${J.slice(0,X)}
2080
- ${Z[0]}${J.slice(X)}`}var CB,vB,xB,fB,uB,mB;var d6=b(()=>{CB=new Set(["light","dark","auto","system"]),vB=new Set(["auto","system"]),xB=/^[a-z][\w:-]*$/i,fB=/^[\w-]+$/;uB=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),mB=/<meta\b[^>]*\bcharset\b[^>]*>/i});function pB(){if(l6===null)l6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return l6}function oJ($,Z=pB()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length;return`${$.slice(0,J)}
2081
- <meta name="stx-build" content="${Z}">${$.slice(J)}`}var l6=null;function A1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cB($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p6($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function d5($,Z){return Object.entries($).filter(([Y])=>!Z?.(Y)).map(([Y,J])=>`${Y}="${A1(String(J))}"`).join(" ")}function iB($={},Z="en"){let Y=[],J=[],X="",Q=Z;for(let[K,W]of Object.entries($||{})){if(W==null)continue;let q=K.trim();if(!aJ.test(q))continue;let U=q.toLowerCase();if(U==="lang"){Q=String(W);continue}if(U==="class"){X=String(W).trim();continue}Y.push(` ${q}="${A1(String(W))}"`),J.push(q)}let G=` lang="${A1(Q)}"`;if(X)G+=` class="${A1(X)}"`;if(G+=Y.join(""),X)G+=` ${l4}="${A1(X)}"`;if(J.length)G+=` ${d4}="${A1(J.join(" "))}"`;return G}function tJ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let X of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(X))J.push(X);Y.class=J.join(" ")}return Y}function eJ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let J={},X=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(Y[1]))!==null){let U=G[1];if(!(U in J))X.push(U);J[U]=G[2]??G[3]??G[4]??""}let K=[],W=[];for(let[U,z]of Object.entries(Z)){if(z==null)continue;let j=U.trim();if(!aJ.test(j))continue;let H=j.toLowerCase();if(H==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),K.push(_);if(!("class"in J))X.push("class");J.class=B.join(" ");continue}if(!(j in J))X.push(j);if(J[j]=String(z),H!=="lang")W.push(j)}if(K.length){if(!(l4 in J))X.push(l4);J[l4]=K.join(" ")}if(W.length){if(!(d4 in J))X.push(d4);J[d4]=W.join(" ")}let q=X.map((U)=>` ${U}="${A1(J[U])}"`).join("");return $.replace(Y[0],()=>`<html${q}>`)}function $X($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${rJ}
2082
- ${$.slice(Z)}`}function nB($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function sB($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",htmlAttrs:q={},bodyClass:U="",bodyAttrs:z={}}=Z,j=Y.title||J,H=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(p6).filter(Boolean)),O=[...H.filter((T)=>!B.has(p6(T))),...Q].map((T)=>{return` <meta ${d5(T)}>`}).join(`
2077
+ }`}return`${G} { ${K} }`}let W=EB(G,Z,Y,J),q=K;for(let[U,z]of X)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function EB($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=kB(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function kB($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function nJ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function m4($,Z){if(!bB.test($))return{html:$,hasScoped:!1};let Y=lJ(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${g6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let U=SB(q,J),z=W.replace(new RegExp(g6,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return X=PB(X,J),{html:X,hasScoped:!0}}function SB($,Z){return pJ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function PB($,Z){let Y=G1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:T5(X,Q)},(X,Q)=>yB(Q)),J=CB(Y.output,Z);return iJ.lastIndex=0,J.replace(iJ,(X,Q)=>Y.tokens[Number(Q)])}function CB($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var g6,bB,yB=($)=>`\x00stx-scope-mask-${$}\x00`,iJ;var h6=b(()=>{$5();g6=String.raw`(?<![\w-])scoped(?![\w-])`,bB=new RegExp(`<style\\s+[^>]*${g6}`,"i");iJ=/\u0000stx-scope-mask-(\d+)\u0000/g});function hB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!vB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!gB.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!fB.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!xB.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:J,attribute:X,autoValue:Q}}function uB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function m6($={}){let Z=hB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${uB(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function sJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=u6($);if(Y===null)return $;let J=m6(Z);return`${$.slice(0,Y)}
2078
+ ${J}${$.slice(Y)}`}function u6($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(J)Y+=J[0].length;return Y}function lB($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",Y),X=$.slice(Y,J===-1?$.length:J),Q=dB.exec(X);if(!Q||X.slice(0,Q.index).trim()==="")return $;let G=X.slice(0,Q.index)+X.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
2079
+ ${Q[0]}`+G+$.slice(Y+X.length)}function oJ($){return pB(lB($))}function pB($){let Z=mB.exec($);if(!Z)return $;let Y=u6($);if(Y===null)return $;if(Z.index<=Y||$.slice(Y,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),X=u6(J);if(X===null)return $;return`${J.slice(0,X)}
2080
+ ${Z[0]}${J.slice(X)}`}var vB,xB,fB,gB,mB,dB;var d6=b(()=>{vB=new Set(["light","dark","auto","system"]),xB=new Set(["auto","system"]),fB=/^[a-z][\w:-]*$/i,gB=/^[\w-]+$/;mB=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),dB=/<meta\b[^>]*\bcharset\b[^>]*>/i});function cB(){if(l6===null)l6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return l6}function rJ($,Z=cB()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length;return`${$.slice(0,J)}
2081
+ <meta name="stx-build" content="${Z}">${$.slice(J)}`}var l6=null;function A1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iB($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p6($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function d5($,Z){return Object.entries($).filter(([Y])=>!Z?.(Y)).map(([Y,J])=>`${Y}="${A1(String(J))}"`).join(" ")}function nB($={},Z="en"){let Y=[],J=[],X="",Q=Z;for(let[K,W]of Object.entries($||{})){if(W==null)continue;let q=K.trim();if(!tJ.test(q))continue;let U=q.toLowerCase();if(U==="lang"){Q=String(W);continue}if(U==="class"){X=String(W).trim();continue}Y.push(` ${q}="${A1(String(W))}"`),J.push(q)}let G=` lang="${A1(Q)}"`;if(X)G+=` class="${A1(X)}"`;if(G+=Y.join(""),X)G+=` ${l4}="${A1(X)}"`;if(J.length)G+=` ${d4}="${A1(J.join(" "))}"`;return G}function eJ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let X of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(X))J.push(X);Y.class=J.join(" ")}return Y}function $X($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let J={},X=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(Y[1]))!==null){let U=G[1];if(!(U in J))X.push(U);J[U]=G[2]??G[3]??G[4]??""}let K=[],W=[];for(let[U,z]of Object.entries(Z)){if(z==null)continue;let j=U.trim();if(!tJ.test(j))continue;let H=j.toLowerCase();if(H==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),K.push(_);if(!("class"in J))X.push("class");J.class=B.join(" ");continue}if(!(j in J))X.push(j);if(J[j]=String(z),H!=="lang")W.push(j)}if(K.length){if(!(l4 in J))X.push(l4);J[l4]=K.join(" ")}if(W.length){if(!(d4 in J))X.push(d4);J[d4]=W.join(" ")}let q=X.map((U)=>` ${U}="${A1(J[U])}"`).join("");return $.replace(Y[0],()=>`<html${q}>`)}function ZX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${aJ}
2082
+ ${$.slice(Z)}`}function sB($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function oB($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",htmlAttrs:q={},bodyClass:U="",bodyAttrs:z={}}=Z,j=Y.title||J,H=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(p6).filter(Boolean)),O=[...H.filter((T)=>!B.has(p6(T))),...Q].map((T)=>{return` <meta ${d5(T)}>`}).join(`
2083
2083
  `),F=G.map((T)=>{return` <link ${d5(T)}>`}).join(`
2084
2084
  `),L=K.map((T)=>{if(T.src)return` <script ${d5(T,(k)=>k==="content")}></script>`;if(T.content)return` <script>${T.content}</script>`;return""}).filter(Boolean).join(`
2085
- `),V=iB(q,X),w=Object.entries(z).map(([T,k])=>` ${T}="${A1(String(k))}"`).join(""),R=U?` class="${A1(U)}"`:"",{body:A,hoisted:M}=nB($),N=[O,Y.colorMode?` ${m6(Y.colorMode)}`:"",` <title>${Y.titleIsHtml?j:cB(j)}</title>`,` ${rJ}`,F,L,W?` ${W}`:"",...(Y.styles||[]).map((T)=>` ${T}`),...M.map((T)=>` ${T}`),...(Y.headScripts||[]).map((T)=>` ${T}`),Y.headStack||""].filter(Boolean),I=[A,...(Y.bodyScripts||[]).map((T)=>T),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2085
+ `),V=nB(q,X),w=Object.entries(z).map(([T,k])=>` ${T}="${A1(String(k))}"`).join(""),R=U?` class="${A1(U)}"`:"",{body:A,hoisted:M}=sB($),N=[O,Y.colorMode?` ${m6(Y.colorMode)}`:"",` <title>${Y.titleIsHtml?j:iB(j)}</title>`,` ${aJ}`,F,L,W?` ${W}`:"",...(Y.styles||[]).map((T)=>` ${T}`),...M.map((T)=>` ${T}`),...(Y.headScripts||[]).map((T)=>` ${T}`),Y.headStack||""].filter(Boolean),I=[A,...(Y.bodyScripts||[]).map((T)=>T),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2086
2086
  <html${V}>
2087
2087
  <head>
2088
2088
  ${N.join(`
@@ -2092,9 +2092,9 @@ ${N.join(`
2092
2092
  ${I.join(`
2093
2093
  `)}
2094
2094
  </body>
2095
- </html>`}function c6($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let X=Y.match(/^<(script|style)\b[^>]*>/i);if(X){let Q=`</${X[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+X[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}return!1}function i6($){return c6($)}function ZX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let q of J){let U=p6(q);if(U&&K.includes(U))continue;W.push(` <meta ${d5(q)}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${d5(q)}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${d5(q,(U)=>U==="content")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
2095
+ </html>`}function c6($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let X=Y.match(/^<(script|style)\b[^>]*>/i);if(X){let Q=`</${X[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+X[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}return!1}function i6($){return c6($)}function YX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let q of J){let U=p6(q);if(U&&K.includes(U))continue;W.push(` <meta ${d5(q)}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${d5(q)}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${d5(q,(U)=>U==="content")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
2096
2096
  `)}
2097
- ${$.slice(Y)}`}function YX($,Z={},Y={}){if(i6($))return $;return sB($,Z,Y)}var rJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",d4="data-stx-html-attrs",l4="data-stx-html-class",aJ;var JX=b(()=>{d6();aJ=/^[A-Za-z_:][\w:.-]*$/});import{matchRoute as UN,Router as oB}from"stx-router";import{findErrorPage as BN,formatRoutes as HN,generateRouteManifest as _N,generateRouteTypes as ON,matchRoute as FN}from"stx-router";function XX($,Z={}){return new oB($,Z).routes}var QX=()=>{};async function KX($){let Z=$;if(!Z)try{Z=(await u1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,J=GX.get(Y);if(J)return J;let X=[];try{X=XX(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return GX.set(Y,X),X}var GX;var WX=b(()=>{QX();O1();GX=new Map});function rB($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function qX($){return rB(JSON.stringify($))}function m1($){let Z=$,Y=new Set,J=new Set,X=()=>{if(m0)J.add(m0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),y$)J.forEach((K)=>c4.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function n4($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,y$)J.forEach((G)=>c4.add(G));else J.forEach((G)=>G())},Q=()=>{if(m0)J.add(m0);if(Y){let G=m0;m0=X,p4.push(X);try{Z=$()}finally{p4.pop(),m0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function s4($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=m0;m0=X,p4.push(X);try{let G=$();Y=typeof G==="function"?G:void 0}finally{p4.pop(),m0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function s6($){if(y$){$();return}y$=!0;try{$()}finally{y$=!1,c4.forEach((Z)=>Z()),c4.clear()}}function o6($){n6.push($)}function r6($){i4.push($)}function aB(){UX(n6,"onMount",i4)}function tB(){UX(i4,"onDestroy")}function UX($,Z,Y){let J=$.splice(0,$.length);for(let X of J)try{let Q=X();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function eB(){return{mount:n6.length,destroy:i4.length}}function o4($){return typeof $==="function"&&$._isSignal===!0}function r4($){return typeof $==="function"&&$._isDerived===!0}function a6($){if(o4($)||r4($))return $();return $}function a4($){let Z=m0;m0=null;try{return $()}finally{m0=Z}}function $H($,Z){let Y=typeof $==="function"?$:()=>$,J=m1([]),X=n4(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return s4(()=>{if(Y(),!Q){Q=!0;return}if(a4(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let U=()=>{let z=J().filter((j)=>j!==q);if(z.length!==J().length)J.set(z)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var m0=null,p4,y$=!1,c4,n6,i4;var t4=b(()=>{p4=[],c4=new Set,n6=[],i4=[]});var jX={};t(jX,{useOptimistic:()=>$H,untrack:()=>a6,state:()=>m1,runMountCallbacks:()=>aB,runDestroyCallbacks:()=>tB,pendingLifecycleCounts:()=>eB,peek:()=>a4,onMount:()=>o6,onDestroy:()=>r6,isSignal:()=>o4,isDerived:()=>r4,generateSignalsRuntimeDev:()=>t6,generateSignalsRuntime:()=>zX,effect:()=>s4,derived:()=>n4,default:()=>YH,batch:()=>s6});function zX(){let $=ZH(t6());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function ZH($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function t6(){return`
2097
+ ${$.slice(Y)}`}function JX($,Z={},Y={}){if(i6($))return $;return oB($,Z,Y)}var aJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",d4="data-stx-html-attrs",l4="data-stx-html-class",tJ;var XX=b(()=>{d6();tJ=/^[A-Za-z_:][\w:.-]*$/});import{matchRoute as zN,Router as rB}from"stx-router";import{findErrorPage as HN,formatRoutes as _N,generateRouteManifest as ON,generateRouteTypes as FN,matchRoute as LN}from"stx-router";function QX($,Z={}){return new rB($,Z).routes}var GX=()=>{};async function WX($){let Z=$;if(!Z)try{Z=(await u1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,J=KX.get(Y);if(J)return J;let X=[];try{X=QX(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return KX.set(Y,X),X}var KX;var qX=b(()=>{GX();O1();KX=new Map});function aB($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function UX($){return aB(JSON.stringify($))}function m1($){let Z=$,Y=new Set,J=new Set,X=()=>{if(d0)J.add(d0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),y$)J.forEach((K)=>c4.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function n4($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,y$)J.forEach((G)=>c4.add(G));else J.forEach((G)=>G())},Q=()=>{if(d0)J.add(d0);if(Y){let G=d0;d0=X,p4.push(X);try{Z=$()}finally{p4.pop(),d0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function s4($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=d0;d0=X,p4.push(X);try{let G=$();Y=typeof G==="function"?G:void 0}finally{p4.pop(),d0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function s6($){if(y$){$();return}y$=!0;try{$()}finally{y$=!1,c4.forEach((Z)=>Z()),c4.clear()}}function o6($){n6.push($)}function r6($){i4.push($)}function tB(){zX(n6,"onMount",i4)}function eB(){zX(i4,"onDestroy")}function zX($,Z,Y){let J=$.splice(0,$.length);for(let X of J)try{let Q=X();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function $H(){return{mount:n6.length,destroy:i4.length}}function o4($){return typeof $==="function"&&$._isSignal===!0}function r4($){return typeof $==="function"&&$._isDerived===!0}function a6($){if(o4($)||r4($))return $();return $}function a4($){let Z=d0;d0=null;try{return $()}finally{d0=Z}}function ZH($,Z){let Y=typeof $==="function"?$:()=>$,J=m1([]),X=n4(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return s4(()=>{if(Y(),!Q){Q=!0;return}if(a4(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let U=()=>{let z=J().filter((j)=>j!==q);if(z.length!==J().length)J.set(z)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var d0=null,p4,y$=!1,c4,n6,i4;var t4=b(()=>{p4=[],c4=new Set,n6=[],i4=[]});var BX={};t(BX,{useOptimistic:()=>ZH,untrack:()=>a6,state:()=>m1,runMountCallbacks:()=>tB,runDestroyCallbacks:()=>eB,pendingLifecycleCounts:()=>$H,peek:()=>a4,onMount:()=>o6,onDestroy:()=>r6,isSignal:()=>o4,isDerived:()=>r4,generateSignalsRuntimeDev:()=>t6,generateSignalsRuntime:()=>jX,effect:()=>s4,derived:()=>n4,default:()=>JH,batch:()=>s6});function jX(){let $=YH(t6());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function YH($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function t6(){return`
2098
2098
  // STX Signals Runtime (Development Build)
2099
2099
  console.log('[stx] signals runtime loading');
2100
2100
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9855,7 +9855,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9855
9855
  }
9856
9856
  }
9857
9857
  })();
9858
- `}var YH;var BX=b(()=>{t4();Q1();t4();YH={state:m1,derived:n4,effect:s4,batch:s6,onMount:o6,onDestroy:r6,isSignal:o4,isDerived:r4,untrack:a6,peek:a4,generateSignalsRuntime:zX,generateSignalsRuntimeDev:t6}});var e6={};t(e6,{templateCache:()=>HX,readFileCached:()=>JH,invalidateFileCacheByDir:()=>QH,invalidateFileCache:()=>XH,hashFilePath:()=>P$,getCachedSignalsRuntime:()=>WH,getCachedRouterScript:()=>qH,clearDevCaches:()=>UH,checkCache:()=>zH,cacheTemplate:()=>jH,__setSignalsGeneratorsForTest:()=>KH});import d1 from"fs";import l5 from"path";async function JH($){let Y;for(let J=0;J<3;J++)try{let Q=(await d1.promises.stat($)).mtime.getTime(),G=z5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await d1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return z5.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw z5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function XH($){z5.delete($)}function QH($){for(let Z of z5.keys())if(Z.startsWith($))z5.delete(Z)}function KH($){_X=$}async function WH($=!1){let Z=_X??await Promise.resolve().then(() => (BX(),jX));if($)return Z.generateSignalsRuntimeDev();if(e4===null)e4=Z.generateSignalsRuntime();return e4}async function qH(){if($7===null){let{getRouterScript:$}=await import("stx-router");$7=$()}return $7}function UH(){z5.clear(),FX(),e4=null,GH=null,$7=null}function OX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function zH($,Z){try{if(!Z.cachePath)return null;let Y=l5.resolve(Z.cachePath),J=l5.join(Y,`${P$($)}.html`),X=l5.join(Y,`${P$($)}.meta.json`);if(!await i(J)||!await i(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==OX(Z))return null;if((await d1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await i(W)){if((await d1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function jH($,Z,Y,J){try{if(!J.cachePath)return;let X=l5.resolve(J.cachePath);await d1.promises.mkdir(X,{recursive:!0});let Q=l5.join(X,`${P$($)}.html`),G=l5.join(X,`${P$($)}.meta.json`),K=await d1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:OX(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),HX.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function P$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,BH)}var HX,z5,e4=null,GH=null,_X=null,$7=null,BH=16;var $9=b(()=>{M0();HX=new Map,z5=new Map});function LX($){return $.includes("data-stx-runtime")}function VX($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let J=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}async function Z7($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9858
+ `}var JH;var HX=b(()=>{t4();Q1();t4();JH={state:m1,derived:n4,effect:s4,batch:s6,onMount:o6,onDestroy:r6,isSignal:o4,isDerived:r4,untrack:a6,peek:a4,generateSignalsRuntime:jX,generateSignalsRuntimeDev:t6}});var e6={};t(e6,{templateCache:()=>_X,readFileCached:()=>XH,invalidateFileCacheByDir:()=>GH,invalidateFileCache:()=>QH,hashFilePath:()=>P$,getCachedSignalsRuntime:()=>qH,getCachedRouterScript:()=>UH,clearDevCaches:()=>zH,checkCache:()=>jH,cacheTemplate:()=>BH,__setSignalsGeneratorsForTest:()=>WH});import d1 from"fs";import l5 from"path";async function XH($){let Y;for(let J=0;J<3;J++)try{let Q=(await d1.promises.stat($)).mtime.getTime(),G=z5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await d1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return z5.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw z5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function QH($){z5.delete($)}function GH($){for(let Z of z5.keys())if(Z.startsWith($))z5.delete(Z)}function WH($){OX=$}async function qH($=!1){let Z=OX??await Promise.resolve().then(() => (HX(),BX));if($)return Z.generateSignalsRuntimeDev();if(e4===null)e4=Z.generateSignalsRuntime();return e4}async function UH(){if($7===null){let{getRouterScript:$}=await import("stx-router");$7=$()}return $7}function zH(){z5.clear(),LX(),e4=null,KH=null,$7=null}function FX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function jH($,Z){try{if(!Z.cachePath)return null;let Y=l5.resolve(Z.cachePath),J=l5.join(Y,`${P$($)}.html`),X=l5.join(Y,`${P$($)}.meta.json`);if(!await i(J)||!await i(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==FX(Z))return null;if((await d1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await i(W)){if((await d1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function BH($,Z,Y,J){try{if(!J.cachePath)return;let X=l5.resolve(J.cachePath);await d1.promises.mkdir(X,{recursive:!0});let Q=l5.join(X,`${P$($)}.html`),G=l5.join(X,`${P$($)}.meta.json`),K=await d1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:FX(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),_X.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function P$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,HH)}var _X,z5,e4=null,KH=null,OX=null,$7=null,HH=16;var $9=b(()=>{M0();_X=new Map,z5=new Map});function VX($){return $.includes("data-stx-runtime")}function wX($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let J=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}async function Z7($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9859
9859
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9860
9860
  `+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
9861
9861
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
@@ -9865,15 +9865,15 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9865
9865
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
9866
9866
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
9867
9867
  `+X+$.slice(K+1)}return X+`
9868
- `+$}async function Z9($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";{let K={};if(Y){if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight}try{let W=await KX(Z?.pagesDir);if(W.length>0)K.ownedRoutes=W}catch{}if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${qX(K)};</script>
9868
+ `+$}async function Z9($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";{let K={};if(Y){if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight}try{let W=await WX(Z?.pagesDir);if(W.length>0)K.ownedRoutes=W}catch{}if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${UX(K)};</script>
9869
9869
  `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => ($9(),e6)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
9870
- </body>`+$.slice(G+7)}var Y7=b(()=>{WX();R3()});var G7={};t(G7,{scanScriptTags:()=>IX,rewriteStxImportSpecifiers:()=>bX,processSignals:()=>G9,processScriptSetup:()=>EX,preEvalLiteralReactiveIfs:()=>X9,parseLoopExpression:()=>DX,hasSignalsSyntax:()=>Q7,findMarkupIndexOutsideScripts:()=>X7,extractExports:()=>kX,convertSignalLoopsToAttributes:()=>Q9,convertSignalDirectivesToAttributes:()=>J9});function IX($,Z={}){let Y=[];for(let J of z3($,k1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function DX($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=RX(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=RX(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function RX($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function Q7($){return n8($)}function _H($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function OH($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function FH($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function MX($,Z,Y){if(!$)return!1;let J=FH($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(AX.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=q.exec(J))!==null){let j=U[1];if(J.slice(0,U.index).trimEnd().endsWith("."))continue;if(AX.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function J7($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(TX);if(Q&&LH(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function LH($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function J9($,Z){let Y=OH($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,U=q+K[0].length,z=1,j=U;while(j<Q.length&&z>0){if(Q[j]==="(")z++;else if(Q[j]===")")z--;j++}if(z!==0)continue;let H=Q.substring(U,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(_H(V)){let R=w$(Q.substring(q,O));if(R.length===0)continue;let A=R[0].branches.filter((I)=>I.type!=="else");if(!(A.length>0&&A.every((I)=>MX(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=J(I.content);if(I.type==="elseif")return J7(T,"@else-if",I.condition??"");if(I.type==="else")return J7(T,"@else");return J7(T,"@if",I.condition??"")}).join(`
9871
- `)}else{if(!MX(H,Y,Z))continue;w=J7(J(V),"@if",H)}W.push({start:q,end:O,replacement:w}),G.lastIndex=O}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Q=Q.substring(0,U)+j+Q.substring(z)}return Q}return J($)}function VH($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function wH($,Z,Y,J){if(Y9.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let H=$.indexOf("-->",W+4);if(H===-1)return-1;W=H+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let H=$.indexOf(">",W);if(H===-1)return-1;if($[H-1]==="/"){W=H+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!H){W++;continue}if(H[1].toLowerCase()===X){if(K--,W+=H[0].length,K===0)return W;continue}W+=H[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(z[1].toLowerCase()===X){let H=$.slice(W,j+1);if(!(/\/\s*>$/.test(H)||Y9.has(X)))K++}W=j+1}return-1}function AH($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return RH.test(Q)}function X9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(z)=>Z.some(([j,H])=>z>=j&&z<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[z,j,H,B,_,O,F]=K,L=VH(_);if(L===void 0)continue;let V=K.index,w=V+z.length,M=!!F||/\/\s*>$/.test(z)||Y9.has(j.toLowerCase())?w:wH($,V,j,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&AH($,M)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((z,j)=>z.start-j.start);let W=[],q=-1;for(let z of G){if(z.start<q)continue;W.push(z),q=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:j,end:H,replacement:B}=W[z];U=U.substring(0,j)+B+U.substring(H)}return U}function Q9($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[],G=[];while((X=J.exec(Y))!==null){let K=X[1],W=X.index,q=W+X[0].length,U=1,z=q;while(z<Y.length&&U>0){if(Y[z]==="(")U++;else if(Y[z]===")")U--;z++}if(U!==0)continue;let j=Y.substring(q,z-1).trim(),H=z,B=DX(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let N=[B.itemVar,B.indexVar].filter(Boolean);if(N.length)G.push({start:W,end:F,vars:N})};if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N)){w();continue}let I=N.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>W>D.start&&W<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),A=R.match(TX),M;if(A){let[,N,I,T]=A;M=`<${N}${I} @for="${j}">${T}</${N}>`}else M=`<template @for="${j}">${R}</template>`;Q.push({start:W,end:F,replacement:M})}for(let K=Q.length-1;K>=0;K--){let{start:W,end:q,replacement:U}=Q[K];Y=Y.substring(0,W)+U+Y.substring(q)}return Y}function MH($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return Q},K=()=>{let U=J+2;while(U<Q&&$[U]!==`
9870
+ </body>`+$.slice(G+7)}var Y7=b(()=>{qX();R3()});var G7={};t(G7,{scanScriptTags:()=>DX,rewriteStxImportSpecifiers:()=>SX,processSignals:()=>G9,processScriptSetup:()=>kX,preEvalLiteralReactiveIfs:()=>X9,parseLoopExpression:()=>EX,hasSignalsSyntax:()=>Q7,findMarkupIndexOutsideScripts:()=>X7,extractExports:()=>bX,convertSignalLoopsToAttributes:()=>Q9,convertSignalDirectivesToAttributes:()=>J9});function DX($,Z={}){let Y=[];for(let J of z3($,k1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function EX($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=AX(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=AX(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function AX($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function Q7($){return n8($)}function OH($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function FH($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function LH($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function NX($,Z,Y){if(!$)return!1;let J=LH($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(MX.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=q.exec(J))!==null){let j=U[1];if(J.slice(0,U.index).trimEnd().endsWith("."))continue;if(MX.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function J7($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(IX);if(Q&&VH(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function VH($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function J9($,Z){let Y=FH($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,U=q+K[0].length,z=1,j=U;while(j<Q.length&&z>0){if(Q[j]==="(")z++;else if(Q[j]===")")z--;j++}if(z!==0)continue;let H=Q.substring(U,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(OH(V)){let R=w$(Q.substring(q,O));if(R.length===0)continue;let A=R[0].branches.filter((I)=>I.type!=="else");if(!(A.length>0&&A.every((I)=>NX(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=J(I.content);if(I.type==="elseif")return J7(T,"@else-if",I.condition??"");if(I.type==="else")return J7(T,"@else");return J7(T,"@if",I.condition??"")}).join(`
9871
+ `)}else{if(!NX(H,Y,Z))continue;w=J7(J(V),"@if",H)}W.push({start:q,end:O,replacement:w}),G.lastIndex=O}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Q=Q.substring(0,U)+j+Q.substring(z)}return Q}return J($)}function wH($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function RH($,Z,Y,J){if(Y9.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let H=$.indexOf("-->",W+4);if(H===-1)return-1;W=H+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let H=$.indexOf(">",W);if(H===-1)return-1;if($[H-1]==="/"){W=H+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!H){W++;continue}if(H[1].toLowerCase()===X){if(K--,W+=H[0].length,K===0)return W;continue}W+=H[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(z[1].toLowerCase()===X){let H=$.slice(W,j+1);if(!(/\/\s*>$/.test(H)||Y9.has(X)))K++}W=j+1}return-1}function MH($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return AH.test(Q)}function X9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(z)=>Z.some(([j,H])=>z>=j&&z<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[z,j,H,B,_,O,F]=K,L=wH(_);if(L===void 0)continue;let V=K.index,w=V+z.length,M=!!F||/\/\s*>$/.test(z)||Y9.has(j.toLowerCase())?w:RH($,V,j,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&MH($,M)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((z,j)=>z.start-j.start);let W=[],q=-1;for(let z of G){if(z.start<q)continue;W.push(z),q=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:j,end:H,replacement:B}=W[z];U=U.substring(0,j)+B+U.substring(H)}return U}function Q9($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[],G=[];while((X=J.exec(Y))!==null){let K=X[1],W=X.index,q=W+X[0].length,U=1,z=q;while(z<Y.length&&U>0){if(Y[z]==="(")U++;else if(Y[z]===")")U--;z++}if(U!==0)continue;let j=Y.substring(q,z-1).trim(),H=z,B=EX(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let N=[B.itemVar,B.indexVar].filter(Boolean);if(N.length)G.push({start:W,end:F,vars:N})};if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N)){w();continue}let I=N.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>W>D.start&&W<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),A=R.match(IX),M;if(A){let[,N,I,T]=A;M=`<${N}${I} @for="${j}">${T}</${N}>`}else M=`<template @for="${j}">${R}</template>`;Q.push({start:W,end:F,replacement:M})}for(let K=Q.length-1;K>=0;K--){let{start:W,end:q,replacement:U}=Q[K];Y=Y.substring(0,W)+U+Y.substring(q)}return Y}function NH($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return Q},K=()=>{let U=J+2;while(U<Q&&$[U]!==`
9872
9872
  `)U++;return U},W=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},q=(U)=>{let z=U,j=0;while(z<Q){let H=$[z];if(H==="/"&&$[z+1]==="/"){let B=z+2;while(B<Q&&$[B]!==`
9873
- `)B++;z=B;continue}if(H==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}z=B;continue}if(H==="("||H==="["||H==="{"){j++,z++;continue}if(H===")"||H==="]"||H==="}"){j--,z++;continue}if(H===";"&&j===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=K();Y.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();Y.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(J,z)),J=z;continue}if(U==="{"){X++,Y.push(U),J++;continue}if(U==="}"){X--,Y.push(U),J++;continue}if(X===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let H=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(J+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),Y.push($.slice(J,_)),J=_;continue}}}Y.push(U),J++}return Y.join("")}async function EX($,Z,Y){let J=IX($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let F=O.body;if(t1(O.attrs))F=e1(F);if(X.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${HH++}`,{hasUserImports:K,bundleClientScript:W}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$))),q=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=M5(F).code,K(F))F=await W(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>bX(w));let L=g0(F);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9873
+ `)B++;z=B;continue}if(H==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}z=B;continue}if(H==="("||H==="["||H==="{"){j++,z++;continue}if(H===")"||H==="]"||H==="}"){j--,z++;continue}if(H===";"&&j===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=K();Y.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();Y.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(J,z)),J=z;continue}if(U==="{"){X++,Y.push(U),J++;continue}if(U==="}"){X--,Y.push(U),J++;continue}if(X===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let H=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(J+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),Y.push($.slice(J,_)),J=_;continue}}}Y.push(U),J++}return Y.join("")}async function kX($,Z,Y){let J=DX($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let F=O.body;if(t1(O.attrs))F=e1(F);if(X.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${_H++}`,{hasUserImports:K,bundleClientScript:W}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$))),q=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=M5(F).code,K(F))F=await W(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>SX(w));let L=h0(F);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9874
9874
  ${L}`)}let U=q.join(`
9875
9875
 
9876
- `);U=MH(U);let z=kX(U),j=z.split(",").map((O)=>O.trim()).filter(Boolean),H=e$(U,Y),B=`
9876
+ `);U=NH(U);let z=bX(U),j=z.split(",").map((O)=>O.trim()).filter(Boolean),H=e$(U,Y),B=`
9877
9877
  <script data-stx-scoped>
9878
9878
  function ${G}() {
9879
9879
  ${w5("const",j)}
@@ -9882,26 +9882,26 @@ ${R5(`${H}${U}`)}
9882
9882
  }
9883
9883
  window.__stx_latestSetup=${G};
9884
9884
  if(window.stx)window.stx._latestSetup=${G};
9885
- </script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${wX})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],F=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${wX})>`,"gi"),(L,V,w)=>{if(F||O.includes(V.toLowerCase()))return L;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:_,setupCode:B}}function kX($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
9885
+ </script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${RX})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],F=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${RX})>`,"gi"),(L,V,w)=>{if(F||O.includes(V.toLowerCase()))return L;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:_,setupCode:B}}function bX($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
9886
9886
  `)return;Q++}},q=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},z=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")z();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9887
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!J.has(V))Y.push(V),J.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),M=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(M&&!J.has(M))Y.push(M),J.add(M)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){z(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function G9($,Z,Y,J){if(!Q7($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await EX(X,Y,J);if(X=Q,X=await Z7(X,Z),G){let U=X7(X,/<\/head>/i),z=U===-1?X7(X,/<body[^>]*>/i):-1;if(U!==-1)X=`${X.slice(0,U)}${G}
9887
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!J.has(V))Y.push(V),J.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),M=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(M&&!J.has(M))Y.push(M),J.add(M)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){z(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function G9($,Z,Y,J){if(!Q7($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await kX(X,Y,J);if(X=Q,X=await Z7(X,Z),G){let U=X7(X,/<\/head>/i),z=U===-1?X7(X,/<body[^>]*>/i):-1;if(U!==-1)X=`${X.slice(0,U)}${G}
9888
9888
  ${X.slice(U)}`;else if(z!==-1){let j=/<body[^>]*>/i.exec(X.slice(z))[0],H=z+j.length;X=`${X.slice(0,H)}
9889
9889
  ${G}${X.slice(H)}`}else X=`${X}
9890
- ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=X7(X,U);if(z!==-1){let j=X.slice(0,z),H=X.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function X7($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([U,z])=>W>=U&&W<z))return W;G=W+Math.max(K[0].length,1)}return-1}function bX($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return NX;return`var ${Z.join(", ")}; ${NX}`}var HH=0,wX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,TX,AX,Y9,RH,NX="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var C$=b(()=>{N5();F4();Q1();J3();M0();Y7();$5();X$();TX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;AX=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);Y9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);RH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import p5 from"path";function SX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function yX($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=p5.join(X,$);if(await Bun.file(G).exists())return G;X=p5.dirname(X)}J=p5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=p5.resolve(Z,$);else J=p5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function PX($,Z,Y){let J=$,X=p5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,U,z,j]=G;if(SX(z))continue;let H=await yX(z,X,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:P0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
9890
+ ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=X7(X,U);if(z!==-1){let j=X.slice(0,z),H=X.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function X7($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([U,z])=>W>=U&&W<z))return W;G=W+Math.max(K[0].length,1)}return-1}function SX($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return TX;return`var ${Z.join(", ")}; ${TX}`}var _H=0,RX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,IX,MX,Y9,AH,TX="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var C$=b(()=>{N5();F4();Q1();J3();M0();Y7();$5();X$();IX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;MX=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);Y9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);AH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import p5 from"path";function yX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function PX($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=p5.join(X,$);if(await Bun.file(G).exists())return G;X=p5.dirname(X)}J=p5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=p5.resolve(Z,$);else J=p5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function CX($,Z,Y){let J=$,X=p5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,U,z,j]=G;if(yX(z))continue;let H=await PX(z,X,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:P0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
9891
9891
  // Source: ${z}
9892
9892
  ${B}
9893
- </script>`;J=J.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[q,U,z,j]=W,H=U+j;if(SX(z))continue;if(/rel=["']stylesheet["']/.test(H)||z.endsWith(".css")){let _=await yX(z,X,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
9893
+ </script>`;J=J.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[q,U,z,j]=W,H=U+j;if(yX(z))continue;if(/rel=["']stylesheet["']/.test(H)||z.endsWith(".css")){let _=await PX(z,X,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
9894
9894
  /* Source: ${z} */
9895
9895
  ${O}
9896
- </style>`;J=J.replace(q,F),K.lastIndex=0}catch(O){}}}return J}var CX=b(()=>{E1()});function K9($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,U=!1;while(W<Y.length&&K>0){let V=Y[W];if(U){U=!1,W++;continue}if(V==="\\"&&q){U=!0,W++;continue}if(q){if(V===q)q=null;W++;continue}if(V==='"'||V==="'"||V==="`"){q=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let z=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?z.substring(0,H).trim():z,L=H>=0?z.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(W0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(W+1),J.lastIndex=Q+A.length}catch(V){Z1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function W9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vX($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),U=W,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let H=z.slice(0,j),B=U+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[M,N,I="",T]=R,k=`<${N}${I} data-stx-memo="${q}"${T}>`;A=H.slice(0,O)+k+w.slice(M.length)+H.slice(O+w.length)}else A=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:A}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function q9($){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 xX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,U=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,U)+" x-cloak>",X=U+1}return J+=$.slice(X),J}function fX($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,U=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(Q+X[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!NH.test(z))continue;let j=$[U-1]==="/",H=j?U-1:U;Y+=`${$.slice(J,H)} x-cloak${j?" ":""}`,J=H}return Y+=$.slice(J),Y}var NH;var U9=b(()=>{V1();V0();NH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z9($,Z,Y,J){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of TH){if(Q.some((z)=>/\w/.test(z)&&W.includes(z)))continue;K.lastIndex=0;let U=$.match(K);if(U&&U.length>0){let z=$.split(`
9896
+ </style>`;J=J.replace(q,F),K.lastIndex=0}catch(O){}}}return J}var vX=b(()=>{E1()});function K9($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,U=!1;while(W<Y.length&&K>0){let V=Y[W];if(U){U=!1,W++;continue}if(V==="\\"&&q){U=!0,W++;continue}if(q){if(V===q)q=null;W++;continue}if(V==='"'||V==="'"||V==="`"){q=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let z=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?z.substring(0,H).trim():z,L=H>=0?z.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(W0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(W+1),J.lastIndex=Q+A.length}catch(V){Z1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function W9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function xX($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),U=W,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let H=z.slice(0,j),B=U+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[M,N,I="",T]=R,k=`<${N}${I} data-stx-memo="${q}"${T}>`;A=H.slice(0,O)+k+w.slice(M.length)+H.slice(O+w.length)}else A=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:A}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function q9($){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 fX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,U=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,U)+" x-cloak>",X=U+1}return J+=$.slice(X),J}function gX($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,U=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(Q+X[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!TH.test(z))continue;let j=$[U-1]==="/",H=j?U-1:U;Y+=`${$.slice(J,H)} x-cloak${j?" ":""}`,J=H}return Y+=$.slice(J),Y}var TH;var U9=b(()=>{V1();V0();TH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z9($,Z,Y,J){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of IH){if(Q.some((z)=>/\w/.test(z)&&W.includes(z)))continue;K.lastIndex=0;let U=$.match(K);if(U&&U.length>0){let z=$.split(`
9897
9897
  `),j=[];z.forEach((O,F)=>{if(K.lastIndex=0,K.test(O))j.push(F+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",B=j.slice(0,3).map((O)=>` ${O} | ${(z[O-1]??"").trim().slice(0,100)}`).join(`
9898
9898
  `),_=B?`
9899
9899
  ${B}`:"";G.push(` \u2717 ${W}${H}
9900
9900
  \u2192 ${q}${_}`)}}if(G.length>0&&X.enabled){let K=(U)=>{let z=`${process.cwd()}/`;return U.startsWith(z)?U.slice(z.length):U},q=`[STX] DOM API violation in ${J&&J!==Z?`${K(J)} (composed into ${K(Z)})`:K(Z)}:
9901
9901
  ${G.join(`
9902
9902
  `)}
9903
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var TH;var j9=b(()=>{TH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import IH from"fs";function K7($){return[...$].sort().map((Z)=>{try{let Y=IH.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
9904
- `)}function W7($,Z,Y){let J=$.get(Z);return J!==void 0&&J.signature===Y?J.value:void 0}function U1($,Z,Y,J){return $.set(Z,{signature:Y,value:J}),J}var B9=()=>{};var gX={};t(gX,{getStoreScript:()=>EH,clearStoreCache:()=>kH});import q7 from"path";function DH($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Y[1]??"").split(",")){let Q=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Y[1]??"").split(",")){let X=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function EH($){let Z;if($)Z=q7.resolve($);else{let B=await u1();Z=q7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),J=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=q7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return U1(c5,Z,"",""),null}let X=K7(J),Q=W7(c5,Z,X);if(Q!==void 0)return Q||null;if(J.length===0)return U1(c5,Z,X,""),null;let G=[];for(let B of J){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),W=[],q=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()});for(let B of K)try{let _=await Bun.file(B).text(),O=q7.basename(B,".ts");DH(_,q),_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${O}
9903
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var IH;var j9=b(()=>{IH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import DH from"fs";function K7($){return[...$].sort().map((Z)=>{try{let Y=DH.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
9904
+ `)}function W7($,Z,Y){let J=$.get(Z);return J!==void 0&&J.signature===Y?J.value:void 0}function U1($,Z,Y,J){return $.set(Z,{signature:Y,value:J}),J}var B9=()=>{};var hX={};t(hX,{getStoreScript:()=>kH,clearStoreCache:()=>bH});import q7 from"path";function EH($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Y[1]??"").split(",")){let Q=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Y[1]??"").split(",")){let X=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function kH($){let Z;if($)Z=q7.resolve($);else{let B=await u1();Z=q7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),J=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=q7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return U1(c5,Z,"",""),null}let X=K7(J),Q=W7(c5,Z,X);if(Q!==void 0)return Q||null;if(J.length===0)return U1(c5,Z,X,""),null;let G=[];for(let B of J){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),W=[],q=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()});for(let B of K)try{let _=await Bun.file(B).text(),O=q7.basename(B,".ts");EH(_,q),_=h0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${O}
9905
9905
  ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return U1(c5,Z,X,""),null;let z=W.join(`
9906
9906
 
9907
9907
  `),H=`;(function(){
@@ -9909,8 +9909,8 @@ var __stx = window.stx || {};
9909
9909
  ${_1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(z)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
9910
9910
  `)}
9911
9911
  ${z}
9912
- })();`;return U1(c5,Z,X,H),H}function kH(){c5.clear()}var c5;var hX=b(()=>{O1();E1();Q1();B9();c5=new Map});var H9,XT;var uX=b(()=>{H9=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],XT=new Set(H9)});var lX={};t(lX,{selectComposableFiles:()=>mX,referencedFrameworkComposables:()=>dX,getFrameworkComposableScript:()=>PH,clearFrameworkComposableCache:()=>SH,__setRuntimeOwnedForTest:()=>CH});import U7 from"path";function SH(){v$.clear()}function mX($){let Z=new Map;for(let Y of $){let J=U7.basename(Y);if(J.endsWith(".d.ts"))continue;let X=J.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===J)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,Y)}return[...Z.values()].sort()}function yH($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function dX($){if(!$)return[];let Z=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=[];for(let J of bH){if(_9.has(J))continue;let X=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))Y.push(J)}return Y.sort()}async function PH($,Z){let Y=dX($);if(Y.length===0)return null;let J=Z??U7.join(import.meta.dir,"composables"),X=`${J}\x00${Y.join(",")}`,Q=v$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),K=new Set(Y),W=[],q=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:J,absolute:!0}))U.push(_)}catch{return v$.set(X,""),null}U=mX(U);for(let B of U){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${U7.basename(B).replace(/\.[jt]s$/,"")}
9913
- ${G.transformSync(_).trim()}`);for(let F of O)q.add(F)}catch(F){console.warn(`[stx] framework composable ${U7.basename(B)} could not be bundled:`,F)}}let z=Y.filter((B)=>!q.has(B)&&!yH($,B));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return v$.set(X,""),null;let j=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
9912
+ })();`;return U1(c5,Z,X,H),H}function bH(){c5.clear()}var c5;var uX=b(()=>{O1();E1();Q1();B9();c5=new Map});var H9,QT;var mX=b(()=>{H9=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],QT=new Set(H9)});var pX={};t(pX,{selectComposableFiles:()=>dX,referencedFrameworkComposables:()=>lX,getFrameworkComposableScript:()=>CH,clearFrameworkComposableCache:()=>yH,__setRuntimeOwnedForTest:()=>vH});import U7 from"path";function yH(){v$.clear()}function dX($){let Z=new Map;for(let Y of $){let J=U7.basename(Y);if(J.endsWith(".d.ts"))continue;let X=J.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===J)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,Y)}return[...Z.values()].sort()}function PH($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function lX($){if(!$)return[];let Z=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=[];for(let J of SH){if(_9.has(J))continue;let X=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))Y.push(J)}return Y.sort()}async function CH($,Z){let Y=lX($);if(Y.length===0)return null;let J=Z??U7.join(import.meta.dir,"composables"),X=`${J}\x00${Y.join(",")}`,Q=v$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),K=new Set(Y),W=[],q=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:J,absolute:!0}))U.push(_)}catch{return v$.set(X,""),null}U=dX(U);for(let B of U){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${U7.basename(B).replace(/\.[jt]s$/,"")}
9913
+ ${G.transformSync(_).trim()}`);for(let F of O)q.add(F)}catch(F){console.warn(`[stx] framework composable ${U7.basename(B)} could not be bundled:`,F)}}let z=Y.filter((B)=>!q.has(B)&&!PH($,B));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return v$.set(X,""),null;let j=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
9914
9914
  `),H=`<script data-stx-framework-composables>
9915
9915
  ;(function(){
9916
9916
  var __s = window.stx = window.stx || {};
@@ -9919,7 +9919,7 @@ ${W.join(`
9919
9919
  `)}
9920
9920
  ${j}
9921
9921
  })();
9922
- </script>`;return v$.set(X,H),H}function CH($){_9.clear();for(let Z of $)_9.add(Z)}var v$,_9,bH;var pX=b(()=>{E1();uX();v$=new Map,_9=new Set,bH=new Set(H9)});var iX={};t(iX,{getComposableScript:()=>gH,clearComposableCache:()=>hH});import x$ from"path";function cX($){let Z=x$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function xH($){if($)return x$.resolve($);let Z=`<default>:${process.cwd()}`,Y=O9.get(Z);if(Y!==void 0)return Y;let J=await fH();if(J!==null)O9.set(Z,J);return J}async function fH(){let $=await u1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return x$.resolve(Z,Y);for(let J of vH){let X=x$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!cX(G))return X}catch{}}return null}async function gH($){let Z=await xH($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cX(_))continue;Y.push(_)}}catch{return U1(i5,Z,"",""),null}let J=K7(Y),X=W7(i5,Z,J);if(X!==void 0)return X||null;if(Y.length===0)return U1(i5,Z,J,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),G=[],K=new Set,W=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=x$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])W.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
9922
+ </script>`;return v$.set(X,H),H}function vH($){_9.clear();for(let Z of $)_9.add(Z)}var v$,_9,SH;var cX=b(()=>{E1();mX();v$=new Map,_9=new Set,SH=new Set(H9)});var nX={};t(nX,{getComposableScript:()=>hH,clearComposableCache:()=>uH});import x$ from"path";function iX($){let Z=x$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function fH($){if($)return x$.resolve($);let Z=`<default>:${process.cwd()}`,Y=O9.get(Z);if(Y!==void 0)return Y;let J=await gH();if(J!==null)O9.set(Z,J);return J}async function gH(){let $=await u1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return x$.resolve(Z,Y);for(let J of xH){let X=x$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!iX(G))return X}catch{}}return null}async function hH($){let Z=await fH($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(iX(_))continue;Y.push(_)}}catch{return U1(i5,Z,"",""),null}let J=K7(Y),X=W7(i5,Z,J);if(X!==void 0)return X||null;if(Y.length===0)return U1(i5,Z,J,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),G=[],K=new Set,W=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=x$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])W.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=h0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
9923
9923
  ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return U1(i5,Z,J,""),null;let q=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
9924
9924
  `),U=JSON.stringify([...K]),z=G.join(`
9925
9925
 
@@ -9944,7 +9944,7 @@ ${q}
9944
9944
  }
9945
9945
  window[__n] = __c[__n];
9946
9946
  }
9947
- })();`;return U1(i5,Z,J,H),H}function hH(){i5.clear(),O9.clear()}var i5,O9,vH;var nX=b(()=>{O1();E1();B9();Q1();i5=new Map,O9=new Map,vH=["composables","functions"]});var oX={};t(oX,{processDeferDirectives:()=>pH});function uH(){return`stx-defer-${++sX}`}function mH($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function dH($,Z,Y){let{trigger:J,value:X}=mH(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)W=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function lH($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9947
+ })();`;return U1(i5,Z,J,H),H}function uH(){i5.clear(),O9.clear()}var i5,O9,xH;var sX=b(()=>{O1();E1();B9();Q1();i5=new Map,O9=new Map,xH=["composables","functions"]});var rX={};t(rX,{processDeferDirectives:()=>cH});function mH(){return`stx-defer-${++oX}`}function dH($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function lH($,Z,Y){let{trigger:J,value:X}=dH(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)W=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function pH($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9948
9948
  const observer = new IntersectionObserver((entries) => {
9949
9949
  if (entries[0].isIntersecting) {
9950
9950
  observer.disconnect();
@@ -10017,7 +10017,7 @@ else {
10017
10017
  ${X}
10018
10018
  })();
10019
10019
  </script>
10020
- `}function pH($,Z,Y){sX=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=uH(),W=dH(X,Q,G),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",U=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",j=`<div data-defer-content style="display: none;">${W.content}</div>`,H=lH(K,W);return`
10020
+ `}function cH($,Z,Y){oX=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=mH(),W=lH(X,Q,G),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",U=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",j=`<div data-defer-content style="display: none;">${W.content}</div>`,H=pH(K,W);return`
10021
10021
  <div id="${K}" class="stx-defer" data-defer-trigger="${W.trigger}">
10022
10022
  ${q}
10023
10023
  ${U}
@@ -10025,7 +10025,7 @@ else {
10025
10025
  ${z}
10026
10026
  </div>
10027
10027
  ${H}
10028
- `})}var sX=0;var aX={};t(aX,{processTeleportDirectives:()=>sH,ensureTeleportTargets:()=>oH});function cH(){return`stx-teleport-${++rX}`}function iH($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function nH($,Z){return`
10028
+ `})}var oX=0;var tX={};t(tX,{processTeleportDirectives:()=>oH,ensureTeleportTargets:()=>rH});function iH(){return`stx-teleport-${++aX}`}function nH($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function sH($,Z){return`
10029
10029
  <script>
10030
10030
  (function() {
10031
10031
  const source = document.getElementById('${$}');
@@ -10071,12 +10071,12 @@ else {
10071
10071
  });
10072
10072
  })();
10073
10073
  </script>
10074
- `}function sH($,Z,Y){rX=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=cH(),{target:W,disabled:q}=iH(Q),U=G.trim();if(q)try{let j=!1;if(q==="true")j=!0;else if(q==="false")j=!1;else if(q in Z)j=Boolean(Z[q]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=nH(K,W);return`
10074
+ `}function oH($,Z,Y){aX=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=iH(),{target:W,disabled:q}=nH(Q),U=G.trim();if(q)try{let j=!1;if(q==="true")j=!0;else if(q==="false")j=!1;else if(q in Z)j=Boolean(Z[q]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=sH(K,W);return`
10075
10075
  <div id="${K}" class="stx-teleport-source" style="display: none;">
10076
10076
  <template>${U}</template>
10077
10077
  </div>
10078
10078
  ${z}
10079
- `})}function oH(){return`
10079
+ `})}function rH(){return`
10080
10080
  <script>
10081
10081
  (function() {
10082
10082
  // Common teleport targets
@@ -10093,7 +10093,7 @@ else {
10093
10093
  });
10094
10094
  })();
10095
10095
  </script>
10096
- `}var rX=0;var ZQ={};t(ZQ,{processTransitionDirectives:()=>eH,processTransitionAttributes:()=>J_,performLeave:()=>tH,performEnter:()=>aH,generateTransitionRuntime:()=>Y_,generateTransitionCSS:()=>Z_});function tX($,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 rH($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function eX($,Z){return new Promise((Y)=>{let J=Z??rH($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function $Q($){$.offsetHeight}async function aH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),$Q($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await eX($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function tH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),$Q($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await eX($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function eH($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=$_(Q),W=K.name||"stx",q=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10096
+ `}var aX=0;var YQ={};t(YQ,{processTransitionDirectives:()=>$_,processTransitionAttributes:()=>X_,performLeave:()=>eH,performEnter:()=>tH,generateTransitionRuntime:()=>J_,generateTransitionCSS:()=>Y_});function eX($,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 aH($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function $Q($,Z){return new Promise((Y)=>{let J=Z??aH($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function ZQ($){$.offsetHeight}async function tH($,Z={}){let Y=Z.name||"stx",J=eX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),ZQ($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await $Q($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function eH($,Z={}){let Y=Z.name||"stx",J=eX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),ZQ($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await $Q($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function $_($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=Z_(Q),W=K.name||"stx",q=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10097
10097
  <div
10098
10098
  class="stx-transition-wrapper"
10099
10099
  data-transition="${W}"
@@ -10135,7 +10135,7 @@ else {
10135
10135
  });
10136
10136
  })();
10137
10137
  </script>
10138
- `})}function $_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function Z_(){return`
10138
+ `})}function Z_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function Y_(){return`
10139
10139
  /* STX Transition Presets */
10140
10140
 
10141
10141
  /* Fade */
@@ -10322,7 +10322,7 @@ else {
10322
10322
  opacity: 1;
10323
10323
  max-height: 1000px;
10324
10324
  }
10325
- `}function Y_(){return`
10325
+ `}function J_(){return`
10326
10326
  // STX Transition Runtime
10327
10327
  (function() {
10328
10328
  if (typeof window === 'undefined') return;
@@ -10411,7 +10411,7 @@ else {
10411
10411
 
10412
10412
  console.log('[stx] Transition runtime initialized');
10413
10413
  })();
10414
- `}function J_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var JQ={};t(JQ,{withErrorBoundary:()=>YQ,processErrorBoundaryDirectives:()=>G_,generateErrorBoundaryRuntime:()=>z_,generateErrorBoundaryCSS:()=>U_,createErrorBoundary:()=>q_});function Q_(){return`eb-${++X_}-${Date.now().toString(36)}`}function G_($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q_(),q=K_(Q||"");return W_(W,G.trim(),K.trim(),q)})}function K_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function W_($,Z,Y,J){let X=J.logErrors!==!1;return`
10414
+ `}function X_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var XQ={};t(XQ,{withErrorBoundary:()=>JQ,processErrorBoundaryDirectives:()=>K_,generateErrorBoundaryRuntime:()=>j_,generateErrorBoundaryCSS:()=>z_,createErrorBoundary:()=>U_});function G_(){return`eb-${++Q_}-${Date.now().toString(36)}`}function K_($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=G_(),q=W_(Q||"");return q_(W,G.trim(),K.trim(),q)})}function W_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function q_($,Z,Y,J){let X=J.logErrors!==!1;return`
10415
10415
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
10416
10416
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
10417
10417
  ${Z}
@@ -10531,7 +10531,7 @@ else {
10531
10531
  };
10532
10532
  })();
10533
10533
  </script>
10534
- `}async function YQ($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function q_($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>YQ(J,$,Y)}function U_(){return`
10534
+ `}async function JQ($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function U_($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>JQ(J,$,Y)}function z_(){return`
10535
10535
  /* STX Error Boundary Styles */
10536
10536
  .stx-error-boundary {
10537
10537
  position: relative;
@@ -10575,7 +10575,7 @@ else {
10575
10575
  color: #fecaca;
10576
10576
  }
10577
10577
  }
10578
- `}function z_(){return`
10578
+ `}function j_(){return`
10579
10579
  // STX Error Boundary Runtime
10580
10580
  (function() {
10581
10581
  if (typeof window === 'undefined') return;
@@ -10640,7 +10640,7 @@ else {
10640
10640
 
10641
10641
  console.log('[stx] Error boundary runtime initialized');
10642
10642
  })();
10643
- `}var X_=0;var XQ={};t(XQ,{renderSSRSuspense:()=>L_,processSuspenseDirectives:()=>H_,generateSuspenseRuntime:()=>w_,generateSuspenseCSS:()=>V_,createSSRSuspense:()=>F_});function B_(){return`suspense-${++j_}-${Date.now().toString(36)}`}function H_($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=B_(),q=__(Q||"");return O_(W,G.trim(),K.trim(),q)})}function __($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function O_($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10643
+ `}var Q_=0;var QQ={};t(QQ,{renderSSRSuspense:()=>V_,processSuspenseDirectives:()=>__,generateSuspenseRuntime:()=>R_,generateSuspenseCSS:()=>w_,createSSRSuspense:()=>L_});function H_(){return`suspense-${++B_}-${Date.now().toString(36)}`}function __($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=H_(),q=O_(Q||"");return F_(W,G.trim(),K.trim(),q)})}function O_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function F_($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10644
10644
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
10645
10645
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10646
10646
  ${Y}
@@ -10830,7 +10830,7 @@ else {
10830
10830
  }, 0);
10831
10831
  })();
10832
10832
  </script>
10833
- `}function F_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function L_($){let Z=$.map((J)=>`
10833
+ `}function L_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function V_($){let Z=$.map((J)=>`
10834
10834
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
10835
10835
  ${J.fallback}
10836
10836
  </div>
@@ -10855,7 +10855,7 @@ else {
10855
10855
  }
10856
10856
  })();
10857
10857
  </script>
10858
- `}}return{initial:Z,streaming:Y()}}function V_(){return`
10858
+ `}}return{initial:Z,streaming:Y()}}function w_(){return`
10859
10859
  /* STX Suspense Styles */
10860
10860
  .stx-suspense {
10861
10861
  position: relative;
@@ -10911,7 +10911,7 @@ else {
10911
10911
  background-size: 200% 100%;
10912
10912
  }
10913
10913
  }
10914
- `}function w_(){return`
10914
+ `}function R_(){return`
10915
10915
  // STX Suspense Runtime
10916
10916
  (function() {
10917
10917
  if (typeof window === 'undefined') return;
@@ -10978,7 +10978,7 @@ else {
10978
10978
 
10979
10979
  console.log('[stx] Suspense runtime initialized');
10980
10980
  })();
10981
- `}var j_=0;var WQ={};t(WQ,{processAsyncDirectives:()=>A_,isAsyncComponent:()=>N_,generateAsyncComponentRuntime:()=>I_,generateAsyncComponentCSS:()=>T_,defineAsyncComponent:()=>M_});function QQ(){return`async-${++R_}-${Date.now().toString(36)}`}function A_($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let U=QQ(),z=GQ(K);return KQ(U,z,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=QQ(),U=GQ(K);return KQ(q,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function GQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function KQ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10981
+ `}var B_=0;var qQ={};t(qQ,{processAsyncDirectives:()=>M_,isAsyncComponent:()=>T_,generateAsyncComponentRuntime:()=>D_,generateAsyncComponentCSS:()=>I_,defineAsyncComponent:()=>N_});function GQ(){return`async-${++A_}-${Date.now().toString(36)}`}function M_($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let U=GQ(),z=KQ(K);return WQ(U,z,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=GQ(),U=KQ(K);return WQ(q,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function KQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function WQ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10982
10982
  <div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
10983
10983
  <div class="stx-async-loading" data-async-loading="${$}">
10984
10984
  ${Y}
@@ -11205,7 +11205,7 @@ catch (error) {
11205
11205
  loadComponent();
11206
11206
  })();
11207
11207
  </script>
11208
- `}function M_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function N_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function T_(){return`
11208
+ `}function N_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function T_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function I_(){return`
11209
11209
  /* STX Async Component Styles */
11210
11210
  .stx-async-component {
11211
11211
  position: relative;
@@ -11279,7 +11279,7 @@ catch (error) {
11279
11279
  background-size: 200% 100%;
11280
11280
  }
11281
11281
  }
11282
- `}function I_(){return`
11282
+ `}function D_(){return`
11283
11283
  // STX Async Component Runtime
11284
11284
  (function() {
11285
11285
  if (typeof window === 'undefined') return;
@@ -11333,7 +11333,7 @@ catch (error) {
11333
11333
 
11334
11334
  console.log('[stx] Async component runtime initialized');
11335
11335
  })();
11336
- `}var R_=0;var UQ={};t(UQ,{shouldCacheComponent:()=>y_,processKeepAliveDirectives:()=>E_,onDeactivated:()=>x_,onActivated:()=>v_,generateKeepAliveRuntime:()=>C_,generateKeepAliveCSS:()=>P_,createKeepAliveCache:()=>S_});function qQ(){return`keep-alive-${++D_}-${Date.now().toString(36)}`}function E_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=qQ(),W=k_(Q||"");return b_(K,G.trim(),W)})}function k_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function b_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
11336
+ `}var A_=0;var zQ={};t(zQ,{shouldCacheComponent:()=>P_,processKeepAliveDirectives:()=>k_,onDeactivated:()=>f_,onActivated:()=>x_,generateKeepAliveRuntime:()=>v_,generateKeepAliveCSS:()=>C_,createKeepAliveCache:()=>y_});function UQ(){return`keep-alive-${++E_}-${Date.now().toString(36)}`}function k_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=UQ(),W=b_(Q||"");return S_(K,G.trim(),W)})}function b_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function S_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
11337
11337
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
11338
11338
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
11339
11339
  ${Z}
@@ -11620,7 +11620,7 @@ else {
11620
11620
  });
11621
11621
  })();
11622
11622
  </script>
11623
- `}function S_($={}){return{id:$.id||qQ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function y_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function P_(){return`
11623
+ `}function y_($={}){return{id:$.id||UQ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function P_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function C_(){return`
11624
11624
  /* STX Keep-Alive Styles */
11625
11625
  .stx-keep-alive {
11626
11626
  position: relative;
@@ -11645,7 +11645,7 @@ else {
11645
11645
  .stx-keep-alive-content > [data-activated] {
11646
11646
  opacity: 1;
11647
11647
  }
11648
- `}function C_(){return`
11648
+ `}function v_(){return`
11649
11649
  // STX Keep-Alive Runtime
11650
11650
  (function() {
11651
11651
  if (typeof window === 'undefined') return;
@@ -11681,7 +11681,7 @@ else {
11681
11681
 
11682
11682
  console.log('[stx] Keep-alive runtime initialized');
11683
11683
  })();
11684
- `}function v_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function x_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var D_=0;var _Q={};t(_Q,{useVirtualList:()=>jQ,processVirtualListDirectives:()=>L9,processVirtualGridDirectives:()=>HQ,processInfiniteListDirectives:()=>BQ,generateVirtualListCSS:()=>zQ,default:()=>f_,createVirtualList:()=>F9});function F9($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],U=0,z=new Map;function j(){if(G)return H();let A=Math.max(0,Math.floor(U/Y)-X),M=Math.ceil(J/Y),N=Math.min(q.length-1,A+M+X*2);return{startIndex:A,endIndex:N}}function H(){let A=0,M=0,N=q.length-1;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+T>U){M=Math.max(0,I-X);break}A+=T}A=0;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+=T,A>U+J){N=Math.min(q.length-1,I+X);break}}return{startIndex:M,endIndex:N}}function B(){if(G){let A=0;for(let M=0;M<q.length;M++)A+=z.get(M)||K;return A}return q.length*Y}function _(A){if(G){let M=0;for(let N=0;N<A;N++)M+=z.get(N)||K;return M}return A*Y}function O(){let{startIndex:A,endIndex:M}=j();return{startIndex:A,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:q.slice(A,M+1),itemHeights:new Map(z)}}function F(A,M="auto"){let N=_(A);L(N,M)}function L(A,M="auto"){U=Math.max(0,Math.min(A,B()-J))}function V(){j()}function w(A){q=[...A],z.clear(),V()}function R(){q=[],z.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function L9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),H=U.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let L=B;L<=_&&L<q.length;L++){let V=q[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
11684
+ `}function x_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function f_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var E_=0;var OQ={};t(OQ,{useVirtualList:()=>BQ,processVirtualListDirectives:()=>L9,processVirtualGridDirectives:()=>_Q,processInfiniteListDirectives:()=>HQ,generateVirtualListCSS:()=>jQ,default:()=>g_,createVirtualList:()=>F9});function F9($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],U=0,z=new Map;function j(){if(G)return H();let A=Math.max(0,Math.floor(U/Y)-X),M=Math.ceil(J/Y),N=Math.min(q.length-1,A+M+X*2);return{startIndex:A,endIndex:N}}function H(){let A=0,M=0,N=q.length-1;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+T>U){M=Math.max(0,I-X);break}A+=T}A=0;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+=T,A>U+J){N=Math.min(q.length-1,I+X);break}}return{startIndex:M,endIndex:N}}function B(){if(G){let A=0;for(let M=0;M<q.length;M++)A+=z.get(M)||K;return A}return q.length*Y}function _(A){if(G){let M=0;for(let N=0;N<A;N++)M+=z.get(N)||K;return M}return A*Y}function O(){let{startIndex:A,endIndex:M}=j();return{startIndex:A,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:q.slice(A,M+1),itemHeights:new Map(z)}}function F(A,M="auto"){let N=_(A);L(N,M)}function L(A,M="auto"){U=Math.max(0,Math.min(A,B()-J))}function V(){j()}function w(A){q=[...A],z.clear(),V()}function R(){q=[],z.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function L9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),H=U.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let L=B;L<=_&&L<q.length;L++){let V=q[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
11685
11685
  <div class="virtual-item ${U.itemClass||""}"
11686
11686
  style="position: absolute; top: ${L*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11687
11687
  data-index="${L}">
@@ -11758,7 +11758,7 @@ else {
11758
11758
  };
11759
11759
  })();
11760
11760
  </script>
11761
- `})}function zQ(){return`
11761
+ `})}function jQ(){return`
11762
11762
  .virtual-list-container {
11763
11763
  position: relative;
11764
11764
  overflow-y: auto;
@@ -11806,7 +11806,7 @@ else {
11806
11806
  0% { background-position: 200% 0; }
11807
11807
  100% { background-position: -200% 0; }
11808
11808
  }
11809
- `}function jQ($,Z){let Y=null,J=()=>{if(!Y)Y=F9($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function BQ($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let q=Q.trim(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,H=L9(`@virtualList(${q}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return H=H.replace("</script>",`
11809
+ `}function BQ($,Z){let Y=null,J=()=>{if(!Y)Y=F9($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function HQ($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let q=Q.trim(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,H=L9(`@virtualList(${q}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return H=H.replace("</script>",`
11810
11810
  // Infinite scroll detection
11811
11811
  container.addEventListener('scroll', function() {
11812
11812
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11824,7 +11824,7 @@ else {
11824
11824
  ${W}
11825
11825
  </div>
11826
11826
  </div>
11827
- `})}function HQ($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.length/U.columns),H=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),_=U.overscan||2,O=0,F=Math.min(j-1,B+_),L="";for(let V=O;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=q.length)break;let A=q[R],M=w*(100/U.columns),N=V*(U.rowHeight+(U.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,k)=>{if(typeof A==="object"&&A!==null)return String(A[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));L+=`
11827
+ `})}function _Q($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.length/U.columns),H=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),_=U.overscan||2,O=0,F=Math.min(j-1,B+_),L="";for(let V=O;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=q.length)break;let A=q[R],M=w*(100/U.columns),N=V*(U.rowHeight+(U.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,k)=>{if(typeof A==="object"&&A!==null)return String(A[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));L+=`
11828
11828
  <div class="virtual-grid-item"
11829
11829
  style="position: absolute; top: ${N}px; left: ${M}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
11830
11830
  data-index="${R}">
@@ -11894,7 +11894,7 @@ else {
11894
11894
  });
11895
11895
  })();
11896
11896
  </script>
11897
- `})}var f_;var OQ=b(()=>{f_={createVirtualList:F9,processVirtualListDirectives:L9,processInfiniteListDirectives:BQ,processVirtualGridDirectives:HQ,generateVirtualListCSS:zQ,useVirtualList:jQ}});function FQ(){return`<script data-stx-hydration-runtime>
11897
+ `})}var g_;var FQ=b(()=>{g_={createVirtualList:F9,processVirtualListDirectives:L9,processInfiniteListDirectives:HQ,processVirtualGridDirectives:_Q,generateVirtualListCSS:jQ,useVirtualList:BQ}});function LQ(){return`<script data-stx-hydration-runtime>
11898
11898
  (function() {
11899
11899
  'use strict';
11900
11900
 
@@ -12054,7 +12054,7 @@ else {
12054
12054
  stxIslands.initIslands();
12055
12055
  }
12056
12056
  })();
12057
- </script>`}function LQ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function VQ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var bQ={};t(bQ,{processStaticDirectives:()=>EQ,processPartialHydrationDirectives:()=>RQ,onHydrated:()=>DQ,isHydrated:()=>IQ,hydrateIsland:()=>MQ,hydrateByStrategy:()=>NQ,hydrateAll:()=>TQ,generatePartialHydrationCSS:()=>AQ,generateIslandManifest:()=>kQ,default:()=>c_,createIslandRegistry:()=>wQ});function wQ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function g_($){return`
12057
+ </script>`}function VQ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function wQ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var SQ={};t(SQ,{processStaticDirectives:()=>kQ,processPartialHydrationDirectives:()=>AQ,onHydrated:()=>EQ,isHydrated:()=>DQ,hydrateIsland:()=>NQ,hydrateByStrategy:()=>TQ,hydrateAll:()=>IQ,generatePartialHydrationCSS:()=>MQ,generateIslandManifest:()=>bQ,default:()=>i_,createIslandRegistry:()=>RQ});function RQ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function h_($){return`
12058
12058
  <script data-hydrate="${$}">
12059
12059
  (function() {
12060
12060
  const island = document.querySelector('[data-island="${$}"]');
@@ -12065,7 +12065,7 @@ else {
12065
12065
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
12066
12066
  })();
12067
12067
  </script>
12068
- `}function h_($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
12068
+ `}function u_($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
12069
12069
  <script data-hydrate="${$}">
12070
12070
  (function() {
12071
12071
  const island = document.querySelector('[data-island="${$}"]');
@@ -12101,7 +12101,7 @@ else {
12101
12101
  }
12102
12102
  })();
12103
12103
  </script>
12104
- `}function u_($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
12104
+ `}function m_($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
12105
12105
  <script data-hydrate="${$}">
12106
12106
  (function() {
12107
12107
  const island = document.querySelector('[data-island="${$}"]');
@@ -12134,7 +12134,7 @@ else {
12134
12134
  }
12135
12135
  })();
12136
12136
  </script>
12137
- `}function m_($,Z){let Y=Z.media||"(min-width: 768px)";return`
12137
+ `}function d_($,Z){let Y=Z.media||"(min-width: 768px)";return`
12138
12138
  <script data-hydrate="${$}">
12139
12139
  (function() {
12140
12140
  const island = document.querySelector('[data-island="${$}"]');
@@ -12163,7 +12163,7 @@ else {
12163
12163
  }
12164
12164
  })();
12165
12165
  </script>
12166
- `}function d_($){return`
12166
+ `}function l_($){return`
12167
12167
  <script data-hydrate="${$}">
12168
12168
  (function() {
12169
12169
  const island = document.querySelector('[data-island="${$}"]');
@@ -12185,7 +12185,7 @@ else {
12185
12185
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
12186
12186
  })();
12187
12187
  </script>
12188
- `}function l_($,Z){let Y=Z.event||"stx:activate";return`
12188
+ `}function p_($,Z){let Y=Z.event||"stx:activate";return`
12189
12189
  <script data-hydrate="${$}">
12190
12190
  (function() {
12191
12191
  const island = document.querySelector('[data-island="${$}"]');
@@ -12206,9 +12206,9 @@ else {
12206
12206
  });
12207
12207
  })();
12208
12208
  </script>
12209
- `}function RQ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=n5(J,"load",Z),J=n5(J,"idle",Z),J=n5(J,"visible",Z),J=n5(J,"media",Z),J=p_(J),J=n5(J,"hover",Z),J=n5(J,"event",Z),X=Q&&J!==$,X)J+=`
12210
- `+FQ();return J}function n5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let _=Q.split(",").map((O)=>O.trim());for(let O of _){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=LQ(G.trim()),U=VQ(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(q)z.push(`data-component="${q}"`);let H=Object.keys(U).length>0?`
12211
- <script type="application/json" data-island-props="${W}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=g_(W);break;case"idle":B=h_(W,K);break;case"visible":B=u_(W,K);break;case"media":B=m_(W,K);break;case"hover":B=d_(W);break;case"event":B=l_(W,K);break}return`
12209
+ `}function AQ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=n5(J,"load",Z),J=n5(J,"idle",Z),J=n5(J,"visible",Z),J=n5(J,"media",Z),J=c_(J),J=n5(J,"hover",Z),J=n5(J,"event",Z),X=Q&&J!==$,X)J+=`
12210
+ `+LQ();return J}function n5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let _=Q.split(",").map((O)=>O.trim());for(let O of _){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=VQ(G.trim()),U=wQ(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(q)z.push(`data-component="${q}"`);let H=Object.keys(U).length>0?`
12211
+ <script type="application/json" data-island-props="${W}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=h_(W);break;case"idle":B=u_(W,K);break;case"visible":B=m_(W,K);break;case"media":B=d_(W,K);break;case"hover":B=l_(W);break;case"event":B=p_(W,K);break}return`
12212
12212
  <div data-island="${W}"
12213
12213
  data-strategy="${Z}"
12214
12214
  ${z.join(`
@@ -12218,7 +12218,7 @@ else {
12218
12218
  ${G.trim()}${H}
12219
12219
  </div>
12220
12220
  ${B}
12221
- `})}function p_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12221
+ `})}function c_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12222
12222
  <div data-island="${X}"
12223
12223
  data-strategy="only"
12224
12224
  class="stx-island stx-client-only">
@@ -12237,7 +12237,7 @@ else {
12237
12237
  }
12238
12238
  })();
12239
12239
  </script>
12240
- `})}function AQ(){return`
12240
+ `})}function MQ(){return`
12241
12241
  /* Island base styles */
12242
12242
  .stx-island {
12243
12243
  display: contents;
@@ -12278,11 +12278,11 @@ else {
12278
12278
  .stx-island.hydrated {
12279
12279
  opacity: 1;
12280
12280
  }
12281
- `}function MQ($){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 NQ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function TQ(){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 IQ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function DQ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function EQ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function kQ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12281
+ `}function NQ($){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 TQ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function IQ(){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 DQ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function EQ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function kQ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function bQ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12282
12282
  <script type="application/json" id="stx-island-manifest">
12283
12283
  ${JSON.stringify(Z)}
12284
12284
  </script>
12285
- `}var c_;var SQ=b(()=>{c_={processPartialHydrationDirectives:RQ,processStaticDirectives:EQ,generatePartialHydrationCSS:AQ,generateIslandManifest:kQ,createIslandRegistry:wQ,hydrateIsland:MQ,hydrateByStrategy:NQ,hydrateAll:TQ,isHydrated:IQ,onHydrated:DQ}});var dQ={};t(dQ,{watchMultiple:()=>xQ,watchEffect:()=>fQ,watch:()=>vQ,unref:()=>yQ,toRefs:()=>PQ,throttledComputed:()=>mQ,stxWatchMultiple:()=>xQ,stxWatchEffect:()=>fQ,stxWatch:()=>vQ,stxUnref:()=>yQ,stxToRefs:()=>PQ,stxThrottledComputed:()=>mQ,stxShallowRef:()=>CQ,stxRef:()=>s5,stxIsRef:()=>l1,stxDebouncedComputed:()=>uQ,stxComputed:()=>g$,shallowRef:()=>CQ,ref:()=>s5,processWatchDirectives:()=>hQ,processComputedDirectives:()=>gQ,isRef:()=>l1,default:()=>i_,debouncedComputed:()=>uQ,computed:()=>g$});function s5($){let Z=$,Y=new Set,J={get value(){if(z1){let X=f$.get(J);if(!X)X=new Set,f$.set(J,X);X.add(z1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=f$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function l1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yQ($){return l1($)?$.value:$}function PQ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=s5($[Y]);return Z}function CQ($){return s5($)}function g$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=z.value;W.forEach((H)=>H(j))}};function U(){K.clear();let j=z1;z1=q,z7.push(q);try{return Y()}finally{z7.pop(),z1=j}}let z={get value(){if(z1){let j=f$.get(z);if(!j)j=new Set,f$.set(z,j);j.add(z1)}if(G){let j=U();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function vQ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,U=()=>{if(l1($))return X?j5($.value):$.value;return $()},z=()=>{if(!W||q)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?j5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(l1($))j=$.subscribe(()=>z());else j=g$($).subscribe(()=>z());if(J)K=void 0,z();else K=U();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function xQ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((z)=>l1(z)?z.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let z=$.map((j)=>l1(j)?j.value:void 0);if(Z(z,Q),Q=[...z],X)U()},q=$.map((z)=>{if(l1(z))return z.subscribe(()=>W());return()=>{}});if(J)W();let U=()=>{G=!1,q.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function fQ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=z1;z1=G,z7.push(G);try{J=$()}finally{z7.pop(),z1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gQ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hQ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
12285
+ `}var i_;var yQ=b(()=>{i_={processPartialHydrationDirectives:AQ,processStaticDirectives:kQ,generatePartialHydrationCSS:MQ,generateIslandManifest:bQ,createIslandRegistry:RQ,hydrateIsland:NQ,hydrateByStrategy:TQ,hydrateAll:IQ,isHydrated:DQ,onHydrated:EQ}});var lQ={};t(lQ,{watchMultiple:()=>fQ,watchEffect:()=>gQ,watch:()=>xQ,unref:()=>PQ,toRefs:()=>CQ,throttledComputed:()=>dQ,stxWatchMultiple:()=>fQ,stxWatchEffect:()=>gQ,stxWatch:()=>xQ,stxUnref:()=>PQ,stxToRefs:()=>CQ,stxThrottledComputed:()=>dQ,stxShallowRef:()=>vQ,stxRef:()=>s5,stxIsRef:()=>l1,stxDebouncedComputed:()=>mQ,stxComputed:()=>g$,shallowRef:()=>vQ,ref:()=>s5,processWatchDirectives:()=>uQ,processComputedDirectives:()=>hQ,isRef:()=>l1,default:()=>n_,debouncedComputed:()=>mQ,computed:()=>g$});function s5($){let Z=$,Y=new Set,J={get value(){if(z1){let X=f$.get(J);if(!X)X=new Set,f$.set(J,X);X.add(z1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=f$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function l1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function PQ($){return l1($)?$.value:$}function CQ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=s5($[Y]);return Z}function vQ($){return s5($)}function g$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=z.value;W.forEach((H)=>H(j))}};function U(){K.clear();let j=z1;z1=q,z7.push(q);try{return Y()}finally{z7.pop(),z1=j}}let z={get value(){if(z1){let j=f$.get(z);if(!j)j=new Set,f$.set(z,j);j.add(z1)}if(G){let j=U();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function xQ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,U=()=>{if(l1($))return X?j5($.value):$.value;return $()},z=()=>{if(!W||q)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?j5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(l1($))j=$.subscribe(()=>z());else j=g$($).subscribe(()=>z());if(J)K=void 0,z();else K=U();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function fQ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((z)=>l1(z)?z.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let z=$.map((j)=>l1(j)?j.value:void 0);if(Z(z,Q),Q=[...z],X)U()},q=$.map((z)=>{if(l1(z))return z.subscribe(()=>W());return()=>{}});if(J)W();let U=()=>{G=!1,q.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function gQ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=z1;z1=G,z7.push(G);try{J=$()}finally{z7.pop(),z1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function hQ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function uQ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
12286
12286
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
12287
12287
  (function() {
12288
12288
  // Watch implementation for ${Q}
@@ -12294,9 +12294,9 @@ else {
12294
12294
  }
12295
12295
  })();
12296
12296
  </script>
12297
- `})}function j5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>j5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(j5(X),j5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(j5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=j5($[Y]);return Z}function uQ($,Z=100){let Y=s5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function mQ($,Z=100){let Y=s5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var z1=null,z7,f$,i_;var lQ=b(()=>{z7=[],f$=new WeakMap;i_={ref:s5,computed:g$,watch:vQ,watchMultiple:xQ,watchEffect:fQ,isRef:l1,unref:yQ,toRefs:PQ,shallowRef:CQ,debouncedComputed:uQ,throttledComputed:mQ,processComputedDirectives:gQ,processWatchDirectives:hQ}});function h$($,Z){let Y={};for(let J of $)Y[J]=m1(Z(J));return new Proxy({},{get:(J,X)=>Y[X]?.(),set:(J,X,Q)=>{if(Y[X])Y[X].set(Q);else Y[X]=m1(Q);return!0},has:(J,X)=>(X in Y),deleteProperty:(J,X)=>{return delete Y[X],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(J,X)=>(X in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[X]()}:void 0})}function n_($,Z){let Y={};for(let J of Z)Y[J]=$[J];return Y}function V9($,Z){let Y=Object.keys($),J=h$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),X=h$(Y,()=>[]),Q=h$(Y,()=>!1),G=h$(Y,()=>!1),K=h$(Y,()=>!1),W=m1(!1);async function q(L){K[L]=!0;let V=await $[L].validate(J[L],J);return X[L]=V,K[L]=!1,V.length===0}async function U(){W.set(!0);let L=await Promise.all(Y.map(q));return W.set(!1),L.every(Boolean)}function z(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),X[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)J[V]=L[V],G[V]=!0}function H(L,V){J[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)q(L)}function _(L){return{value:J[L],errors:X[L],touched:Q[L],dirty:G[L],valid:X[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await U())await L(n_(J,Y))}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((L)=>X[L].length===0)},get isValidating(){return W()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:U,validateField:q,reset:z,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var pQ;var cQ=b(()=>{t4();pQ=V9});var oQ={};t(oQ,{v:()=>s_,useForm:()=>V9,processHasErrorsDirective:()=>sQ,processFormValidationDirectives:()=>o_,processErrorsDirective:()=>nQ,processErrorDirective:()=>iQ,defineForm:()=>pQ,Validator:()=>o5});class o5{rules=[];defaultValue="";addRule($){let Z=new o5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new o5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new o5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function iQ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12298
- `)}catch{return""}})}function nQ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
12299
- `)}catch{return""}})}function sQ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function o_($,Z,Y){let J=$;return J=iQ(J,Z,Y),J=nQ(J,Z,Y),J=sQ(J,Z,Y),J}var s_;var rQ=b(()=>{cQ();s_=new o5});var eQ={};t(eQ,{processXElementDirectives:()=>r_,hasXElementDirectives:()=>tQ,generateXElementRuntime:()=>aQ});function aQ(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
12297
+ `})}function j5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>j5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(j5(X),j5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(j5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=j5($[Y]);return Z}function mQ($,Z=100){let Y=s5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function dQ($,Z=100){let Y=s5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var z1=null,z7,f$,n_;var pQ=b(()=>{z7=[],f$=new WeakMap;n_={ref:s5,computed:g$,watch:xQ,watchMultiple:fQ,watchEffect:gQ,isRef:l1,unref:PQ,toRefs:CQ,shallowRef:vQ,debouncedComputed:mQ,throttledComputed:dQ,processComputedDirectives:hQ,processWatchDirectives:uQ}});function h$($,Z){let Y={};for(let J of $)Y[J]=m1(Z(J));return new Proxy({},{get:(J,X)=>Y[X]?.(),set:(J,X,Q)=>{if(Y[X])Y[X].set(Q);else Y[X]=m1(Q);return!0},has:(J,X)=>(X in Y),deleteProperty:(J,X)=>{return delete Y[X],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(J,X)=>(X in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[X]()}:void 0})}function s_($,Z){let Y={};for(let J of Z)Y[J]=$[J];return Y}function V9($,Z){let Y=Object.keys($),J=h$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),X=h$(Y,()=>[]),Q=h$(Y,()=>!1),G=h$(Y,()=>!1),K=h$(Y,()=>!1),W=m1(!1);async function q(L){K[L]=!0;let V=await $[L].validate(J[L],J);return X[L]=V,K[L]=!1,V.length===0}async function U(){W.set(!0);let L=await Promise.all(Y.map(q));return W.set(!1),L.every(Boolean)}function z(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),X[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)J[V]=L[V],G[V]=!0}function H(L,V){J[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)q(L)}function _(L){return{value:J[L],errors:X[L],touched:Q[L],dirty:G[L],valid:X[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await U())await L(s_(J,Y))}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((L)=>X[L].length===0)},get isValidating(){return W()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:U,validateField:q,reset:z,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var cQ;var iQ=b(()=>{t4();cQ=V9});var rQ={};t(rQ,{v:()=>o_,useForm:()=>V9,processHasErrorsDirective:()=>oQ,processFormValidationDirectives:()=>r_,processErrorsDirective:()=>sQ,processErrorDirective:()=>nQ,defineForm:()=>cQ,Validator:()=>o5});class o5{rules=[];defaultValue="";addRule($){let Z=new o5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new o5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new o5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function nQ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12298
+ `)}catch{return""}})}function sQ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
12299
+ `)}catch{return""}})}function oQ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function r_($,Z,Y){let J=$;return J=nQ(J,Z,Y),J=sQ(J,Z,Y),J=oQ(J,Z,Y),J}var o_;var aQ=b(()=>{iQ();o_=new o5});var $G={};t($G,{processXElementDirectives:()=>a_,hasXElementDirectives:()=>eQ,generateXElementRuntime:()=>tQ});function tQ(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
12300
12300
  (function() {
12301
12301
  'use strict';
12302
12302
 
@@ -12580,9 +12580,9 @@ else {
12580
12580
  // Expose for manual initialization
12581
12581
  window.XElement = XElement;
12582
12582
  })();
12583
- </script>`}function tQ($){return/\bx-data(?:\s|=)/.test($)}function r_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!tQ(J))return J;let X=Y[0]?.trim()||aQ(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12583
+ </script>`}function eQ($){return/\bx-data(?:\s|=)/.test($)}function a_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!eQ(J))return J;let X=Y[0]?.trim()||tQ(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12584
12584
  `+J.slice(Q);return J+`
12585
- `+X}var $G={};t($G,{rewriteImagesWithSiblings:()=>e_});import M1 from"path";async function e_($,Z){let Y=Z.formats??t_;if(!Z.publicDir)return $;let J=YO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(JO(K.index,J))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let W=await Promise.all(G.map(async(z)=>{let j=await $O(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${XO(_.url)}">`).join("")}${z.raw}</picture>`;X.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(X.length===0)return $;let q="",U=0;for(let z of X)q+=$.slice(U,z.start),q+=z.replacement,U=z.end;return q+=$.slice(U),q}async function $O($,Z,Y){if(!ZO($))return[];let J=M1.extname($).toLowerCase();if(!a_.has(J))return[];if(!$.startsWith("/"))return[];let X=M1.join(Z,$.slice(1)),Q=M1.dirname(X),G=M1.basename(X,J),K=M1.resolve(Q),W=M1.resolve(Z);if(!K.startsWith(W))return[];let q=M1.posix.dirname($),U=Y.map(async(j)=>{let H=M1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:M1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function ZO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function YO($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function JO($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function XO($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var a_,t_;var ZG=b(()=>{a_=new Set([".jpg",".jpeg",".png",".gif"]),t_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var YG=()=>{};function w9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var JG=b(()=>{YG()});var XG={};t(XG,{injectPwaTags:()=>QO,generateThemeColorMeta:()=>WO,generateSwRegistrationScript:()=>GO,generatePwaTags:()=>j7,generateManifestLink:()=>KO});function j7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=w9($),Q=`
12585
+ `+X}var ZG={};t(ZG,{rewriteImagesWithSiblings:()=>$O});import M1 from"path";async function $O($,Z){let Y=Z.formats??e_;if(!Z.publicDir)return $;let J=JO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(XO(K.index,J))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let W=await Promise.all(G.map(async(z)=>{let j=await ZO(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${QO(_.url)}">`).join("")}${z.raw}</picture>`;X.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(X.length===0)return $;let q="",U=0;for(let z of X)q+=$.slice(U,z.start),q+=z.replacement,U=z.end;return q+=$.slice(U),q}async function ZO($,Z,Y){if(!YO($))return[];let J=M1.extname($).toLowerCase();if(!t_.has(J))return[];if(!$.startsWith("/"))return[];let X=M1.join(Z,$.slice(1)),Q=M1.dirname(X),G=M1.basename(X,J),K=M1.resolve(Q),W=M1.resolve(Z);if(!K.startsWith(W))return[];let q=M1.posix.dirname($),U=Y.map(async(j)=>{let H=M1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:M1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function YO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function JO($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function XO($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function QO($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var t_,e_;var YG=b(()=>{t_=new Set([".jpg",".jpeg",".png",".gif"]),e_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var JG=()=>{};function w9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var XG=b(()=>{JG()});var QG={};t(QG,{injectPwaTags:()=>GO,generateThemeColorMeta:()=>qO,generateSwRegistrationScript:()=>KO,generatePwaTags:()=>j7,generateManifestLink:()=>WO});function j7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=w9($),Q=`
12586
12586
  <!-- stx PWA Meta Tags -->
12587
12587
  <link rel="manifest" href="/manifest.json">
12588
12588
  <meta name="theme-color" content="${R9(Y?.themeColor||"#000000")}">
@@ -12626,9 +12626,9 @@ if ('serviceWorker' in navigator) {
12626
12626
  });
12627
12627
  }
12628
12628
  </script>
12629
- <!-- End stx PWA -->`,Q}function QO($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=j7(Z);return $.slice(0,X)+Q+`
12629
+ <!-- End stx PWA -->`,Q}function GO($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=j7(Z);return $.slice(0,X)+Q+`
12630
12630
  `+$.slice(X)}return $+j7(Z)}let J=j7(Z);return $.replace("</head>",`${J}
12631
- </head>`)}function GO($){if(!$.pwa?.enabled)return"";return`<script>
12631
+ </head>`)}function KO($){if(!$.pwa?.enabled)return"";return`<script>
12632
12632
  if ('serviceWorker' in navigator) {
12633
12633
  window.addEventListener('load', function() {
12634
12634
  navigator.serviceWorker.register('/${w9($)}')
@@ -12640,45 +12640,45 @@ if ('serviceWorker' in navigator) {
12640
12640
  });
12641
12641
  });
12642
12642
  }
12643
- </script>`}function KO(){return'<link rel="manifest" href="/manifest.json">'}function WO($){return`<meta name="theme-color" content="${R9($)}">`}function R9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var QG=b(()=>{JG()});import qO from"fs";import E0 from"path";import{deriveLayoutGroup as UO}from"stx-router/layout-metadata";function GG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zO($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12643
+ </script>`}function WO(){return'<link rel="manifest" href="/manifest.json">'}function qO($){return`<meta name="theme-color" content="${R9($)}">`}function R9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var GG=b(()=>{XG()});import UO from"fs";import E0 from"path";import{deriveLayoutGroup as zO}from"stx-router/layout-metadata";function KG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jO($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12644
12644
  `,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,X=!0;continue}if(K==="/"&&X){let W=J+1,q=!1;while(W<Y){let U=$[W];if(U==="\\"){W+=2;continue}if(U==="[")q=!0;else if(U==="]")q=!1;else if(U==="/"&&!q){W++;break}else if(U===`
12645
12645
  `){W=-1;break}W++}if(W===-1){J++,X=!1;continue}while(W<Y&&/[a-z]/.test($[W]))W++;J=W,X=!1;continue}if(K==="'"||K==='"'){let W=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;break}if($[J]===`
12646
- `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function r5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function KG($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function jO($){let Z=r5($,"data-stx-runtime");if(!Z)return $;let Y=KG($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=KG(X);if(Q===-1)return J+`
12646
+ `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function r5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function WG($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function BO($){let Z=r5($,"data-stx-runtime");if(!Z)return $;let Y=WG($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=WG(X);if(Q===-1)return J+`
12647
12647
  `+X;return X.slice(0,Q)+J+`
12648
- `+X.slice(Q)}async function w0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=F1($);let Q=!Z.__stxProcessingDepth;if(Q)TZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!L$()&&!U4())&&Y&&Y.endsWith(".stx"))r3($,Y);try{return await nZ.timeAsync("template-processing",async()=>{let G=await BO($,Z,Y,J,X);if(Q)G=q9(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},q=(Z.__stx_runtime_head||null)??v3(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let H=Z.__sections?.title,B=q.title||z||H,_=!q.title&&(!!z||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
12649
- `),...q.htmlAttrs&&{htmlAttrs:tJ(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},F=i6(G);if(G=YX(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=ZX(G,K),G=eJ(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],A=UO(R);G=G.replace(/<head\b[^>]*>/i,(M)=>`${M}
12650
- <meta name="stx-layout" content="${GG(R)}">
12651
- <meta name="stx-layout-group" content="${GG(A)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?K4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=w3(G,(A,M)=>`<body${M} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=$X(G);let K=J.app?.colorMode;if(K)G=nJ(G,K);G=oJ(G),G=jO(G)}if(Q)try{let{getStoreScript:K}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (hX(),gX))),W=J.storesDir,q=await K(W);if(q){let U=`<script data-stx-stores>${q}</script>`,z=r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12652
- `+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await $0("stx/framework-composables",()=>Promise.resolve().then(() => (pX(),lX))),W=await K(G);if(W){let q=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
12653
- `+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (nX(),iX))),W=J.composablesDir,q=await K(W);if(q){let U=`<script data-stx-composables>${q}</script>`,z=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12654
- `+U+G.slice(z.end)}}catch{}if(Q)G=sJ(G);if(Q&&Z.__stx_inject_css!==!1)G=await L3(G,void 0,J.buildMode==="serve");if(Q)G=iJ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof H4)throw G;let K=G instanceof Error?G.message:String(G),W=new Y5(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(W,{filePath:Y,context:Z}),k3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return D3.createFallbackContent("Template Processing",W)}}async function BO($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!E0.isAbsolute(J.partialsDir)?E0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!E0.isAbsolute(J.componentsDir)?E0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!E0.isAbsolute(J.layoutsDir)?E0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await OO(Y,Z),_O(Z,K),W=await b5(()=>LJ(W,Z,Y,K),W,(V)=>{Z1.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=G1(W,B$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let U=q.tokens,z=(V)=>U.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),W=vJ(W),W=await PX(W,Y,X);let H={};W=y6(W,H);let B={...Z.__sections||{}},_="",O=B2(j2($)),F=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let L=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
12648
+ `+X.slice(Q)}async function w0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=F1($);let Q=!Z.__stxProcessingDepth;if(Q)TZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!L$()&&!U4())&&Y&&Y.endsWith(".stx"))r3($,Y);try{return await sZ.timeAsync("template-processing",async()=>{let G=await HO($,Z,Y,J,X);if(Q)G=q9(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},q=(Z.__stx_runtime_head||null)??v3(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let H=Z.__sections?.title,B=q.title||z||H,_=!q.title&&(!!z||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
12649
+ `),...q.htmlAttrs&&{htmlAttrs:eJ(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},F=i6(G);if(G=JX(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=YX(G,K),G=$X(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],A=zO(R);G=G.replace(/<head\b[^>]*>/i,(M)=>`${M}
12650
+ <meta name="stx-layout" content="${KG(R)}">
12651
+ <meta name="stx-layout-group" content="${KG(A)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?K4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=w3(G,(A,M)=>`<body${M} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=ZX(G);let K=J.app?.colorMode;if(K)G=sJ(G,K);G=rJ(G),G=BO(G)}if(Q)try{let{getStoreScript:K}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (uX(),hX))),W=J.storesDir,q=await K(W);if(q){let U=`<script data-stx-stores>${q}</script>`,z=r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12652
+ `+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await $0("stx/framework-composables",()=>Promise.resolve().then(() => (cX(),pX))),W=await K(G);if(W){let q=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
12653
+ `+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (sX(),nX))),W=J.composablesDir,q=await K(W);if(q){let U=`<script data-stx-composables>${q}</script>`,z=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12654
+ `+U+G.slice(z.end)}}catch{}if(Q)G=oJ(G);if(Q&&Z.__stx_inject_css!==!1)G=await L3(G,void 0,J.buildMode==="serve");if(Q)G=nJ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof H4)throw G;let K=G instanceof Error?G.message:String(G),W=new Y5(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(W,{filePath:Y,context:Z}),k3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return D3.createFallbackContent("Template Processing",W)}}async function HO($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!E0.isAbsolute(J.partialsDir)?E0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!E0.isAbsolute(J.componentsDir)?E0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!E0.isAbsolute(J.layoutsDir)?E0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await FO(Y,Z),OO(Z,K),W=await b5(()=>VJ(W,Z,Y,K),W,(V)=>{Z1.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=G1(W,B$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let U=q.tokens,z=(V)=>U.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),W=xJ(W),W=await CX(W,Y,X);let H={};W=y6(W,H);let B={...Z.__sections||{}},_="",O=H2(B2($)),F=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let L=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
12655
12655
  ${W.trim()}
12656
12656
  @endsection`}if(!_&&!F&&K.defaultLayout){let V=c6(W),w=/@section\s*\(/.test(W);if(!V||w){let R="",A=E0.dirname(Y),M=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let I=E0.join(A,"_layout.stx");if(await i(I)){R=I;break}let T=E0.dirname(A);if(T===A||T.length<M.length)break;A=T}if(R)_=R;else if(K.layoutsDir){let N=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),I=E0.join(N,`${K.defaultLayout}.stx`);if(await i(I))_=I}if(_&&!w)W=`@section('content')
12657
12657
  ${W.trim()}
12658
12658
  @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let A=J0(R.trim(),Z);if(A===void 0)return V;return B[w]=String(A??""),""}catch{return V}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",B5);else B[w]=R.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=P6(W,H),_){let V=[],w=b1(W),R=G1(w.output,T5,(A,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,M,N)=>{let I=M==="SCRIPT"?w.scripts[Number(N)]:R.tokens[Number(N)];if(I)V.push(I);return""}),V.length>0){let A=V.join(`
12659
12659
  `);B.content=B.content?`${B.content}
12660
- ${A}`:A,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,X.add(_);else V=await b5(()=>A9(_,Y,G,X),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=qO.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(Z1.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new Y5(T,Y);return W}let w=await b5(()=>Bun.file(V).text(),"",()=>{throw new Y5(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(B5)){let S=B[P].indexOf(B5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+B5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await w0(D,k,V,G,X)}let A=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=y6(A,H),N={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return N[T]=k.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(B5)){let P=N[T]||"",y=D.indexOf(B5);D=D.slice(0,y)+P+D.slice(y+B5.length)}return D}return k||""}),M=HO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=P6(M,H),Z.__originalFilePath=Y,W=await WG(M,Z,V,G,X),W=`<!-- stx-layout: ${_} -->
12661
- ${W}`,z(W)}catch(V){return Z1.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return z(await WG(W,Z,Y,G,X))}function HO($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function _O($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function OO($,Z){await b5(()=>kJ($,Z),void 0,(Y)=>{Z1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function FO($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));Z1.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function LO($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await $0("stx/expressions",()=>Promise.resolve().then(() => (K1(),pZ)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return Z1.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function WG($,Z,Y,J,X){let Q=$,G=J;if(await FO(Q,Z,Y),Q=await LO(Q,Z,Y),Q=await jJ(Q,Z,Y),Q=await BJ(Q,Z,Y),Q=await d2(Q,Z,Y,G),F1(Q))Q=J9(Q,Z),Q=Q9(Q,Z);Q=X9(Q);let{processStreamDirectives:K}=await $0("stx/streaming",()=>Promise.resolve().then(() => (o3(),s3)));Q=K(Q,Z),Q=E6(Q,Z,Y,G),Q=await uJ(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Q=g8(Q,Z,Y,G);let{processDeferDirectives:W}=await $0("stx/defer",()=>Promise.resolve().then(() => oX));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await $0("stx/teleport",()=>Promise.resolve().then(() => aX));Q=q(Q,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await $0("stx/transitions",()=>Promise.resolve().then(() => ZQ));Q=U(Q,Z,Y),Q=z(Q);let{processErrorBoundaryDirectives:j}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => JQ));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await $0("stx/suspense",()=>Promise.resolve().then(() => XQ));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await $0("stx/async-components",()=>Promise.resolve().then(() => WQ));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => UQ));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OQ(),_Q)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (SQ(),bQ)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:A}=await $0("stx/computed",()=>Promise.resolve().then(() => (lQ(),dQ)));Q=R(Q,Z,Y),Q=A(Q,Z,Y);let{processFormValidationDirectives:M}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (rQ(),oQ)));Q=M(Q,Z,Y);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=N(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12662
- `;if(Q=I(Q,Z),Q=T(Q,Z),Q=RJ(Q),Q=S3(Q,Z),Q=u2(Q),Q=OJ(Q),Q=await S6(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Z.__stxProcessingDepth===1)Q=DZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=q9(Q),Q=X5(Q,Z,Y),Q=y3(Q,Z),Q=P3(Q,Z),Q=M4(Q,Z),Q=t2(Q,Z),Q=e2(Q,Z),Q=await V2(Q,Z,Y,G),Q=await qG(Q,Z,Y),Q=await XY(Q,Z,Y,G),Q=S8(Q,Z,Y,G),Q=MJ(Q,Z,Y,G),Q=NJ(Q,Z,Y),Q=TJ(Q,Z,Y,G),Q=f2(Q,Z,Y,G),Q=K9(Q,Z),Q=W9(Q),Q=vX(Q),!G.skipEventDirectives)Q=JZ(Q,Z,Y);if(Q=F2(Q,Z,Y),G.debug){let s=/\bx-data\s*=/.test(Q),r=Q7($);if(s&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12660
+ ${A}`:A,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,X.add(_);else V=await b5(()=>A9(_,Y,G,X),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=UO.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(Z1.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new Y5(T,Y);return W}let w=await b5(()=>Bun.file(V).text(),"",()=>{throw new Y5(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(B5)){let S=B[P].indexOf(B5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+B5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await w0(D,k,V,G,X)}let A=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=y6(A,H),N={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return N[T]=k.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(B5)){let P=N[T]||"",y=D.indexOf(B5);D=D.slice(0,y)+P+D.slice(y+B5.length)}return D}return k||""}),M=_O(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=P6(M,H),Z.__originalFilePath=Y,W=await qG(M,Z,V,G,X),W=`<!-- stx-layout: ${_} -->
12661
+ ${W}`,z(W)}catch(V){return Z1.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return z(await qG(W,Z,Y,G,X))}function _O($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function OO($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function FO($,Z){await b5(()=>bJ($,Z),void 0,(Y)=>{Z1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function LO($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));Z1.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function VO($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await $0("stx/expressions",()=>Promise.resolve().then(() => (K1(),cZ)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return Z1.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function qG($,Z,Y,J,X){let Q=$,G=J;if(await LO(Q,Z,Y),Q=await VO(Q,Z,Y),Q=await BJ(Q,Z,Y),Q=await HJ(Q,Z,Y),Q=await l2(Q,Z,Y,G),F1(Q))Q=J9(Q,Z),Q=Q9(Q,Z);Q=X9(Q);let{processStreamDirectives:K}=await $0("stx/streaming",()=>Promise.resolve().then(() => (o3(),s3)));Q=K(Q,Z),Q=E6(Q,Z,Y,G),Q=await mJ(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Q=g8(Q,Z,Y,G);let{processDeferDirectives:W}=await $0("stx/defer",()=>Promise.resolve().then(() => rX));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await $0("stx/teleport",()=>Promise.resolve().then(() => tX));Q=q(Q,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await $0("stx/transitions",()=>Promise.resolve().then(() => YQ));Q=U(Q,Z,Y),Q=z(Q);let{processErrorBoundaryDirectives:j}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => XQ));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await $0("stx/suspense",()=>Promise.resolve().then(() => QQ));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await $0("stx/async-components",()=>Promise.resolve().then(() => qQ));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => zQ));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (FQ(),OQ)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (yQ(),SQ)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:A}=await $0("stx/computed",()=>Promise.resolve().then(() => (pQ(),lQ)));Q=R(Q,Z,Y),Q=A(Q,Z,Y);let{processFormValidationDirectives:M}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (aQ(),rQ)));Q=M(Q,Z,Y);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=N(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12662
+ `;if(Q=I(Q,Z),Q=T(Q,Z),Q=AJ(Q),Q=S3(Q,Z),Q=m2(Q),Q=FJ(Q),Q=await S6(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Z.__stxProcessingDepth===1)Q=DZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=q9(Q),Q=X5(Q,Z,Y),Q=y3(Q,Z),Q=P3(Q,Z),Q=M4(Q,Z),Q=e2(Q,Z),Q=$Y(Q,Z),Q=await w2(Q,Z,Y,G),Q=await UG(Q,Z,Y),Q=await QY(Q,Z,Y,G),Q=S8(Q,Z,Y,G),Q=NJ(Q,Z,Y,G),Q=TJ(Q,Z,Y),Q=IJ(Q,Z,Y,G),Q=g2(Q,Z,Y,G),Q=K9(Q,Z),Q=W9(Q),Q=xX(Q),!G.skipEventDirectives)Q=JZ(Q,Z,Y);if(Q=L2(Q,Z,Y),G.debug){let s=/\bx-data\s*=/.test(Q),r=Q7($);if(s&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12663
12663
  Both work on the same page, but they manage separate scopes.
12664
- Prefer signals (state/derived/effect) for new components.`)}Q=yJ(Q,Z),Q=await S1(Q,Z,Y),Q=xX(Q),Q=fX(Q),Q=W2(Q);let{processXElementDirectives:P}=await $0("stx/x-element",()=>Promise.resolve().then(() => eQ));Q=P(Q);let y=Z.__originalFilePath||Y,S=r1(Z);if(Q=await G9(Q,G,y,S),Q=n2(Q,Z),Q=await VJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZG(),$G)));Q=await r(Q,{publicDir:s})}if(G.seo?.enabled)Q=IJ(Q,Z,G);let C=(s,r,U0=!0)=>{if(!r)return s;let N0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),K0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(N0&&K0){if(U0)s=s.replace(K0[0],N0[0]);if(r=r.replace(N0[0],"").trim(),!r)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${r}
12664
+ Prefer signals (state/derived/effect) for new components.`)}Q=PJ(Q,Z),Q=await S1(Q,Z,Y),Q=fX(Q),Q=gX(Q),Q=q2(Q);let{processXElementDirectives:P}=await $0("stx/x-element",()=>Promise.resolve().then(() => $G));Q=P(Q);let y=Z.__originalFilePath||Y,S=r1(Z);if(Q=await G9(Q,G,y,S),Q=s2(Q,Z),Q=await wJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (YG(),ZG)));Q=await r(Q,{publicDir:s})}if(G.seo?.enabled)Q=DJ(Q,Z,G);let C=(s,r,U0=!0)=>{if(!r)return s;let N0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),K0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(N0&&K0){if(U0)s=s.replace(K0[0],N0[0]);if(r=r.replace(N0[0],"").trim(),!r)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${r}
12665
12665
  </head>`);if(/<head\b[^>]*>/i.test(s))return s.replace(/(<head\b[^>]*>)/i,`$1
12666
12666
  ${r}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
12667
12667
  <head>
12668
12668
  ${r}
12669
- </head>`);return s},{renderHead:x,getHead:m}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3))),G0=Z.__stx_runtime_head??m();if(G0.title||G0.meta?.length||G0.link?.length){let s=x(G0);if(s)Q=C(Q,s)}if(D.headContent)Q=C(Q,D.headContent,!G0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=v2(Q,G.csp,Z);if(G.analytics?.enabled)Q=U2(Q,G);if(G.heatmap?.enabled)Q=l8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (QG(),XG)));Q=s(Q,G)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),A0=/\bSTX\.\w+/.test(Q),o0=/window\.STX\s*=/.test(Q);if(l0&&A0&&!o0){let r=`<script data-stx-scoped data-stx-run="once">
12670
- ${X2()}
12669
+ </head>`);return s},{renderHead:x,getHead:m}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3))),G0=Z.__stx_runtime_head??m();if(G0.title||G0.meta?.length||G0.link?.length){let s=x(G0);if(s)Q=C(Q,s)}if(D.headContent)Q=C(Q,D.headContent,!G0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=x2(Q,G.csp,Z);if(G.analytics?.enabled)Q=z2(Q,G);if(G.heatmap?.enabled)Q=l8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (GG(),QG)));Q=s(Q,G)}let p0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),A0=/\bSTX\.\w+/.test(Q),o0=/window\.STX\s*=/.test(Q);if(p0&&A0&&!o0){let r=`<script data-stx-scoped data-stx-run="once">
12670
+ ${Q2()}
12671
12671
  </script>`;if(Q.includes("</head>")){let U0=Q.indexOf("</head>"),K0=Q.slice(0,U0).indexOf("<script");if(K0!==-1){let E=Q.slice(0,K0),v=Q.slice(K0);Q=E+r+`
12672
12672
  `+v}else Q=Q.replace("</head>",`${r}
12673
12673
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
12674
12674
  ${r}`);else Q=r+`
12675
- `+Q}{let{scanScriptTags:s}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7))),r=[];for(let U0 of s(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let N0=U0.start+U0.fullMatch.indexOf(">")+1,K0=zO(Q,N0);if(K0===-1)continue;let E=K0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:U0.start,end:E})}for(let U0=r.length-1;U0>=0;U0--){let{start:N0,end:K0}=r[U0];Q=Q.substring(0,N0)+Q.substring(K0)}}let p=m4(Q,Y);if(p.hasScoped)Q=p.html;let _0=Z.__stx_event_bindings||[],p0=!1,N1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:F5}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));for(let s of F5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N1.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:r,content:U0}of N1){p0=!0;let N0=U0;z9(U0,Y,J.strict,Z.__originalFilePath);let K0=await a1(U0,{eventBindings:_0,attrs:r,hasColonDirectives:O5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});Q=Q.replace(s,()=>K0)}if(p0)Z.__stx_event_bindings=[];if(!p0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let r=Z3(s);if(r){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+r:Q.slice(0,U0)+r+`
12676
- `+Q.slice(U0)}Z.__stx_event_bindings=[]}}if(!LX(Q)&&VX(Q))Q=await Z7(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=x2(Q,Z.cspNonce);return Q}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var I4=b(()=>{V3();R3();$5();s7();Q2();q2();z2();a7();o7();Y3();N5();L2();w2();L4();g2();m2();p2();s2();V1();R$();K1();$Y();QY();zJ();_J();k6();M9();wJ();E5();AJ();v6();M0();bJ();PJ();xJ();mJ();h6();d6();JX();C$();N6();CX();U9();j9();V0();a3();q3();X$();Y7();Y7();U9();j9()});var UG=()=>{};var N9={};t(N9,{renderSlot:()=>jG,processSlots:()=>HG,parseSlots:()=>zG,parseSlotElement:()=>MO,extractSlotContent:()=>IO,applySlots:()=>DO});function VO($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function RO($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function AO($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=RO($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",U=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);X=G;continue}if(U==="template"&&Y.length===0){let j=K.match(J);if(j){let H=VO($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!wO.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function zG($){let Z={default:"",named:new Map},Y=$,J=AO($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,U,z,j,H]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,U,z,j]=G,H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function MO($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function jG($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,U]=W.split(":").map((j)=>j.trim()),z=U||q;if(Z[q]!==void 0)G[z]=Z[q]}}else G[Q]=Z;X=NO(X,G)}return X}function NO($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=BG(X,Z);return t0(String(Q??""))}catch{return`{{ ${J} }}`}})}function BG($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function HG($,Z,Y){let J=$;J=await TO(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let U=Z.named.get(K),z=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=BG(F,Y)}return await jG(U,H,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function TO($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function IO($){let Z=zG($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function DO($,Z,Y,J){return await HG($,{default:Z,named:Y},J)}var wO;var T9=b(()=>{K1();V0();wO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import EO from"fs";import f from"path";function bO($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function _G($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SO($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function t1($){return!SO($)}function e1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function yO($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(U)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===U){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let U=1;while(X<Q&&U>0)if($[X]==="{")U++,X++;else if($[X]==="}")U--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
12677
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let U=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let z=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function PO($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function CO($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function vO($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of PO(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=CO(q);if(U===-1)continue;let z=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=q.slice(U+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[z]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function P4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],U=typeof X.root==="string"?f.resolve(X.root):void 0,z=U??f.dirname(J),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(f.join(f.dirname(J),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(U)H(f.resolve(U,"resources/views/components")),H(f.resolve(U,"resources/components")),H(f.resolve(U,"src/components")),H(f.resolve(U,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(f.resolve(f.dirname(J),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(z,O);for(let L of q)if(await i(f.join(F,L)))return!0}return!1}function xO($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function fO($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function gO($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function q5($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&xO(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=X.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],u=X.__originalFilePath,g=[];if(u){let j0=f.join(f.dirname(u),"components");g.push(j0)}if(J)g.push(J);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Q0=f.join(f.dirname(Q),"components");if(!g.includes(Q0))g.push(Q0);if(G.componentsDir&&G.componentsDir!==J&&!g.includes(G.componentsDir))g.push(G.componentsDir);let r0=G._pluginComponentDirs;if(Array.isArray(r0)){for(let j0 of r0)if(typeof j0==="string"&&!g.includes(j0))g.push(j0)}let y0=typeof G.root==="string"?f.resolve(G.root):void 0,x0=y0??f.dirname(Q),a0=[];if(y0)a0.push(f.resolve(y0,"resources/views/components")),a0.push(f.resolve(y0,"resources/components")),a0.push(f.resolve(y0,"src/components")),a0.push(f.resolve(y0,"components"));a0.push(f.resolve(import.meta.dir,"components"));for(let j0 of a0)if(!g.includes(j0))g.push(j0);let L5=[...new Set(g.map((j0)=>{if(!j0)return j0;return f.isAbsolute(j0)?j0:f.resolve(x0,j0)}))];g.length=0,g.push(...L5);let T1=`${O}\x00${Q}\x00${L5.join("\x00")}`,I1=H7.get(T1);if(I1)if(await i(I1))F=I1;else H7.delete(T1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let j0 of g){if(!j0)continue;for(let J1 of v){let n=f.join(j0,J1);if(V.push(n),await i(n)){F=n;break}}if(F)break;if(!F)try{let J1=await import("fs");if(!J1.statSync(j0,{throwIfNoEntry:!1})?.isDirectory())continue;let X1=8,i1=[{path:j0,depth:0}];while(i1.length>0&&!F){let j1=i1.pop();if(j1.depth>=X1)continue;let l$;try{l$=J1.readdirSync(j1.path,{withFileTypes:!0})}catch{continue}for(let p$ of l$){if(!p$.isDirectory())continue;if(p$.name==="node_modules"||p$.name.startsWith("."))continue;let W8=f.join(j1.path,p$.name);for(let PK of v){let l7=f.join(W8,PK);if(V.push(l7),await i(l7)){F=l7;break}}if(F)break;i1.push({path:W8,depth:j1.depth+1})}}}catch{}if(F)break}if(F)H7.set(T1,F)}if(!F||!await i(F)){let E=V.length>0?`
12675
+ `+Q}{let{scanScriptTags:s}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7))),r=[];for(let U0 of s(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let N0=U0.start+U0.fullMatch.indexOf(">")+1,K0=jO(Q,N0);if(K0===-1)continue;let E=K0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:U0.start,end:E})}for(let U0=r.length-1;U0>=0;U0--){let{start:N0,end:K0}=r[U0];Q=Q.substring(0,N0)+Q.substring(K0)}}let p=m4(Q,Y);if(p.hasScoped)Q=p.html;let _0=Z.__stx_event_bindings||[],c0=!1,N1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:F5}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));for(let s of F5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N1.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:r,content:U0}of N1){c0=!0;let N0=U0;z9(U0,Y,J.strict,Z.__originalFilePath);let K0=await a1(U0,{eventBindings:_0,attrs:r,hasColonDirectives:O5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});Q=Q.replace(s,()=>K0)}if(c0)Z.__stx_event_bindings=[];if(!c0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let r=Z3(s);if(r){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+r:Q.slice(0,U0)+r+`
12676
+ `+Q.slice(U0)}Z.__stx_event_bindings=[]}}if(!VX(Q)&&wX(Q))Q=await Z7(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=f2(Q,Z.cspNonce);return Q}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var I4=b(()=>{V3();R3();$5();s7();G2();U2();j2();a7();o7();Y3();N5();V2();R2();L4();h2();d2();c2();o2();V1();R$();K1();ZY();GY();jJ();OJ();k6();M9();RJ();E5();MJ();v6();M0();SJ();CJ();fJ();dJ();h6();d6();XX();C$();N6();vX();U9();j9();V0();a3();q3();X$();Y7();Y7();U9();j9()});var zG=()=>{};var N9={};t(N9,{renderSlot:()=>BG,processSlots:()=>_G,parseSlots:()=>jG,parseSlotElement:()=>NO,extractSlotContent:()=>DO,applySlots:()=>EO});function wO($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function AO($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function MO($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=AO($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",U=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);X=G;continue}if(U==="template"&&Y.length===0){let j=K.match(J);if(j){let H=wO($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!RO.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function jG($){let Z={default:"",named:new Map},Y=$,J=MO($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,U,z,j,H]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,U,z,j]=G,H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function NO($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function BG($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,U]=W.split(":").map((j)=>j.trim()),z=U||q;if(Z[q]!==void 0)G[z]=Z[q]}}else G[Q]=Z;X=TO(X,G)}return X}function TO($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=HG(X,Z);return t0(String(Q??""))}catch{return`{{ ${J} }}`}})}function HG($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function _G($,Z,Y){let J=$;J=await IO(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let U=Z.named.get(K),z=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=HG(F,Y)}return await BG(U,H,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function IO($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function DO($){let Z=jG($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function EO($,Z,Y,J){return await _G($,{default:Z,named:Y},J)}var RO;var T9=b(()=>{K1();V0();RO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import kO from"fs";import f from"path";function SO($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function OG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yO($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function t1($){return!yO($)}function e1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function PO($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(U)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===U){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let U=1;while(X<Q&&U>0)if($[X]==="{")U++,X++;else if($[X]==="}")U--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
12677
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let U=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let z=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function CO($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function vO($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function xO($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of CO(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=vO(q);if(U===-1)continue;let z=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=q.slice(U+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[z]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function P4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],U=typeof X.root==="string"?f.resolve(X.root):void 0,z=U??f.dirname(J),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(f.join(f.dirname(J),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(U)H(f.resolve(U,"resources/views/components")),H(f.resolve(U,"resources/components")),H(f.resolve(U,"src/components")),H(f.resolve(U,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(f.resolve(f.dirname(J),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(z,O);for(let L of q)if(await i(f.join(F,L)))return!0}return!1}function fO($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function gO($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function hO($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function q5($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&fO(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=X.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],u=X.__originalFilePath,g=[];if(u){let j0=f.join(f.dirname(u),"components");g.push(j0)}if(J)g.push(J);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Q0=f.join(f.dirname(Q),"components");if(!g.includes(Q0))g.push(Q0);if(G.componentsDir&&G.componentsDir!==J&&!g.includes(G.componentsDir))g.push(G.componentsDir);let r0=G._pluginComponentDirs;if(Array.isArray(r0)){for(let j0 of r0)if(typeof j0==="string"&&!g.includes(j0))g.push(j0)}let y0=typeof G.root==="string"?f.resolve(G.root):void 0,f0=y0??f.dirname(Q),a0=[];if(y0)a0.push(f.resolve(y0,"resources/views/components")),a0.push(f.resolve(y0,"resources/components")),a0.push(f.resolve(y0,"src/components")),a0.push(f.resolve(y0,"components"));a0.push(f.resolve(import.meta.dir,"components"));for(let j0 of a0)if(!g.includes(j0))g.push(j0);let L5=[...new Set(g.map((j0)=>{if(!j0)return j0;return f.isAbsolute(j0)?j0:f.resolve(f0,j0)}))];g.length=0,g.push(...L5);let T1=`${O}\x00${Q}\x00${L5.join("\x00")}`,I1=H7.get(T1);if(I1)if(await i(I1))F=I1;else H7.delete(T1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let j0 of g){if(!j0)continue;for(let J1 of v){let n=f.join(j0,J1);if(V.push(n),await i(n)){F=n;break}}if(F)break;if(!F)try{let J1=await import("fs");if(!J1.statSync(j0,{throwIfNoEntry:!1})?.isDirectory())continue;let X1=8,i1=[{path:j0,depth:0}];while(i1.length>0&&!F){let j1=i1.pop();if(j1.depth>=X1)continue;let l$;try{l$=J1.readdirSync(j1.path,{withFileTypes:!0})}catch{continue}for(let p$ of l$){if(!p$.isDirectory())continue;if(p$.name==="node_modules"||p$.name.startsWith("."))continue;let W8=f.join(j1.path,p$.name);for(let CK of v){let l7=f.join(W8,CK);if(V.push(l7),await i(l7)){F=l7;break}}if(F)break;i1.push({path:W8,depth:j1.depth+1})}}}catch{}if(F)break}if(F)H7.set(T1,F)}if(!F||!await i(F)){let E=V.length>0?`
12678
12678
  Searched paths:
12679
12679
  ${V.map((v)=>` - ${v}`).join(`
12680
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}W.add(F);let w;if(B7.has(F))w=B7.get(F);else try{w=await Bun.file(F).text(),B7.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",$4]),A={};for(let[E,v]of Object.entries(X))if(!E.startsWith("__")||R.has(E))A[E]=v;let{extractSlotContent:M}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),N=M(Y),I={};if(N.defaultSlot?.trim())I.default=N.defaultSlot;for(let[E,v]of N.namedSlots)I[E]=v.content;let T={...A,...Z,props:Z,slot:Y,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:F1(w)||fO(Y)};vO(w,T);let k=w,D=P5(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(C){let E=bO({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=I9.get(x);if(v){for(let u of v.dependencies)W.add(u);return v.output}m=new Set(W)}}for(let E of y){let v=E[1]||"",u=E[2]||"",g=v.includes("server");if(t1(v)&&u.trim())u=e1(u);if(g&&u)try{await q(u,T,F)}catch(Q0){}if(!g){let Q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),r0=Q0.includes("{{")&&Q0.includes("}}"),y0=Q0.includes("{!!")&&Q0.includes("!!}");if(r0||y0)Q0=X4(Q0,T);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${x0}>${Q0}</script>`)}}let l=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),G0=l?l[1]:"",l0=l?l[2]:"",A0="",o0=G0&&/\bscoped\b/i.test(G0);if(l)A0=`<style${G0}>${l0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(u,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)A0=`${A0}${v.join(`
12681
- `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:_0}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),{defaultSlot:p0,namedSlots:N1}=N;p=await _0(p,p0,N1,T);let O5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=gO(S);if(F5.length>0)T.__stx_client_signal_names=F5;let s={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:O5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let r=await w0(p,T,F,s,W),U0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)X.__stx_preserved_client_expressions=[...U0];let N0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++kO}_${Math.random().toString(36).slice(2,8)}`,K0=r;if(O5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${_G(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${_G(H)}"`:"";K0=`<div data-stx-scope="${N0}"${E}${v}>${r}</div>`;let u=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Q0,r0]=a,y0=r$(r0,{filePath:F,projectRoot:process.cwd()}),x0=y0.code,a0=a$(y0.styles);x0=M5(x0).code;let{hasUserImports:L5,bundleClientScript:T1}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(L5(x0))x0=await T1(x0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:I1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(j1,l$)=>I1(l$));let j0=g0(x0),J1=yO(j0),n=`function(__scopeId) {
12680
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}W.add(F);let w;if(B7.has(F))w=B7.get(F);else try{w=await Bun.file(F).text(),B7.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",$4]),A={};for(let[E,v]of Object.entries(X))if(!E.startsWith("__")||R.has(E))A[E]=v;let{extractSlotContent:M}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),N=M(Y),I={};if(N.defaultSlot?.trim())I.default=N.defaultSlot;for(let[E,v]of N.namedSlots)I[E]=v.content;let T={...A,...Z,props:Z,slot:Y,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:F1(w)||gO(Y)};xO(w,T);let k=w,D=P5(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(C){let E=SO({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=I9.get(x);if(v){for(let u of v.dependencies)W.add(u);return v.output}m=new Set(W)}}for(let E of y){let v=E[1]||"",u=E[2]||"",g=v.includes("server");if(t1(v)&&u.trim())u=e1(u);if(g&&u)try{await q(u,T,F)}catch(Q0){}if(!g){let Q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),r0=Q0.includes("{{")&&Q0.includes("}}"),y0=Q0.includes("{!!")&&Q0.includes("!!}");if(r0||y0)Q0=X4(Q0,T);let f0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${f0}>${Q0}</script>`)}}let l=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),G0=l?l[1]:"",p0=l?l[2]:"",A0="",o0=G0&&/\bscoped\b/i.test(G0);if(l)A0=`<style${G0}>${p0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(u,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)A0=`${A0}${v.join(`
12681
+ `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:_0}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),{defaultSlot:c0,namedSlots:N1}=N;p=await _0(p,c0,N1,T);let O5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=hO(S);if(F5.length>0)T.__stx_client_signal_names=F5;let s={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:O5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let r=await w0(p,T,F,s,W),U0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)X.__stx_preserved_client_expressions=[...U0];let N0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++bO}_${Math.random().toString(36).slice(2,8)}`,K0=r;if(O5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${OG(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${OG(H)}"`:"";K0=`<div data-stx-scope="${N0}"${E}${v}>${r}</div>`;let u=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Q0,r0]=a,y0=r$(r0,{filePath:F,projectRoot:process.cwd()}),f0=y0.code,a0=a$(y0.styles);f0=M5(f0).code;let{hasUserImports:L5,bundleClientScript:T1}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(L5(f0))f0=await T1(f0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:I1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));f0=f0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(j1,l$)=>I1(l$));let j0=h0(f0),J1=PO(j0),n=`function(__scopeId) {
12682
12682
  ${w5("const",[...i8,...J1],j0)}
12683
12683
  const __scope = window.stx._scopes = window.stx._scopes || {};
12684
12684
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -12712,9 +12712,9 @@ finally {
12712
12712
  `+A0}else{if(A0)K0+=`
12713
12713
  `+A0;if(S.length>0){let E=T.__stx_event_bindings||[],v=r1(T),u=await Promise.all(S.map(async(g)=>{let a=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!a)return g;return await a1(a[1],{eventBindings:E,templateContent:K0,filePath:F,projectRoot:process.cwd(),serverData:v})}));K0+=`
12714
12714
  `+u.join(`
12715
- `),T.__stx_event_bindings=[]}}if(o0){let E=m4(K0,F);if(E.hasScoped)K0=E.html}if(x&&m)I9.set(x,{output:K0,dependencies:[...W].filter((E)=>!m.has(E))});return K0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function D9($,Z){let Y=f.resolve(Z),J=f.resolve($),X=Y.endsWith(f.sep)?Y:Y+f.sep;if(J===Y||J.startsWith(X))return J;return null}async function A9($,Z,Y,J){let X=await hO($,Z,Y,J);if(X===null)return null;let Q=D9(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(D9(X,W))return f.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function hO($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=D9(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await i(H)&&J)J.add(H);return H}let G=f.join(X,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await i(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(J)J.add(H);return H}}let K="",W=f.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=f.join(W,"layouts"),B=!1;try{B=EO.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await i(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(J)J.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await i(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||X,"layouts",j[1]);if(await i(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(J)J.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await i(K)){let j=f.join(K,$);if(await i(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}}let U=Y.partialsDir||f.join(process.cwd(),"views"),z=f.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=f.join(f.dirname(X),"layouts",$);if(await i(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function OG($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12715
+ `),T.__stx_event_bindings=[]}}if(o0){let E=m4(K0,F);if(E.hasScoped)K0=E.html}if(x&&m)I9.set(x,{output:K0,dependencies:[...W].filter((E)=>!m.has(E))});return K0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function D9($,Z){let Y=f.resolve(Z),J=f.resolve($),X=Y.endsWith(f.sep)?Y:Y+f.sep;if(J===Y||J.startsWith(X))return J;return null}async function A9($,Z,Y,J){let X=await uO($,Z,Y,J);if(X===null)return null;let Q=D9(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(D9(X,W))return f.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function uO($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=D9(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await i(H)&&J)J.add(H);return H}let G=f.join(X,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await i(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(J)J.add(H);return H}}let K="",W=f.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=f.join(W,"layouts"),B=!1;try{B=kO.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await i(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(J)J.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await i(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||X,"layouts",j[1]);if(await i(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(J)J.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await i(K)){let j=f.join(K,$);if(await i(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}}let U=Y.partialsDir||f.join(process.cwd(),"views"),z=f.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=f.join(f.dirname(X),"layouts",$);if(await i(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function FG($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12716
12716
  `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let q=Math.max(0,W-2),U=Math.min(G.length,W+3);Q=G.slice(q,U).map((z,j)=>{let H=q+j+1;return`${H===J?"> ":" "}${H}: ${z}`}).join(`
12717
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return OG($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function z0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=OG(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let z=J.lastIndexOf(`
12717
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return FG($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function z0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=FG(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let z=J.lastIndexOf(`
12718
12718
  `,Math.max(0,X-1));q=X-(z+1)+1}let U="";if(G>0)U+=`
12719
12719
  ${Y}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
12720
12720
  `;if(U+=`
@@ -12727,8 +12727,8 @@ ${Y0.yellow}${Y0.bold}Message:${Y0.reset} ${Z}
12727
12727
  `,K)U+=`
12728
12728
  ${Y0.blue}${Y0.bold}Context:${Y0.reset}
12729
12729
  ${Y0.dim}${K}${Y0.reset}
12730
- `;return U}function FX(){B7.clear(),H7.clear(),I9.clear()}var B7,H7,I9,kO=0,Y0;var M0=b(()=>{N5();q3();K1();Q1();E5();I4();E1();h6();N4();X$();UG();u5();B7=new Z5(500),H7=new Z5(1000),I9=new Z5(2000);Y0={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 qG($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",U=K+G[0].length,z=1,j=U,H=-1;while(z>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
12731
- `||L==="\r"||L===" "||L===void 0)z++;j=O+9}else{if(z--,z===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(U,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:U}of X)try{let z={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)z[_]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},H=n1(q.trim(),j);J=J.split(K).join(H)}catch(z){let j=z instanceof Error?z.message:String(z),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);J=J.split(K).join(H)}return J}async function FG($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),n1($.trim(),X)}var M9=b(()=>{M0()});function dO($){if(uO.set($.name,$),$.client)mO.set($.name,$.client)}function _7($){return dO($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=lO(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function lO($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var uO,mO;var E9=b(()=>{uO=new Map,mO=new Map});function k9($,Z=a5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${m$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function LG($,Z,Y=pO,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${m$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function b9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function m$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function S9($){return cO[$]||"application/octet-stream"}var a5,pO,u$,cO;var y9=b(()=>{a5=[320,480,640,768,1024,1280,1536,1920,2560],pO=[1,1.5,2,3],u$=["avif","webp","jpeg"],cO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function nO(){try{return await import("ts-images")}catch{return null}}async function sO($,Z={}){let Y={...iO,...Z},J=await nO();if(J)try{return await oO($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return rO($,Y)}async function oO($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function rO($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function VG($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
12730
+ `;return U}function LX(){B7.clear(),H7.clear(),I9.clear()}var B7,H7,I9,bO=0,Y0;var M0=b(()=>{N5();q3();K1();Q1();E5();I4();E1();h6();N4();X$();zG();u5();B7=new Z5(500),H7=new Z5(1000),I9=new Z5(2000);Y0={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 UG($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",U=K+G[0].length,z=1,j=U,H=-1;while(z>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
12731
+ `||L==="\r"||L===" "||L===void 0)z++;j=O+9}else{if(z--,z===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(U,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:U}of X)try{let z={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)z[_]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},H=n1(q.trim(),j);J=J.split(K).join(H)}catch(z){let j=z instanceof Error?z.message:String(z),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);J=J.split(K).join(H)}return J}async function LG($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),n1($.trim(),X)}var M9=b(()=>{M0()});function lO($){if(mO.set($.name,$),$.client)dO.set($.name,$.client)}function _7($){return lO($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=pO(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function pO($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var mO,dO;var E9=b(()=>{mO=new Map,dO=new Map});function k9($,Z=a5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${m$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function VG($,Z,Y=cO,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${m$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function b9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function m$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function S9($){return iO[$]||"application/octet-stream"}var a5,cO,u$,iO;var y9=b(()=>{a5=[320,480,640,768,1024,1280,1536,1920,2560],cO=[1,1.5,2,3],u$=["avif","webp","jpeg"],iO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function sO(){try{return await import("ts-images")}catch{return null}}async function oO($,Z={}){let Y={...nO,...Z},J=await sO();if(J)try{return await rO($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return aO($,Y)}async function rO($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function aO($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function wG($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
12732
12732
  #${$} {
12733
12733
  --stx-img-transition-duration: ${J}ms;
12734
12734
  --stx-img-transition-easing: ${X};
@@ -12745,7 +12745,7 @@ ${Y0.dim}${K}${Y0.reset}
12745
12745
  #${$}.stx-img-loaded img {
12746
12746
  opacity: 1;
12747
12747
  }
12748
- `.trim()}async function wG($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(P9.has(Y))return P9.get(Y);let J=await sO($,Z);return P9.set(Y,J),J}var iO,C9,P9;var RG=b(()=>{iO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},C9=`
12748
+ `.trim()}async function RG($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(P9.has(Y))return P9.get(Y);let J=await oO($,Z);return P9.set(Y,J),J}var nO,C9,P9;var AG=b(()=>{nO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},C9=`
12749
12749
  .stx-img-placeholder {
12750
12750
  position: relative;
12751
12751
  overflow: hidden;
@@ -12774,8 +12774,8 @@ ${Y0.dim}${K}${Y0.reset}
12774
12774
  filter: blur(0);
12775
12775
  transform: scale(1);
12776
12776
  }
12777
- `.trim();P9=new Map});import{createHash as MG}from"crypto";import{readFile as aO,stat as NG}from"fs/promises";async function S0($){try{let Z=await aO($);return MG("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function AG($){return MG("sha256").update($).digest("hex").slice(0,16)}function O7($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${AG($)}-${AG(Y)}`}async function v9($){try{return(await NG($)).mtimeMs}catch{return 0}}async function k0($){try{return await NG($),!0}catch{return!1}}var H5=()=>{};import{mkdir as tO,readFile as eO,writeFile as $F,readdir as OD,rm as ZF,stat as FD}from"fs/promises";import{join as IG,dirname as YF}from"path";async function JF($){try{await tO($,{recursive:!0})}catch{}}function DG($,Z,Y){return IG($,Y,`${Z}.json`)}async function TG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await v9(Z)!==$.srcMtime)return!1;return!0}async function F7($,Z,Y,J=x9){if(!J.enabled)return null;let X=O7($,Z),Q=t5.get(X);if(Q){if(await TG(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;t5.delete(X)}let G=DG(J.directory,X,Y);if(await k0(G))try{let K=await eO(G,"utf-8"),W=JSON.parse(K);if(await TG(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),t5.set(X,W),W.data}catch{}return null}async function L7($,Z,Y,J,X=x9){if(!X.enabled)return;let Q=O7($,Z),G=await S0($),K=await v9($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:O7("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};t5.set(Q,W);let q=DG(X.directory,Q,J);try{await JF(YF(q)),await $F(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function V7($,Z=x9){if($==="all")t5.clear();else t5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=IG(Z.directory,J);try{await ZF(X,{recursive:!0,force:!0})}catch{}}}var t5,x9;var f9=b(()=>{H5();t5=new Map,x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R7{config;constructor($={}){this.config={...XF,...$}}async get($,Z){return F7($,Z,"image",this.config)}async set($,Z,Y){return L7($,Z,Y,"image",this.config)}async clear(){return V7("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function g9($){if(!w7)w7=new R7($);else if($)w7.updateConfig($);return w7}async function A7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return g9(J).get($,Z)}async function M7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return g9(X).set($,Z,Y)}async function EG(){return g9().clear()}var XF,w7=null;var h9=b(()=>{f9();XF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as QF,basename as GF,extname as KF,join as WF}from"path";import{mkdir as qF}from"fs/promises";async function u9(){try{return await import("ts-images")}catch{return null}}function kG($){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 UF($,Z){let Y=Z?kG(Z):kG("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function bG($,Z,Y){let J=await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await A7($,Z,Y);if(X)return X;try{let Q=QF($);if(!await k0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=UF(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await qF(K,{recursive:!0});let q=await S0(Q),U=GF($,KF($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await m9(Q,Z.transformations,J);for(let B of z){let _=G[B]||{},O=`${U}-${q}.${B}`,F=WF(K,O);try{let L=await J.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await M7($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function SG($,Z,Y,J){let X=await u9();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function m9($,Z,Y){let J=Y||await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var yG=b(()=>{H5();h9()});import{resolve as zF,basename as jF,extname as BF,join as HF}from"path";import{mkdir as _F}from"fs/promises";async function OF(){try{return await import("ts-images")}catch{return null}}async function PG($,Z,Y){let J=await OF();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=zF($);if(!await k0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||FF,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await _F(K,{recursive:!0});let q=await S0(X),U=jF($,BF($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${U}-${O}w-${q}.${B}`,L=HF(K,F),V=`${W}/${F}`;try{let w=z[B]?.quality||80;if(await k0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await J.processImage({input:X,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||LF(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function LF($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function CG($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var FF;var vG=b(()=>{H5();FF=[320,480,640,768,1024,1280,1536,1920]});var xG={};t(xG,{setCachedImageResult:()=>M7,processImage:()=>bG,optimizeImage:()=>SG,getCachedImageResult:()=>A7,generateSrcset:()=>CG,generateResponsiveVariants:()=>PG,clearImageCache:()=>EG,applyTransformations:()=>m9,ImageProcessorCache:()=>R7});var fG=b(()=>{yG();vG();h9()});async function VF(){try{return await Promise.resolve().then(() => (fG(),xG))}catch($){if(!gG)console.warn("[stx-media] Image processor not available, some features disabled:",$),gG=!0;return null}}async function N7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return MF(J,Y)}if(Y.processedResult?.processed)return c9($,Y.processedResult,Z);if(Y.responsiveVariants)return dG($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,dpr:U,formats:z=u$,quality:j=d9,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":I7,decoding:V=T7,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:M,referrerpolicy:N}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return AF($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await wG(X,{strategy:B,..._}),C=VG(x,S,_)}catch{}let m=U!==void 0&&G!==void 0,l;if(m)l=RF($,x,S,Z);else l=await wF($,x,S,Z);let G0;if(F){let o0=z.includes("webp")?"webp":z[0],p=k9(X,q,{...H,q:j},o0),_0=typeof W==="object"?b9(W):W||"100vw";G0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${_0}" />`}let l0=[];if(!hG&&B!=="none")l0.push(C9),hG=!0;if(C)l0.push(C);let A0=O?mG(x):void 0;return{html:l,preloadLink:G0,css:l0.length>0?l0.join(`
12778
- `):void 0,script:A0}}async function wF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,formats:U=u$,quality:z=d9,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":I7,decoding:O=T7,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,M=$.style,N=$.data||{},I=typeof W==="object"?b9(W):W||"100vw",T=[];for(let P of U){let y=k9(X,q,{...j,q:z},P),S=S9(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=l9({src:m$(X,{...j,q:z}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:uG(A,Y),style:p9(M,L,V,Y),lazy:H&&!B,data:N}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
12777
+ `.trim();P9=new Map});import{createHash as NG}from"crypto";import{readFile as tO,stat as TG}from"fs/promises";async function S0($){try{let Z=await tO($);return NG("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function MG($){return NG("sha256").update($).digest("hex").slice(0,16)}function O7($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${MG($)}-${MG(Y)}`}async function v9($){try{return(await TG($)).mtimeMs}catch{return 0}}async function k0($){try{return await TG($),!0}catch{return!1}}var H5=()=>{};import{mkdir as eO,readFile as $F,writeFile as ZF,readdir as FD,rm as YF,stat as LD}from"fs/promises";import{join as DG,dirname as JF}from"path";async function XF($){try{await eO($,{recursive:!0})}catch{}}function EG($,Z,Y){return DG($,Y,`${Z}.json`)}async function IG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await v9(Z)!==$.srcMtime)return!1;return!0}async function F7($,Z,Y,J=x9){if(!J.enabled)return null;let X=O7($,Z),Q=t5.get(X);if(Q){if(await IG(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;t5.delete(X)}let G=EG(J.directory,X,Y);if(await k0(G))try{let K=await $F(G,"utf-8"),W=JSON.parse(K);if(await IG(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),t5.set(X,W),W.data}catch{}return null}async function L7($,Z,Y,J,X=x9){if(!X.enabled)return;let Q=O7($,Z),G=await S0($),K=await v9($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:O7("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};t5.set(Q,W);let q=EG(X.directory,Q,J);try{await XF(JF(q)),await ZF(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function V7($,Z=x9){if($==="all")t5.clear();else t5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=DG(Z.directory,J);try{await YF(X,{recursive:!0,force:!0})}catch{}}}var t5,x9;var f9=b(()=>{H5();t5=new Map,x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R7{config;constructor($={}){this.config={...QF,...$}}async get($,Z){return F7($,Z,"image",this.config)}async set($,Z,Y){return L7($,Z,Y,"image",this.config)}async clear(){return V7("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function g9($){if(!w7)w7=new R7($);else if($)w7.updateConfig($);return w7}async function A7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return g9(J).get($,Z)}async function M7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return g9(X).set($,Z,Y)}async function kG(){return g9().clear()}var QF,w7=null;var h9=b(()=>{f9();QF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as GF,basename as KF,extname as WF,join as qF}from"path";import{mkdir as UF}from"fs/promises";async function u9(){try{return await import("ts-images")}catch{return null}}function bG($){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 zF($,Z){let Y=Z?bG(Z):bG("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function SG($,Z,Y){let J=await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await A7($,Z,Y);if(X)return X;try{let Q=GF($);if(!await k0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=zF(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await UF(K,{recursive:!0});let q=await S0(Q),U=KF($,WF($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await m9(Q,Z.transformations,J);for(let B of z){let _=G[B]||{},O=`${U}-${q}.${B}`,F=qF(K,O);try{let L=await J.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await M7($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function yG($,Z,Y,J){let X=await u9();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function m9($,Z,Y){let J=Y||await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var PG=b(()=>{H5();h9()});import{resolve as jF,basename as BF,extname as HF,join as _F}from"path";import{mkdir as OF}from"fs/promises";async function FF(){try{return await import("ts-images")}catch{return null}}async function CG($,Z,Y){let J=await FF();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=jF($);if(!await k0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||LF,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await OF(K,{recursive:!0});let q=await S0(X),U=BF($,HF($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${U}-${O}w-${q}.${B}`,L=_F(K,F),V=`${W}/${F}`;try{let w=z[B]?.quality||80;if(await k0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await J.processImage({input:X,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||VF(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function VF($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function vG($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var LF;var xG=b(()=>{H5();LF=[320,480,640,768,1024,1280,1536,1920]});var fG={};t(fG,{setCachedImageResult:()=>M7,processImage:()=>SG,optimizeImage:()=>yG,getCachedImageResult:()=>A7,generateSrcset:()=>vG,generateResponsiveVariants:()=>CG,clearImageCache:()=>kG,applyTransformations:()=>m9,ImageProcessorCache:()=>R7});var gG=b(()=>{PG();xG();h9()});async function wF(){try{return await Promise.resolve().then(() => (gG(),fG))}catch($){if(!hG)console.warn("[stx-media] Image processor not available, some features disabled:",$),hG=!0;return null}}async function N7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return NF(J,Y)}if(Y.processedResult?.processed)return c9($,Y.processedResult,Z);if(Y.responsiveVariants)return lG($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,dpr:U,formats:z=u$,quality:j=d9,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":I7,decoding:V=T7,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:M,referrerpolicy:N}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return MF($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await RG(X,{strategy:B,..._}),C=wG(x,S,_)}catch{}let m=U!==void 0&&G!==void 0,l;if(m)l=AF($,x,S,Z);else l=await RF($,x,S,Z);let G0;if(F){let o0=z.includes("webp")?"webp":z[0],p=k9(X,q,{...H,q:j},o0),_0=typeof W==="object"?b9(W):W||"100vw";G0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${_0}" />`}let p0=[];if(!uG&&B!=="none")p0.push(C9),uG=!0;if(C)p0.push(C);let A0=O?dG(x):void 0;return{html:l,preloadLink:G0,css:p0.length>0?p0.join(`
12778
+ `):void 0,script:A0}}async function RF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,formats:U=u$,quality:z=d9,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":I7,decoding:O=T7,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,M=$.style,N=$.data||{},I=typeof W==="object"?b9(W):W||"100vw",T=[];for(let P of U){let y=k9(X,q,{...j,q:z},P),S=S9(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=l9({src:m$(X,{...j,q:z}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:mG(A,Y),style:p9(M,L,V,Y),lazy:H&&!B,data:N}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
12779
12779
  <picture>
12780
12780
  ${T.join(`
12781
12781
  `)}
@@ -12785,9 +12785,9 @@ ${T.join(`
12785
12785
  ${T.join(`
12786
12786
  `)}
12787
12787
  <img ${k} />
12788
- </picture>`;return D}function RF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=d9,params:U={},lazy:z=!0,priority:j=!1,loading:H=j?"eager":I7,decoding:B=T7,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),N=LG(X,M,W,{...U,q}),I=l9({src:m$(X,{...U,w:M,q}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:uG(w,Y),style:p9(R,O,F,Y),lazy:z&&!j,data:A}),T=z&&!j?`data-srcset="${N}"`:`srcset="${N}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
12788
+ </picture>`;return D}function AF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=d9,params:U={},lazy:z=!0,priority:j=!1,loading:H=j?"eager":I7,decoding:B=T7,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),N=VG(X,M,W,{...U,q}),I=l9({src:m$(X,{...U,w:M,q}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:mG(w,Y),style:p9(R,O,F,Y),lazy:z&&!j,data:A}),T=z&&!j?`data-srcset="${N}"`:`srcset="${N}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
12789
12789
  <img ${I} ${T} />
12790
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function AF($){let{src:Z,alt:Y,width:J,height:X,loading:Q=I7,decoding:G=T7,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${l9({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,className:H,style:p9(B,W,q),id:_,data:O})} />`}}function l9($){let Z=[];if($.lazy)Z.push(`data-src="${Y1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${Y1($.src)}"`);if(Z.push(`alt="${Y1($.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="${Y1($.className)}"`);if($.style)Z.push(`style="${Y1($.style)}"`);if($.id)Z.push(`id="${Y1($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${Y1(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function uG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function p9($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function Y1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mG($){return`
12790
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function MF($){let{src:Z,alt:Y,width:J,height:X,loading:Q=I7,decoding:G=T7,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${l9({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,className:H,style:p9(B,W,q),id:_,data:O})} />`}}function l9($){let Z=[];if($.lazy)Z.push(`data-src="${Y1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${Y1($.src)}"`);if(Z.push(`alt="${Y1($.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="${Y1($.className)}"`);if($.style)Z.push(`style="${Y1($.style)}"`);if($.id)Z.push(`id="${Y1($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${Y1(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function mG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function p9($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function Y1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dG($){return`
12791
12791
  (function() {
12792
12792
  const container = document.getElementById('${$}');
12793
12793
  if (!container) return;
@@ -12824,7 +12824,7 @@ ${T.join(`
12824
12824
 
12825
12825
  observer.observe(container);
12826
12826
  })();
12827
- `.trim()}async function MF($,Z){let Y=await VF();if(!Y)return N7({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return dG($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return c9($,Q,Z)}return N7({...$,process:!1},Z)}async function c9($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let x=w.get(C);if(x&&x.length>0){let m=x.map((G0)=>`${G0.url} ${G0.width}w`).join(", "),l=S9(C);if(G&&!K)R.push(` <source type="${l}" data-srcset="${m}" />`);else R.push(` <source type="${l}" srcset="${m}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${Y1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${Y1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${Y1(J)}"`);let N=X||Z.originalWidth,I=Q||Z.originalHeight;if(N)M.push(`width="${N}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(z)M.push(`referrerpolicy="${z}"`);let T=[];if(W)T.push(`object-fit: ${W}`);if(q)T.push(`object-position: ${q}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)M.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,x]of Object.entries(_))M.push(`data-${C}="${Y1(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
12827
+ `.trim()}async function NF($,Z){let Y=await wF();if(!Y)return N7({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return lG($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return c9($,Q,Z)}return N7({...$,process:!1},Z)}async function c9($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let x=w.get(C);if(x&&x.length>0){let m=x.map((G0)=>`${G0.url} ${G0.width}w`).join(", "),l=S9(C);if(G&&!K)R.push(` <source type="${l}" data-srcset="${m}" />`);else R.push(` <source type="${l}" srcset="${m}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${Y1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${Y1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${Y1(J)}"`);let N=X||Z.originalWidth,I=Q||Z.originalHeight;if(N)M.push(`width="${N}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(z)M.push(`referrerpolicy="${z}"`);let T=[];if(W)T.push(`object-fit: ${W}`);if(q)T.push(`object-position: ${q}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)M.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,x]of Object.entries(_))M.push(`data-${C}="${Y1(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
12828
12828
  <picture>
12829
12829
  ${R.join(`
12830
12830
  `)}
@@ -12834,12 +12834,12 @@ ${R.join(`
12834
12834
  ${R.join(`
12835
12835
  `)}
12836
12836
  <img ${M.join(" ")} />
12837
- </picture>`;let P=[];if(Z.placeholder)P.push(C9);let y=G?mG(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
12838
- `):void 0,script:y}}async function dG($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return c9($,J,Y)}var gG=!1,d9=80,T7="async",I7="lazy",hG=!1;var lG=b(()=>{y9();RG()});function NF(){return _7({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=TF($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||a5,formats:G.formats||u$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},W=Y.__isDev||!1,q=await N7(K,{isDev:W}),U=q.html;if(q.preloadLink)U=q.preloadLink+`
12837
+ </picture>`;let P=[];if(Z.placeholder)P.push(C9);let y=G?dG(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
12838
+ `):void 0,script:y}}async function lG($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return c9($,J,Y)}var hG=!1,d9=80,T7="async",I7="lazy",uG=!1;var pG=b(()=>{y9();AG()});function TF(){return _7({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=IF($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||a5,formats:G.formats||u$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},W=Y.__isDev||!1,q=await N7(K,{isDev:W}),U=q.html;if(q.preloadLink)U=q.preloadLink+`
12839
12839
  `+U;if(q.css)U+=`
12840
12840
  <style>${q.css}</style>`;if(q.script)U+=`
12841
- <script>${q.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function TF($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=IF(J),Q=i9(X[0],Y)||"",G=i9(X[1],Y)||"",K={};if(X[2]){let W=i9(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function IF($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function i9($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var pG;var cG=b(()=>{E9();lG();y9();pG=NF()});class E7{config;constructor($={}){this.config={...DF,...$}}async get($,Z){return F7($,Z,"video",this.config)}async set($,Z,Y){return L7($,Z,Y,"video",this.config)}async clear(){return V7("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function n9($){if(!D7)D7=new E7($);else if($)D7.updateConfig($);return D7}async function k7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n9(J).get($,Z)}async function b7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return n9(X).set($,Z,Y)}async function iG(){return n9().clear()}var DF,D7=null;var s9=b(()=>{f9();DF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as o9,basename as r9,extname as a9,join as S7}from"path";import{mkdir as t9}from"fs/promises";async function e9(){try{return await import("ts-videos")}catch{return null}}async function y7($,Z,Y,J){let X=await e9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=o9($);if(!await k0(Q))return null;await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),W=Z.format||"webp",q=Z.timestamp||0,U=`${K}-poster-${G}.${W}`,z=S7(Y,U),j=await X.extractThumbnails(Q,{timestamps:[q],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${W}`,"")});if(j&&j.length>0){let H=j[0];return{path:z,url:`${J}/${U}`,width:H.width||Z.width||1280,height:H.height||720,timestamp:q,size:H.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function P7($,Z,Y,J){let X=await e9();if(!X)return[];try{let Q=o9($);if(!await k0(Q))return[];await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),W=Z.format||"webp",z=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,H=Z.interval||z/j,B=[];for(let O=0;O<j&&O*H<z;O++)B.push(O*H);let _=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(_&&_.length>0)return _.map((O,F)=>({path:O.path||S7(Y,`${K}-thumb-${G}-${F}.${W}`),url:`${J}/${K}-thumb-${G}-${F}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:B[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function nG($,Z,Y,J){let X=await e9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=o9($);if(!await k0(Q))return null;await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),U=(await new X.Input(Q).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,H=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,_=Z.format||"jpeg",O=Math.ceil(U/j),F=Math.ceil(O/z),L=`${K}-sprite-${G}.${_}`,V=S7(Y,L),w=[];for(let A=0;A<O;A++)w.push(A*j);let R=await X.extractThumbnails(Q,{timestamps:w,width:H,height:B,format:_,quality:Z.quality||70,outputDir:S7(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),M=z*H,N=F*B,I=await A.createSprite({images:R.map((T)=>T.path),columns:z,padding:0,outputPath:V,format:_,quality:Z.quality||70});return{url:`${J}/${L}`,path:V,columns:z,rows:F,thumbnailWidth:H,thumbnailHeight:B,interval:j,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var $8=b(()=>{H5()});import{resolve as oG,basename as rG,extname as aG,join as _5}from"path";import{mkdir as C7,writeFile as tG}from"fs/promises";async function eG(){try{return await import("ts-videos")}catch{return null}}async function v7($,Z,Y,J,X){let Q=await eG();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=oG($);if(!await k0(G))return null;let K=await S0(G),W=rG($,aG($)),q=_5(Y,`${W}-${K}-hls`);await C7(q,{recursive:!0});let U=Z.length>0?Z:$K,z=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,_=[],O=0;for(let V of U){let w=_5(q,V.label);await C7(w,{recursive:!0});let R=`${V.label}.m3u8`,A=_5(w,R);try{let M=await Q.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(M)_.push({quality:V,url:`${J}/${W}-${K}-hls/${V.label}/${R}`,path:A}),O+=M.segmentCount||Math.ceil(B/z)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${M}`)}}if(_.length===0)return null;let F=_5(q,"master.m3u8"),L=EF(_,J,W,K);return await tG(F,L),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:F,playlists:_,segmentCount:O,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function EF($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
12842
- `)}async function x7($,Z,Y,J,X){let Q=await eG();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=oG($);if(!await k0(G))return null;let K=await S0(G),W=rG($,aG($)),q=_5(Y,`${W}-${K}-dash`);await C7(q,{recursive:!0});let U=Z.length>0?Z:$K,z=X?.segmentDuration||4,j=X?.minBufferTime||2,_=(await new Q.Input(G).getInfo()).duration||0,O=[],F=[];for(let R of U){let A=_5(q,R.label);await C7(A,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(O.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${J}/${W}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${J}/${W}-${K}-dash/${R.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${M}`)}}if(O.length===0)return null;let L=_5(q,"manifest.mpd"),V=kF(O,F,_,z,j);await tG(L,V);let w=[{type:"video",representations:O}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:w,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function kF($,Z,Y,J,X){let Q=sG(Y),G=sG(X),K=`<?xml version="1.0" encoding="UTF-8"?>
12841
+ <script>${q.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function IF($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=DF(J),Q=i9(X[0],Y)||"",G=i9(X[1],Y)||"",K={};if(X[2]){let W=i9(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function DF($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function i9($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var cG;var iG=b(()=>{E9();pG();y9();cG=TF()});class E7{config;constructor($={}){this.config={...EF,...$}}async get($,Z){return F7($,Z,"video",this.config)}async set($,Z,Y){return L7($,Z,Y,"video",this.config)}async clear(){return V7("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function n9($){if(!D7)D7=new E7($);else if($)D7.updateConfig($);return D7}async function k7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n9(J).get($,Z)}async function b7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return n9(X).set($,Z,Y)}async function nG(){return n9().clear()}var EF,D7=null;var s9=b(()=>{f9();EF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as o9,basename as r9,extname as a9,join as S7}from"path";import{mkdir as t9}from"fs/promises";async function e9(){try{return await import("ts-videos")}catch{return null}}async function y7($,Z,Y,J){let X=await e9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=o9($);if(!await k0(Q))return null;await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),W=Z.format||"webp",q=Z.timestamp||0,U=`${K}-poster-${G}.${W}`,z=S7(Y,U),j=await X.extractThumbnails(Q,{timestamps:[q],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${W}`,"")});if(j&&j.length>0){let H=j[0];return{path:z,url:`${J}/${U}`,width:H.width||Z.width||1280,height:H.height||720,timestamp:q,size:H.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function P7($,Z,Y,J){let X=await e9();if(!X)return[];try{let Q=o9($);if(!await k0(Q))return[];await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),W=Z.format||"webp",z=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,H=Z.interval||z/j,B=[];for(let O=0;O<j&&O*H<z;O++)B.push(O*H);let _=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(_&&_.length>0)return _.map((O,F)=>({path:O.path||S7(Y,`${K}-thumb-${G}-${F}.${W}`),url:`${J}/${K}-thumb-${G}-${F}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:B[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function sG($,Z,Y,J){let X=await e9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=o9($);if(!await k0(Q))return null;await t9(Y,{recursive:!0});let G=await S0(Q),K=r9($,a9($)),U=(await new X.Input(Q).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,H=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,_=Z.format||"jpeg",O=Math.ceil(U/j),F=Math.ceil(O/z),L=`${K}-sprite-${G}.${_}`,V=S7(Y,L),w=[];for(let A=0;A<O;A++)w.push(A*j);let R=await X.extractThumbnails(Q,{timestamps:w,width:H,height:B,format:_,quality:Z.quality||70,outputDir:S7(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),M=z*H,N=F*B,I=await A.createSprite({images:R.map((T)=>T.path),columns:z,padding:0,outputPath:V,format:_,quality:Z.quality||70});return{url:`${J}/${L}`,path:V,columns:z,rows:F,thumbnailWidth:H,thumbnailHeight:B,interval:j,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var $8=b(()=>{H5()});import{resolve as rG,basename as aG,extname as tG,join as _5}from"path";import{mkdir as C7,writeFile as eG}from"fs/promises";async function $K(){try{return await import("ts-videos")}catch{return null}}async function v7($,Z,Y,J,X){let Q=await $K();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=rG($);if(!await k0(G))return null;let K=await S0(G),W=aG($,tG($)),q=_5(Y,`${W}-${K}-hls`);await C7(q,{recursive:!0});let U=Z.length>0?Z:ZK,z=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,_=[],O=0;for(let V of U){let w=_5(q,V.label);await C7(w,{recursive:!0});let R=`${V.label}.m3u8`,A=_5(w,R);try{let M=await Q.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(M)_.push({quality:V,url:`${J}/${W}-${K}-hls/${V.label}/${R}`,path:A}),O+=M.segmentCount||Math.ceil(B/z)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${M}`)}}if(_.length===0)return null;let F=_5(q,"master.m3u8"),L=kF(_,J,W,K);return await eG(F,L),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:F,playlists:_,segmentCount:O,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function kF($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
12842
+ `)}async function x7($,Z,Y,J,X){let Q=await $K();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=rG($);if(!await k0(G))return null;let K=await S0(G),W=aG($,tG($)),q=_5(Y,`${W}-${K}-dash`);await C7(q,{recursive:!0});let U=Z.length>0?Z:ZK,z=X?.segmentDuration||4,j=X?.minBufferTime||2,_=(await new Q.Input(G).getInfo()).duration||0,O=[],F=[];for(let R of U){let A=_5(q,R.label);await C7(A,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(O.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${J}/${W}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${J}/${W}-${K}-dash/${R.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${M}`)}}if(O.length===0)return null;let L=_5(q,"manifest.mpd"),V=bF(O,F,_,z,j);await eG(L,V);let w=[{type:"video",representations:O}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:w,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function bF($,Z,Y,J,X){let Q=oG(Y),G=oG(X),K=`<?xml version="1.0" encoding="UTF-8"?>
12843
12843
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
12844
12844
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12845
12845
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -12865,7 +12865,7 @@ ${R.join(`
12865
12865
  </Representation>
12866
12866
  `}K+=` </AdaptationSet>
12867
12867
  `}return K+=` </Period>
12868
- </MPD>`,K}function sG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var $K;var Z8=b(()=>{H5();$K=[{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 ZK,basename as bF,extname as SF,join as yF}from"path";import{mkdir as PF}from"fs/promises";async function YK(){try{return await import("ts-videos")}catch{return null}}function CF($){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 vF($){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 Y8($){let Z=await YK();if(!Z)return null;try{let Y=ZK($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function JK($,Z,Y,J){let X=await YK();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await k7($,Z,Y);if(Q)return Q;try{let G=ZK($);if(!await k0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await PF(K,{recursive:!0});let q=await S0(G),U=bF($,SF($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await Y8(G)||void 0;let j={};if(Z.quality)j.bitrate=CF(Z.quality);if(Z.platform)Object.assign(j,vF(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let H=`${U}-${q}.mp4`,B=yF(K,H);try{let _=await xF(G,B,j,X,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)z.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await y7(G,H,K,W);if(B)z.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let H=await P7(G,Y.thumbnails,K,W);if(H.length>0)z.thumbnails=H}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await v7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,hls:B}}if(H.format==="dash"){let B=await x7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await b7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xF($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var XK=b(()=>{H5();s9();$8();Z8()});var QK={};t(QK,{setCachedVideoResult:()=>b7,processVideo:()=>JK,getCachedVideoResult:()=>k7,generateThumbnails:()=>P7,generateSpriteSheet:()=>nG,generatePoster:()=>y7,generateHLSManifest:()=>v7,generateDASHManifest:()=>x7,clearVideoCache:()=>iG,analyzeVideo:()=>Y8,VideoProcessorCache:()=>E7});var GK=b(()=>{XK();$8();Z8();s9()});async function WK(){try{return await Promise.resolve().then(() => (GK(),QK))}catch($){if(!KK)console.warn("[stx-media] Video processor not available, some features disabled:",$),KK=!0;return null}}async function f7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return dF(J,Y)}if(Y.processedResult?.processed)return jK($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await lF(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=qK,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:H=UK,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,M=X||K,N=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return hF($,Z);if(F&&F!=="video")return gF(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:zK(Q)}]:[],D=[`id="${T}"`];if(q)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),M)D.push(`data-poster="${R0(M)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),M)D.push(`poster="${R0(M)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(N)D.push(`class="${R0(N)}"`);if(I)D.push(`style="${R0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
12868
+ </MPD>`,K}function oG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var ZK;var Z8=b(()=>{H5();ZK=[{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 YK,basename as SF,extname as yF,join as PF}from"path";import{mkdir as CF}from"fs/promises";async function JK(){try{return await import("ts-videos")}catch{return null}}function vF($){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 xF($){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 Y8($){let Z=await JK();if(!Z)return null;try{let Y=YK($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function XK($,Z,Y,J){let X=await JK();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await k7($,Z,Y);if(Q)return Q;try{let G=YK($);if(!await k0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await CF(K,{recursive:!0});let q=await S0(G),U=SF($,yF($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await Y8(G)||void 0;let j={};if(Z.quality)j.bitrate=vF(Z.quality);if(Z.platform)Object.assign(j,xF(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let H=`${U}-${q}.mp4`,B=PF(K,H);try{let _=await fF(G,B,j,X,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)z.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await y7(G,H,K,W);if(B)z.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let H=await P7(G,Y.thumbnails,K,W);if(H.length>0)z.thumbnails=H}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await v7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,hls:B}}if(H.format==="dash"){let B=await x7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await b7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function fF($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var QK=b(()=>{H5();s9();$8();Z8()});var GK={};t(GK,{setCachedVideoResult:()=>b7,processVideo:()=>XK,getCachedVideoResult:()=>k7,generateThumbnails:()=>P7,generateSpriteSheet:()=>sG,generatePoster:()=>y7,generateHLSManifest:()=>v7,generateDASHManifest:()=>x7,clearVideoCache:()=>nG,analyzeVideo:()=>Y8,VideoProcessorCache:()=>E7});var KK=b(()=>{QK();$8();Z8();s9()});async function qK(){try{return await Promise.resolve().then(() => (KK(),GK))}catch($){if(!WK)console.warn("[stx-media] Video processor not available, some features disabled:",$),WK=!0;return null}}async function f7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return lF(J,Y)}if(Y.processedResult?.processed)return BK($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await pF(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=UK,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:H=zK,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,M=X||K,N=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return uF($,Z);if(F&&F!=="video")return hF(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:jK(Q)}]:[],D=[`id="${T}"`];if(q)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),M)D.push(`data-poster="${R0(M)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),M)D.push(`poster="${R0(M)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(N)D.push(`class="${R0(N)}"`);if(I)D.push(`style="${R0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
12869
12869
  `),y=`<video ${D.join(" ")}>
12870
12870
  ${P}
12871
12871
  Your browser does not support the video tag.
@@ -12904,9 +12904,9 @@ ${P}
12904
12904
 
12905
12905
  observer.observe(video);
12906
12906
  })();
12907
- `.trim();return{html:y,script:S}}function gF($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch(Z){case"youtube":q=uF($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=mF($),W=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let U=[`id="${K}"`,`src="${R0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)U.push(`class="${R0(Q)}"`);if(G)U.push(`style="${R0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
12907
+ `.trim();return{html:y,script:S}}function hF($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch(Z){case"youtube":q=mF($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=dF($),W=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let U=[`id="${K}"`,`src="${R0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)U.push(`class="${R0(Q)}"`);if(G)U.push(`style="${R0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
12908
12908
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
12909
- </div>`}}function hF($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:q="metadata",playsinline:U=!0,lazy:z=!0,width:j,height:H}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:U,preload:q,poster:X,controls:Q,title:$.title},L=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",H?`height: ${typeof H==="number"?H+"px":H}`:"",_||""].filter(Boolean).join("; "),V=`
12909
+ </div>`}}function uF($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:q="metadata",playsinline:U=!0,lazy:z=!0,width:j,height:H}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:U,preload:q,poster:X,controls:Q,title:$.title},L=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",H?`height: ${typeof H==="number"?H+"px":H}`:"",_||""].filter(Boolean).join("; "),V=`
12910
12910
  <div
12911
12911
  id="${O}"
12912
12912
  class="ts-video-player${B?" "+R0(B):""}"
@@ -12943,7 +12943,7 @@ ${P}
12943
12943
 
12944
12944
  // Load ts-video-player from CDN
12945
12945
  var script = document.createElement('script');
12946
- script.src = '${fF}';
12946
+ script.src = '${gF}';
12947
12947
  script.onload = initPlayer;
12948
12948
  script.onerror = function() {
12949
12949
  console.error('[stx] Failed to load ts-video-player');
@@ -13073,7 +13073,7 @@ else {
13073
13073
  .ts-video-player__play-button svg {
13074
13074
  margin-left: 4px;
13075
13075
  }
13076
- `.trim();return{html:V,script:w,css:R}}function zK($){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 uF($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function mF($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function dF($,Z){let Y=await WK();if(!Y)return f7({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return jK($,X,Z);return f7({...$,process:!1},Z)}async function lF($,Z){let Y=await WK();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function jK($,Z,Y){let{controls:J=qK,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=UK,playsinline:W=!0,lazy:q=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:H=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,V=zK(L);if(Z.transcoded)L=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(J)A.push("controls");if(X)A.push("autoplay");if(Q)A.push("muted");if(G)A.push("loop");if(W)A.push("playsinline");if(H)A.push("disablepictureinpicture");if(B)A.push("disableremoteplayback");if(j)A.push(`crossorigin="${j}"`);if(q){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${R0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${R0(R)}"`);let M=U||Z.metadata?.width,N=z||Z.metadata?.height;if(M)A.push(`width="${M}"`);if(N)A.push(`height="${N}"`);if(_)A.push(`class="${R0(_)}"`);if(O)A.push(`style="${R0(O)}"`);let T=` <source ${q?`data-src="${R0(L)}"`:`src="${R0(L)}"`} type="${V}" />`,k=`<video ${A.join(" ")}>
13076
+ `.trim();return{html:V,script:w,css:R}}function jK($){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 mF($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function dF($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function lF($,Z){let Y=await qK();if(!Y)return f7({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return BK($,X,Z);return f7({...$,process:!1},Z)}async function pF($,Z){let Y=await qK();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function BK($,Z,Y){let{controls:J=UK,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=zK,playsinline:W=!0,lazy:q=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:H=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,V=jK(L);if(Z.transcoded)L=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(J)A.push("controls");if(X)A.push("autoplay");if(Q)A.push("muted");if(G)A.push("loop");if(W)A.push("playsinline");if(H)A.push("disablepictureinpicture");if(B)A.push("disableremoteplayback");if(j)A.push(`crossorigin="${j}"`);if(q){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${R0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${R0(R)}"`);let M=U||Z.metadata?.width,N=z||Z.metadata?.height;if(M)A.push(`width="${M}"`);if(N)A.push(`height="${N}"`);if(_)A.push(`class="${R0(_)}"`);if(O)A.push(`style="${R0(O)}"`);let T=` <source ${q?`data-src="${R0(L)}"`:`src="${R0(L)}"`} type="${V}" />`,k=`<video ${A.join(" ")}>
13077
13077
  ${T}
13078
13078
  Your browser does not support the video tag.
13079
13079
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${R0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -13122,9 +13122,9 @@ ${k}
13122
13122
  width: 100%;
13123
13123
  height: auto;
13124
13124
  }
13125
- `.trim();return{html:k,script:D,css:P}}var KK=!1,qK=!0,UK="metadata",fF="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var BK=b(()=>{X8()});function HK(){return _7({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=pF($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},q=await f7(G,W),U=q.html;if(q.css)U+=`
13125
+ `.trim();return{html:k,script:D,css:P}}var WK=!1,UK=!0,zK="metadata",gF="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var HK=b(()=>{X8()});function _K(){return _7({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=cF($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},q=await f7(G,W),U=q.html;if(q.css)U+=`
13126
13126
  <style>${q.css}</style>`;if(q.script)U+=`
13127
- <script>${q.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function pF($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=cF(J),Q=_K(X[0],Y)||"",G={};if(X[1]){let K=_K(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function cF($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function _K($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var J8;var X8=b(()=>{E9();BK();J8=HK()});function iF($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
13127
+ <script>${q.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function cF($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=iF(J),Q=OK(X[0],Y)||"",G={};if(X[1]){let K=OK(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function iF($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function OK($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var J8;var X8=b(()=>{E9();HK();J8=_K()});function nF($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
13128
13128
  ${$}
13129
13129
  </div>
13130
13130
  <script>
@@ -13169,7 +13169,7 @@ ${k}
13169
13169
  }
13170
13170
  }
13171
13171
  })();
13172
- </script>`}function nF($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
13172
+ </script>`}function sF($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
13173
13173
  <div class="stx-pwa-update-banner" style="
13174
13174
  position: fixed;
13175
13175
  bottom: 0;
@@ -13280,7 +13280,7 @@ else {
13280
13280
  // Also listen for custom event
13281
13281
  window.addEventListener('pwa-update-available', showUpdate);
13282
13282
  })();
13283
- </script>`}function sF($,Z){let Y=$.trim().length>0,J=`
13283
+ </script>`}function oF($,Z){let Y=$.trim().length>0,J=`
13284
13284
  <div class="stx-offline-indicator" style="
13285
13285
  position: fixed;
13286
13286
  top: 16px;
@@ -13341,7 +13341,7 @@ else {
13341
13341
  window.addEventListener('offline', updateStatus);
13342
13342
  updateStatus();
13343
13343
  })();
13344
- </script>`}function oF($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
13344
+ </script>`}function rF($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
13345
13345
  ${$}
13346
13346
  </div>
13347
13347
  <script>
@@ -13423,7 +13423,7 @@ catch (error) {
13423
13423
  init();
13424
13424
  }
13425
13425
  })();
13426
- </script>`}var rF,aF,tF,eF,OK;var FK=b(()=>{rF={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return iF($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},aF={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return nF($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},tF={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return sF($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},eF={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return oF($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},OK=[rF,aF,tF,eF]});import d$ from"path";function $L($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let j=z[1],H=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(H)X=H[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=j.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=q?q[1].trim():"";return{tag:X,props:Q,template:W,styles:U,script:J,shadowDOM:G}}function ZL($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
13426
+ </script>`}var aF,tF,eF,$L,FK;var LK=b(()=>{aF={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return nF($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},tF={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return sF($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},eF={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return oF($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},$L={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return rF($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},FK=[aF,tF,eF,$L]});import d$ from"path";function ZL($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let j=z[1],H=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(H)X=H[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=j.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=q?q[1].trim():"";return{tag:X,props:Q,template:W,styles:U,script:J,shadowDOM:G}}function YL($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
13427
13427
  get ${z}() {
13428
13428
  return this.getAttribute('${z}') || '';
13429
13429
  }
@@ -13474,9 +13474,9 @@ ${U}
13474
13474
  }
13475
13475
 
13476
13476
  customElements.define('${Z}', ${G});
13477
- `}async function LK($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[d$.join(d$.dirname(J),G,`${X}.stx`),d$.join(process.cwd(),G,`${X}.stx`),d$.join(d$.dirname(J),`${X}.stx`)],W=null;for(let z of K)if(await i(z)){W=await Bun.file(z).text();break}if(!W)return Z0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=$L(W,X);return`<script type="module">
13478
- ${ZL(q)}
13479
- </script>`}var VK=b(()=>{V1();M0()});var wK={};t(wK,{timingPlugin:()=>GL,pluginManager:()=>YL,definePlugin:()=>g7,debugPlugin:()=>QL,createVariablesPlugin:()=>KL,createFilterPlugin:()=>XL,createDirectivePlugin:()=>JL,PluginManager:()=>Q8});function g7($){return $}class Q8{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function JL($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function XL($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function KL($){return g7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var YL,QL,GL;var RK=b(()=>{YL=new Q8;QL=g7({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)}}),GL=g7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var J2={};t(J2,{validateConfig:()=>HL,resolveStxDirectories:()=>NK,loadStxConfig:()=>u1,defineStxConfig:()=>BL,defaultConfig:()=>R1,config:()=>z$});import h7 from"fs";import d0 from"path";import{loadConfigWithResult as WL}from"bunfig";function qL($,Z,Y){let J=Z||"pages";if($)return{root:$,pagesDir:J};let X=Y||process.cwd(),Q=d0.join(X,"resources","views"),G=d0.join(X,"resources","layouts");if(h7.existsSync(Q)&&h7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=d0.join(X,"resources","views","pages");if(h7.existsSync(K))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function UL($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let J=$.replace(/\\/g,"/"),X=Y.replace(/\\/g,"/");return J===X||J.startsWith(`${X}/`)}function NK($,Z){let Y=!$.root,J=qL($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,Y&&J.root!=="."){let X=`${Z}::${J.root}`;if(!AK.has(X))AK.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(d0.isAbsolute(G)||UL(G,X))continue;$[Q]=d0.join(X,G)}}return $}function zL($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let J of Y){let X=$[J];if(typeof X!=="string"||!X)continue;let Q=d0.isAbsolute(X)?X:d0.join(Z,X);if(h7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function jL($){if(GZ($.stateDir),$.stateDir=G$(),$.cachePath=W$($.cachePath),$.build)$.build.cacheDir=W$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=W$($.media.cache.directory);if($.story)$.story.outDir=W$($.story.outDir)}async function u1($){if(!$){if(e5)return e5;if(u7)return u7}let Z=$?d0.resolve($):process.cwd(),Y=MK.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await WL({name:"stx",alias:"ui",cwd:Z,defaultConfig:R1,verbose:!1})).config;if(jL(Q),NK(Q,Z),zL(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (RK(),wK)),K=[],W=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(U),H=d0.dirname(e.resolve(U))}catch{let _=d0.resolve(process.cwd(),U);j=await import(_),H=d0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(d0.resolve(H,O))}if(B.pages){let _=d0.resolve(H,B.pages),O=z.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(z,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(MK.set(Z,J),!$)u7=J,J.then((X)=>{e5=X}).catch(()=>{});return J}function BL($){return $}function HL($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var R1,AK,e5=null,MK,u7=null,z$;var O1=b(()=>{s7();o7();r7();a7();M9();cG();X8();FK();v6();o$();VK();R1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,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:FG,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:LK,hasEndTag:!1,description:"Include a web component in the template"},y8,P8,DJ,EJ,C8,x8,f8,v8,m8,p8,pG,J8,...OK],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};AK=new Set;MK=new Map;z$=new Proxy(R1,{get($,Z){if(e5&&Z in e5)return e5[Z];if(!u7)u1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var xL=`
13477
+ `}async function VK($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[d$.join(d$.dirname(J),G,`${X}.stx`),d$.join(process.cwd(),G,`${X}.stx`),d$.join(d$.dirname(J),`${X}.stx`)],W=null;for(let z of K)if(await i(z)){W=await Bun.file(z).text();break}if(!W)return Z0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=ZL(W,X);return`<script type="module">
13478
+ ${YL(q)}
13479
+ </script>`}var wK=b(()=>{V1();M0()});var RK={};t(RK,{timingPlugin:()=>KL,pluginManager:()=>JL,definePlugin:()=>g7,debugPlugin:()=>GL,createVariablesPlugin:()=>WL,createFilterPlugin:()=>QL,createDirectivePlugin:()=>XL,PluginManager:()=>Q8});function g7($){return $}class Q8{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function XL($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function QL($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function WL($){return g7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var JL,GL,KL;var AK=b(()=>{JL=new Q8;GL=g7({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)}}),KL=g7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var X2={};t(X2,{validateConfig:()=>_L,resolveStxDirectories:()=>TK,loadStxConfig:()=>u1,defineStxConfig:()=>HL,defaultConfig:()=>R1,config:()=>z$});import h7 from"fs";import l0 from"path";import{loadConfigWithResult as qL}from"bunfig";function UL($,Z,Y){let J=Z||"pages";if($)return{root:$,pagesDir:J};let X=Y||process.cwd(),Q=l0.join(X,"resources","views"),G=l0.join(X,"resources","layouts");if(h7.existsSync(Q)&&h7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=l0.join(X,"resources","views","pages");if(h7.existsSync(K))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function zL($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let J=$.replace(/\\/g,"/"),X=Y.replace(/\\/g,"/");return J===X||J.startsWith(`${X}/`)}function TK($,Z){let Y=!$.root,J=UL($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,Y&&J.root!=="."){let X=`${Z}::${J.root}`;if(!MK.has(X))MK.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(l0.isAbsolute(G)||zL(G,X))continue;$[Q]=l0.join(X,G)}}return $}function jL($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let J of Y){let X=$[J];if(typeof X!=="string"||!X)continue;let Q=l0.isAbsolute(X)?X:l0.join(Z,X);if(h7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function BL($){if(GZ($.stateDir),$.stateDir=G$(),$.cachePath=W$($.cachePath),$.build)$.build.cacheDir=W$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=W$($.media.cache.directory);if($.story)$.story.outDir=W$($.story.outDir)}async function u1($){if(!$){if(e5)return e5;if(u7)return u7}let Z=$?l0.resolve($):process.cwd(),Y=NK.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await qL({name:"stx",alias:"ui",cwd:Z,defaultConfig:R1,verbose:!1})).config;if(BL(Q),TK(Q,Z),jL(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (AK(),RK)),K=[],W=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(U),H=l0.dirname(e.resolve(U))}catch{let _=l0.resolve(process.cwd(),U);j=await import(_),H=l0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(l0.resolve(H,O))}if(B.pages){let _=l0.resolve(H,B.pages),O=z.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(z,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(NK.set(Z,J),!$)u7=J,J.then((X)=>{e5=X}).catch(()=>{});return J}function HL($){return $}function _L($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var R1,MK,e5=null,NK,u7=null,z$;var O1=b(()=>{s7();o7();r7();a7();M9();iG();X8();LK();v6();o$();wK();R1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,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:LG,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:VK,hasEndTag:!1,description:"Include a web component in the template"},y8,P8,EJ,kJ,C8,x8,f8,v8,m8,p8,cG,J8,...FK],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};MK=new Set;NK=new Map;z$=new Proxy(R1,{get($,Z){if(e5&&Z in e5)return e5[Z];if(!u7)u1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var fL=`
13480
13480
  <script>
13481
13481
  (function() {
13482
13482
  'use strict';
@@ -14408,14 +14408,14 @@ else if (data.type === 'event' && data.method) {
14408
14408
  }
14409
14409
  })();
14410
14410
  </script>
14411
- `.replace("debug: false,",`debug: ${Z},`).replace("timeout: 30000",`timeout: ${Y}`)}function fL(){return!1}function gL($,Z={}){let Y=/@craft(?:\(([\s\S]*?)\))?/g;return $.replace(Y,(J,X)=>{let Q={};if(X)try{Q=JSON.parse(X.replace(/'/g,'"'))}catch{try{Q=Function(`return ${X}`)()}catch{console.warn(`[stx] Invalid @craft config: ${X}`)}}return q8(Q)})}function U8($,Z={}){if($.includes("__craftBridgeInitialized"))return $;let Y=q8(Z);if($.includes("</head>"))return $.replace("</head>",`${Y}
14411
+ `.replace("debug: false,",`debug: ${Z},`).replace("timeout: 30000",`timeout: ${Y}`)}function gL(){return!1}function hL($,Z={}){let Y=/@craft(?:\(([\s\S]*?)\))?/g;return $.replace(Y,(J,X)=>{let Q={};if(X)try{Q=JSON.parse(X.replace(/'/g,'"'))}catch{try{Q=Function(`return ${X}`)()}catch{console.warn(`[stx] Invalid @craft config: ${X}`)}}return q8(Q)})}function U8($,Z={}){if($.includes("__craftBridgeInitialized"))return $;let Y=q8(Z);if($.includes("</head>"))return $.replace("</head>",`${Y}
14412
14412
  </head>`);if($.includes("<body"))return $.replace(/(<body[^>]*>)/,`$1
14413
- ${Y}`);return Y+$}var fK=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function uL($,Z={}){let Y=performance.now(),J={target:Z.target||"universal",format:Z.format||"zig",optimize:Z.optimize??!0,treeShake:Z.treeShake??!0,hotReload:Z.hotReload??!1,debug:Z.debug??!1,sourceMaps:Z.sourceMaps??!1,bundle:Z.bundle??!0,minify:Z.minify??!1,components:Z.components||fK},X=typeof $==="string"?gK($):$,Q=uK(X.tree,J),G=nK(Q),K=J.treeShake?oK(Q,G):Q,W=new Map;if(J.target==="universal"){let H=["macos","windows","linux","ios","android"];for(let B of H){let _=p7(K,{...J,target:B});W.set(B,_)}}else{let H=p7(K,J);W.set(J.target,H)}let q=tK(K,J,W),U=eK(X,K,J),z={compilationTime:performance.now()-Y,totalComponents:c7(X.tree),nativeComponents:i7(K),webComponents:c7(X.tree)-i7(K),bundleSize:q.length,treeShakenSize:J.treeShake?rK(Q,K):q.length,warnings:[],errors:[]},j;if(J.sourceMaps)j=$W(X,K);return{code:q,platformCode:W,dependencies:G,manifest:U,sourceMaps:j,stats:z}}function gK($){let Z={type:"fragment",children:[]},Y=$.match(/<body[^>]*>([\s\S]*?)<\/body>/i),J=Y?Y[1]:$;return j8(J,Z),{id:F8(),hash:L8($),tree:Z,scripts:JW($),styles:XW($),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:$.includes("{{"),hasEventHandlers:$.includes("onclick")||$.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:$.length}}}function j8($,Z){let Y=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,J;while((J=Y.exec($))!==null){let[,X,Q,G]=J,K=X.startsWith("@craft-"),W={type:K?"component":"element",tag:K?X.slice(1):X,props:hK(Q),children:[],componentName:K?X.slice(1):void 0};if(G){let q=G.replace(/<[^>]+>/g,"").trim();if(q)W.children=W.children??[],W.children.push({type:"text",text:q});j8(G,W)}Z.children=Z.children??[],Z.children.push(W)}}function hK($){let Z={},Y=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,J;while((J=Y.exec($))!==null){let[,X,Q]=J;Z[X]=Q??!0}return Z}function uK($,Z){return B8($,Z)}function B8($,Z){let Y=$.componentName?Z.components?.get($.componentName):void 0,J="craft.View";if(Y)J=Y.zigType;else if($.type==="text")J="craft.Text";else if($.tag)J=mK($.tag);let X={};if($.props)for(let[W,q]of Object.entries($.props))X[W]=dK(q);let Q=[];if($.children)for(let W of $.children)Q.push(B8(W,Z));let G=new Map;if($.props){for(let[W,q]of Object.entries($.props))if(W.startsWith("on")&&typeof q==="string")G.set(W.slice(2).toLowerCase(),q)}let K=pK($);return{type:lK($,Y),zigType:J,props:X,children:Q,events:G,styles:K,id:$.hydrationKey,key:$.props?.key}}function mK($){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[$.toLowerCase()]||"craft.View"}function dK($){if(typeof $==="string"){if($.startsWith("{{")&&$.endsWith("}}"))return{type:"binding",path:$.slice(2,-2).trim()};if($.includes("(")&&$.includes(")"))return{type:"callback",handler:$};return{type:"literal",value:$}}if(typeof $==="number"||typeof $==="boolean")return{type:"literal",value:$};return{type:"literal",value:String($)}}function lK($,Z){if(Z){let J=Z.name.toLowerCase();if(J.includes("button"))return"button";if(J.includes("input")||J.includes("text"))return"input";if(J.includes("image")||J.includes("avatar"))return"image";if(J.includes("list")||J.includes("table"))return"list";if(J.includes("scroll"))return"scroll";return"custom"}if($.type==="text")return"text";let Y=$.tag?.toLowerCase();if(Y==="button")return"button";if(Y==="input"||Y==="textarea")return"input";if(Y==="img")return"image";if(Y==="ul"||Y==="ol")return"list";return"view"}function pK($){let Z=$.props?.style,Y={},J={};if(Z){let X=Z.split(";").filter(Boolean);for(let Q of X){let[G,K]=Q.split(":").map((W)=>W.trim());if(!G||!K)continue;switch(G){case"display":Y.display=K;break;case"flex-direction":Y.flexDirection=K;break;case"justify-content":Y.justifyContent=cK(K);break;case"align-items":Y.alignItems=iK(K);break;case"gap":Y.gap=Number.parseInt(K,10);break;case"padding":Y.padding=Number.parseInt(K,10);break;case"margin":Y.margin=Number.parseInt(K,10);break;case"width":Y.width=K==="auto"?"auto":Number.parseInt(K,10);break;case"height":Y.height=K==="auto"?"auto":Number.parseInt(K,10);break;case"background-color":case"background":J.backgroundColor=K;break;case"border-color":J.borderColor=K;break;case"border-width":J.borderWidth=Number.parseInt(K,10);break;case"border-radius":J.borderRadius=Number.parseInt(K,10);break;case"opacity":J.opacity=Number.parseFloat(K);break}}}return{layout:Y,appearance:J}}function cK($){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[$]||"start"}function iK($){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[$]||"start"}function nK($){let Z=[],Y=new Set;function J(X,Q){let G=X.id||F8();if(Y.has(G))return;Y.add(G);let K={id:G,type:"component",path:X.zigType,dependencies:Q?[Q]:[],size:H8(X),isStatic:sK(X)};Z.push(K);for(let W of X.children)J(W,G)}return J($),Z}function H8($){let Z=100;return Z+=Object.keys($.props).length*20,Z+=$.events.size*50,Z}function sK($){for(let Z of Object.values($.props))if(Z.type!=="literal")return!1;return $.events.size===0}function oK($,Z){return $}function rK($,Z){let Y=0;function J(X){Y+=H8(X);for(let Q of X.children)J(Q)}return J(Z),Y}function p7($,Z){switch(Z.format){case"zig":return z8($,Z);case"typescript":return aK($,Z);case"json":return JSON.stringify($,null,Z.minify?0:2);default:return z8($,Z)}}function z8($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('const std = @import("std");'),Y.push('const craft = @import("craft");'),Y.push(""),Y.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Y.push(" return try build(allocator);"),Y.push("}"),Y.push(""),_8($,Y,0),Y.join(`
14414
- `)}function _8($,Z,Y){let J=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let X=`node_${Y}`;Z.push(`${J} var ${X} = try ${$.zigType}.init(allocator);`);for(let[Q,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${J} ${X}.set${YW(Q)}(${K});`)}for(let Q=0;Q<$.children.length;Q++){let G=$.children[Q];if(G.type==="text"){let K=G.props.text?.type==="literal"?String(G.props.text.value):"";Z.push(`${J} try ${X}.addChild(try craft.Text.init(allocator, "${K}"));`)}else _8(G,Z,Y+1),Z.push(`${J} try ${X}.addChild(node_${Y+1});`)}if(Y===0)Z.push(` return ${X}.element();`),Z.push("}")}function aK($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('import { Craft } from "@stacksjs/craft";'),Y.push(""),Y.push("export function render(): Craft.Element {"),Y.push(" return "+O8($,1)+";"),Y.push("}"),Y.join(`
14413
+ ${Y}`);return Y+$}var gK=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function mL($,Z={}){let Y=performance.now(),J={target:Z.target||"universal",format:Z.format||"zig",optimize:Z.optimize??!0,treeShake:Z.treeShake??!0,hotReload:Z.hotReload??!1,debug:Z.debug??!1,sourceMaps:Z.sourceMaps??!1,bundle:Z.bundle??!0,minify:Z.minify??!1,components:Z.components||gK},X=typeof $==="string"?hK($):$,Q=mK(X.tree,J),G=sK(Q),K=J.treeShake?rK(Q,G):Q,W=new Map;if(J.target==="universal"){let H=["macos","windows","linux","ios","android"];for(let B of H){let _=p7(K,{...J,target:B});W.set(B,_)}}else{let H=p7(K,J);W.set(J.target,H)}let q=eK(K,J,W),U=$W(X,K,J),z={compilationTime:performance.now()-Y,totalComponents:c7(X.tree),nativeComponents:i7(K),webComponents:c7(X.tree)-i7(K),bundleSize:q.length,treeShakenSize:J.treeShake?aK(Q,K):q.length,warnings:[],errors:[]},j;if(J.sourceMaps)j=ZW(X,K);return{code:q,platformCode:W,dependencies:G,manifest:U,sourceMaps:j,stats:z}}function hK($){let Z={type:"fragment",children:[]},Y=$.match(/<body[^>]*>([\s\S]*?)<\/body>/i),J=Y?Y[1]:$;return j8(J,Z),{id:F8(),hash:L8($),tree:Z,scripts:XW($),styles:QW($),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:$.includes("{{"),hasEventHandlers:$.includes("onclick")||$.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:$.length}}}function j8($,Z){let Y=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,J;while((J=Y.exec($))!==null){let[,X,Q,G]=J,K=X.startsWith("@craft-"),W={type:K?"component":"element",tag:K?X.slice(1):X,props:uK(Q),children:[],componentName:K?X.slice(1):void 0};if(G){let q=G.replace(/<[^>]+>/g,"").trim();if(q)W.children=W.children??[],W.children.push({type:"text",text:q});j8(G,W)}Z.children=Z.children??[],Z.children.push(W)}}function uK($){let Z={},Y=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,J;while((J=Y.exec($))!==null){let[,X,Q]=J;Z[X]=Q??!0}return Z}function mK($,Z){return B8($,Z)}function B8($,Z){let Y=$.componentName?Z.components?.get($.componentName):void 0,J="craft.View";if(Y)J=Y.zigType;else if($.type==="text")J="craft.Text";else if($.tag)J=dK($.tag);let X={};if($.props)for(let[W,q]of Object.entries($.props))X[W]=lK(q);let Q=[];if($.children)for(let W of $.children)Q.push(B8(W,Z));let G=new Map;if($.props){for(let[W,q]of Object.entries($.props))if(W.startsWith("on")&&typeof q==="string")G.set(W.slice(2).toLowerCase(),q)}let K=cK($);return{type:pK($,Y),zigType:J,props:X,children:Q,events:G,styles:K,id:$.hydrationKey,key:$.props?.key}}function dK($){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[$.toLowerCase()]||"craft.View"}function lK($){if(typeof $==="string"){if($.startsWith("{{")&&$.endsWith("}}"))return{type:"binding",path:$.slice(2,-2).trim()};if($.includes("(")&&$.includes(")"))return{type:"callback",handler:$};return{type:"literal",value:$}}if(typeof $==="number"||typeof $==="boolean")return{type:"literal",value:$};return{type:"literal",value:String($)}}function pK($,Z){if(Z){let J=Z.name.toLowerCase();if(J.includes("button"))return"button";if(J.includes("input")||J.includes("text"))return"input";if(J.includes("image")||J.includes("avatar"))return"image";if(J.includes("list")||J.includes("table"))return"list";if(J.includes("scroll"))return"scroll";return"custom"}if($.type==="text")return"text";let Y=$.tag?.toLowerCase();if(Y==="button")return"button";if(Y==="input"||Y==="textarea")return"input";if(Y==="img")return"image";if(Y==="ul"||Y==="ol")return"list";return"view"}function cK($){let Z=$.props?.style,Y={},J={};if(Z){let X=Z.split(";").filter(Boolean);for(let Q of X){let[G,K]=Q.split(":").map((W)=>W.trim());if(!G||!K)continue;switch(G){case"display":Y.display=K;break;case"flex-direction":Y.flexDirection=K;break;case"justify-content":Y.justifyContent=iK(K);break;case"align-items":Y.alignItems=nK(K);break;case"gap":Y.gap=Number.parseInt(K,10);break;case"padding":Y.padding=Number.parseInt(K,10);break;case"margin":Y.margin=Number.parseInt(K,10);break;case"width":Y.width=K==="auto"?"auto":Number.parseInt(K,10);break;case"height":Y.height=K==="auto"?"auto":Number.parseInt(K,10);break;case"background-color":case"background":J.backgroundColor=K;break;case"border-color":J.borderColor=K;break;case"border-width":J.borderWidth=Number.parseInt(K,10);break;case"border-radius":J.borderRadius=Number.parseInt(K,10);break;case"opacity":J.opacity=Number.parseFloat(K);break}}}return{layout:Y,appearance:J}}function iK($){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[$]||"start"}function nK($){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[$]||"start"}function sK($){let Z=[],Y=new Set;function J(X,Q){let G=X.id||F8();if(Y.has(G))return;Y.add(G);let K={id:G,type:"component",path:X.zigType,dependencies:Q?[Q]:[],size:H8(X),isStatic:oK(X)};Z.push(K);for(let W of X.children)J(W,G)}return J($),Z}function H8($){let Z=100;return Z+=Object.keys($.props).length*20,Z+=$.events.size*50,Z}function oK($){for(let Z of Object.values($.props))if(Z.type!=="literal")return!1;return $.events.size===0}function rK($,Z){return $}function aK($,Z){let Y=0;function J(X){Y+=H8(X);for(let Q of X.children)J(Q)}return J(Z),Y}function p7($,Z){switch(Z.format){case"zig":return z8($,Z);case"typescript":return tK($,Z);case"json":return JSON.stringify($,null,Z.minify?0:2);default:return z8($,Z)}}function z8($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('const std = @import("std");'),Y.push('const craft = @import("craft");'),Y.push(""),Y.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Y.push(" return try build(allocator);"),Y.push("}"),Y.push(""),_8($,Y,0),Y.join(`
14414
+ `)}function _8($,Z,Y){let J=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let X=`node_${Y}`;Z.push(`${J} var ${X} = try ${$.zigType}.init(allocator);`);for(let[Q,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${J} ${X}.set${JW(Q)}(${K});`)}for(let Q=0;Q<$.children.length;Q++){let G=$.children[Q];if(G.type==="text"){let K=G.props.text?.type==="literal"?String(G.props.text.value):"";Z.push(`${J} try ${X}.addChild(try craft.Text.init(allocator, "${K}"));`)}else _8(G,Z,Y+1),Z.push(`${J} try ${X}.addChild(node_${Y+1});`)}if(Y===0)Z.push(` return ${X}.element();`),Z.push("}")}function tK($,Z){let Y=[];return Y.push("// Auto-generated by stx compiler"),Y.push("// Target: "+Z.target),Y.push(""),Y.push('import { Craft } from "@stacksjs/craft";'),Y.push(""),Y.push("export function render(): Craft.Element {"),Y.push(" return "+O8($,1)+";"),Y.push("}"),Y.join(`
14415
14415
  `)}function O8($,Z){let Y=" ".repeat(Z),J=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let q=typeof W.value==="string"?`"${W.value}"`:String(W.value);J.push(`${K}: ${q}`)}let X=J.length>0?`{ ${J.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:O8(K,Z+1)),G=Q.length>0?`,
14416
14416
  ${Y} [${Q.join(`,
14417
- ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,Y){if(Z.target==="universal"){let J=[];J.push("// Universal entry point"),J.push("");for(let[X,Q]of Y)J.push(`// --- ${X.toUpperCase()} ---`),J.push(`#if ${X.toUpperCase()}`),J.push(Q),J.push("#endif"),J.push("");return J.join(`
14418
- `)}return Y.get(Z.target)||p7($,Z)}function eK($,Z,Y){let J=[];function X(Q){J.push({name:Q.zigType,hash:L8(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)X(G)}return X(Z),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function $W($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var ZW=0;function F8(){return`id_${++ZW}`}function L8($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}function YW($){return $.charAt(0).toUpperCase()+$.slice(1)}function JW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function XW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function c7($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=c7(Y);return Z}function i7($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=i7(Y);return Z}function mL($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var n7={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:($,Z)=>{let Y=$.checked?"checked":"",J=$.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
14417
+ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function eK($,Z,Y){if(Z.target==="universal"){let J=[];J.push("// Universal entry point"),J.push("");for(let[X,Q]of Y)J.push(`// --- ${X.toUpperCase()} ---`),J.push(`#if ${X.toUpperCase()}`),J.push(Q),J.push("#endif"),J.push("");return J.join(`
14418
+ `)}return Y.get(Z.target)||p7($,Z)}function $W($,Z,Y){let J=[];function X(Q){J.push({name:Q.zigType,hash:L8(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)X(G)}return X(Z),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function ZW($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var YW=0;function F8(){return`id_${++YW}`}function L8($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}function JW($){return $.charAt(0).toUpperCase()+$.slice(1)}function XW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function QW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function c7($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=c7(Y);return Z}function i7($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=i7(Y);return Z}function dL($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var n7={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:($,Z)=>{let Y=$.checked?"checked":"",J=$.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
14419
14419
  <input type="checkbox" class="craft-checkbox" ${Y} ${J}>
14420
14420
  <span class="craft-checkbox-label">${Z||$.label||""}</span>
14421
14421
  </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:($,Z)=>{let Y=$.min??0,J=$.max??100,X=$.step??1,Q=$.value??50,G=$.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${Y}" max="${J}" step="${X}" value="${Q}" ${G}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:($,Z)=>{let Y=$.size||40,J=$.src,X=String($.alt||""),Q=$.fallback||(X?X.charAt(0).toUpperCase():"?");if(J)return`<img class="craft-avatar" src="${J}" alt="${X}" style="width:${Y}px;height:${Y}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${Y}px;height:${Y}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${Q}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:($,Z)=>{let Y=Number($.value)||0,J=Number($.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,Y/J*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:($,Z)=>{let Y=$.size||24;return`<div class="craft-spinner" style="width:${Y}px;height:${Y}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:($,Z)=>{let Y=$.open?"open":"",J=$.title||"";return`<dialog class="craft-modal" ${Y}>
@@ -14429,7 +14429,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,
14429
14429
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:($,Z)=>{let Y=$.variant||"info",J=$.title||"";return`<div class="craft-alert craft-alert-${Y}" role="alert">
14430
14430
  ${J?`<div class="craft-alert-title">${J}</div>`:""}
14431
14431
  <div class="craft-alert-content">${Z}</div>
14432
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:($,Z)=>{let Y=$.content||"",J=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${J}">${Z}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:QW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:GW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:KW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:WW},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:($,Z)=>{return`<input type="color" class="craft-color-picker" value="${$.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:($,Z)=>{let Y=$.value||"",J=$.min||"",X=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${J}" max="${X}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:($,Z)=>{return`<input type="time" class="craft-time-picker" value="${$.value||""}">`}}},V8=`
14432
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:($,Z)=>{let Y=$.content||"",J=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${J}">${Z}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:GW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:KW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:WW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:qW},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:($,Z)=>{return`<input type="color" class="craft-color-picker" value="${$.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:($,Z)=>{let Y=$.value||"",J=$.min||"",X=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${J}" max="${X}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:($,Z)=>{return`<input type="time" class="craft-time-picker" value="${$.value||""}">`}}},V8=`
14433
14433
  <style id="craft-component-styles">
14434
14434
  /* Craft Component Base Styles */
14435
14435
  .craft-button {
@@ -14847,7 +14847,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,
14847
14847
  }
14848
14848
  }
14849
14849
  </style>
14850
- `,lL=`
14850
+ `,pL=`
14851
14851
  <script id="craft-component-runtime">
14852
14852
  (function() {
14853
14853
  if (window.__stxCraftComponentRuntime) return;
@@ -16416,35 +16416,35 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,
16416
16416
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
16417
16417
  })();
16418
16418
  </script>
16419
- `;return $=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(J,X,Q)=>{return c$("sidebar",X,Q.trim(),Z,Y)}),$=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(J,X)=>{return c$("sidebar",X,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(J,X,Q)=>{return c$(X,Q,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(J,X,Q,G)=>{return c$(X,Q,G.trim(),Z,Y)}),$}function c$($,Z,Y,J,X){let Q=J.components?.[$]||n7[$];if(!Q)return console.warn(`[stx] Unknown Craft component: @craft-${$}`),`<div class="${X}-unknown" data-component="${$}">${Y}</div>`;let G=i$(Z),K=[Q.fallbackClasses||`${X}-${$}`];if(G.class)K.push(G.class),delete G.class;if(Q.render)return G.__fallbackClasses=K.join(" "),Q.render(G,Y);let W=OW(G,Q,K);if(["input","hr","br","img"].includes(Q.fallbackTag))return`<${Q.fallbackTag} ${W}>`;return`<${Q.fallbackTag} ${W}>${Y}</${Q.fallbackTag}>`}function i$($){let Z={},Y=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,J;while((J=Y.exec($))!==null){let[X,Q,G,K]=J,W=G??K;if(X.startsWith(":"))Z[Q]=W;else if(X.startsWith("@"))Z[`on${Q.charAt(0).toUpperCase()}${Q.slice(1)}`]=W;else if(W===void 0)Z[Q]=!0;else Z[Q]=W}return Z}function QW($,Z){let Y=V5(String($.id||`craft-sidebar-${HW(Z||JSON.stringify($))}`)),J=zW($.spaces)||UW(Z),X=J.length?[]:BW($.sections)||R8(Z),Q=String($.selectedSpace||J[0]?.id||""),G=J.find((B)=>B.id===Q)||J[0],K=String($.selectedItem||$.selected||(J.length?G?.sections[0]?.items[0]?.id:X[0]?.items[0]?.id)||""),W={id:Y,variant:String($.variant||"desktop"),material:String($.material||"sidebar"),backgroundEffect:String($.backgroundEffect||"shimmer"),allowsVibrancy:$.allowsVibrancy!==!1&&$.allowsVibrancy!=="false",materialOpacity:Number($.materialOpacity??0.68),materialDarkOpacity:$.materialDarkOpacity===void 0?void 0:Number($.materialDarkOpacity),minWidth:$.minWidth===void 0?240:Number($.minWidth),maxWidth:$.maxWidth===void 0?340:Number($.maxWidth),canCollapse:$.canCollapse!==!1&&$.canCollapse!=="false",searchPlaceholder:$.searchPlaceholder?String($.searchPlaceholder):void 0,selectedItem:K,sections:X,spaces:J,selectedSpace:Q||void 0},q=String($.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number($.width||$.sidebarWidth||286),z=$.native===!1||$.native==="false"?"false":"true",j=W.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${B1(W.searchPlaceholder)}"></div>`:"",H;if(J.length)H=jW(J,Q,K);else if(X.length)H=X.map((B)=>A8(B,K)).join("");else H=Z;return`<aside class="${f0(q)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${f0(Y)}" data-native="${z}" style="--craft-sidebar-width:${U}px">
16419
+ `;return $=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(J,X,Q)=>{return c$("sidebar",X,Q.trim(),Z,Y)}),$=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(J,X)=>{return c$("sidebar",X,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(J,X,Q)=>{return c$(X,Q,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(J,X,Q,G)=>{return c$(X,Q,G.trim(),Z,Y)}),$}function c$($,Z,Y,J,X){let Q=J.components?.[$]||n7[$];if(!Q)return console.warn(`[stx] Unknown Craft component: @craft-${$}`),`<div class="${X}-unknown" data-component="${$}">${Y}</div>`;let G=i$(Z),K=[Q.fallbackClasses||`${X}-${$}`];if(G.class)K.push(G.class),delete G.class;if(Q.render)return G.__fallbackClasses=K.join(" "),Q.render(G,Y);let W=FW(G,Q,K);if(["input","hr","br","img"].includes(Q.fallbackTag))return`<${Q.fallbackTag} ${W}>`;return`<${Q.fallbackTag} ${W}>${Y}</${Q.fallbackTag}>`}function i$($){let Z={},Y=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,J;while((J=Y.exec($))!==null){let[X,Q,G,K]=J,W=G??K;if(X.startsWith(":"))Z[Q]=W;else if(X.startsWith("@"))Z[`on${Q.charAt(0).toUpperCase()}${Q.slice(1)}`]=W;else if(W===void 0)Z[Q]=!0;else Z[Q]=W}return Z}function GW($,Z){let Y=V5(String($.id||`craft-sidebar-${_W(Z||JSON.stringify($))}`)),J=jW($.spaces)||zW(Z),X=J.length?[]:HW($.sections)||R8(Z),Q=String($.selectedSpace||J[0]?.id||""),G=J.find((B)=>B.id===Q)||J[0],K=String($.selectedItem||$.selected||(J.length?G?.sections[0]?.items[0]?.id:X[0]?.items[0]?.id)||""),W={id:Y,variant:String($.variant||"desktop"),material:String($.material||"sidebar"),backgroundEffect:String($.backgroundEffect||"shimmer"),allowsVibrancy:$.allowsVibrancy!==!1&&$.allowsVibrancy!=="false",materialOpacity:Number($.materialOpacity??0.68),materialDarkOpacity:$.materialDarkOpacity===void 0?void 0:Number($.materialDarkOpacity),minWidth:$.minWidth===void 0?240:Number($.minWidth),maxWidth:$.maxWidth===void 0?340:Number($.maxWidth),canCollapse:$.canCollapse!==!1&&$.canCollapse!=="false",searchPlaceholder:$.searchPlaceholder?String($.searchPlaceholder):void 0,selectedItem:K,sections:X,spaces:J,selectedSpace:Q||void 0},q=String($.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number($.width||$.sidebarWidth||286),z=$.native===!1||$.native==="false"?"false":"true",j=W.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${B1(W.searchPlaceholder)}"></div>`:"",H;if(J.length)H=BW(J,Q,K);else if(X.length)H=X.map((B)=>A8(B,K)).join("");else H=Z;return`<aside class="${g0(q)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${g0(Y)}" data-native="${z}" style="--craft-sidebar-width:${U}px">
16420
16420
  ${j}
16421
16421
  ${H}
16422
16422
  </aside>
16423
- <script type="application/json" data-craft-sidebar-config="${f0(Y)}">${_W(W)}</script>`}function GW($,Z){let Y=V5(String($.id||$.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${f0(Y)}">
16423
+ <script type="application/json" data-craft-sidebar-config="${g0(Y)}">${OW(W)}</script>`}function KW($,Z){let Y=V5(String($.id||$.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${g0(Y)}">
16424
16424
  ${$.label?`<div class="craft-sidebar-space-title">${B1(String($.label))}</div>`:""}
16425
16425
  ${Z}
16426
- </section>`}function KW($,Z){let Y=String($.header||$.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${f0(String($.id||"section"))}">
16426
+ </section>`}function WW($,Z){let Y=String($.header||$.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${g0(String($.id||"section"))}">
16427
16427
  ${Y?`<div class="craft-sidebar-section-title">${B1(Y)}</div>`:""}
16428
16428
  ${Z}
16429
- </section>`}function WW($,Z){let Y={id:String($.id||V5(String($.label||Z||"item"))),label:String($.label||Z||""),icon:$.icon?String($.icon):void 0,badge:$.badge?String($.badge):void 0,tintColor:$.tintColor?String($.tintColor):void 0};return M8(Y,String($.selected||"")==="true")}function R8($){let Z=[],Y=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=J[2]||"",G=String(X.id||V5(String(X.header||X.title||`section-${Z.length+1}`))),K=String(X.header||X.title||G),W=qW(Q);Z.push({id:G,header:K,title:K,items:W})}return Z}function qW($){let Z=[],Y=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=String(X.label||(J[2]||"").replace(/<[^>]*>/g,"").trim()),G=String(X.id||V5(Q||`item-${Z.length+1}`));Z.push({id:G,label:Q,icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0})}return Z}function UW($){let Z=[],Y=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=J[2]||"",G=String(X.label||X.title||`Space ${Z.length+1}`);Z.push({id:String(X.id||V5(G)),label:G,icon:X.icon?String(X.icon):void 0,tint:X.tint?String(X.tint):void 0,sections:R8(Q)})}return Z}function zW($){if(!$)return;if(Array.isArray($))return $;if(typeof $!=="string")return;try{let Z=JSON.parse($);return Array.isArray(Z)?Z:void 0}catch{return}}function jW($,Z,Y){let J=$.map((Q)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${f0(Q.id)}" data-selected="${Q.id===Z?"true":"false"}" title="${f0(Q.label||Q.id)}">${Q.icon?`<span class="craft-sidebar-item-icon" data-icon="${f0(Q.icon)}"></span>`:B1((Q.label||Q.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${$.map((Q)=>`<section class="craft-sidebar-space" data-space-id="${f0(Q.id)}" data-selected="${Q.id===Z?"true":"false"}">
16429
+ </section>`}function qW($,Z){let Y={id:String($.id||V5(String($.label||Z||"item"))),label:String($.label||Z||""),icon:$.icon?String($.icon):void 0,badge:$.badge?String($.badge):void 0,tintColor:$.tintColor?String($.tintColor):void 0};return M8(Y,String($.selected||"")==="true")}function R8($){let Z=[],Y=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=J[2]||"",G=String(X.id||V5(String(X.header||X.title||`section-${Z.length+1}`))),K=String(X.header||X.title||G),W=UW(Q);Z.push({id:G,header:K,title:K,items:W})}return Z}function UW($){let Z=[],Y=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=String(X.label||(J[2]||"").replace(/<[^>]*>/g,"").trim()),G=String(X.id||V5(Q||`item-${Z.length+1}`));Z.push({id:G,label:Q,icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0})}return Z}function zW($){let Z=[],Y=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,J;while((J=Y.exec($))!==null){let X=i$(J[1]||""),Q=J[2]||"",G=String(X.label||X.title||`Space ${Z.length+1}`);Z.push({id:String(X.id||V5(G)),label:G,icon:X.icon?String(X.icon):void 0,tint:X.tint?String(X.tint):void 0,sections:R8(Q)})}return Z}function jW($){if(!$)return;if(Array.isArray($))return $;if(typeof $!=="string")return;try{let Z=JSON.parse($);return Array.isArray(Z)?Z:void 0}catch{return}}function BW($,Z,Y){let J=$.map((Q)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${g0(Q.id)}" data-selected="${Q.id===Z?"true":"false"}" title="${g0(Q.label||Q.id)}">${Q.icon?`<span class="craft-sidebar-item-icon" data-icon="${g0(Q.icon)}"></span>`:B1((Q.label||Q.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${$.map((Q)=>`<section class="craft-sidebar-space" data-space-id="${g0(Q.id)}" data-selected="${Q.id===Z?"true":"false"}">
16430
16430
  ${Q.label?`<div class="craft-sidebar-space-title">${B1(Q.label)}</div>`:""}
16431
16431
  ${Q.sections.map((G)=>A8(G,Y)).join("")}
16432
16432
  </section>`).join("")}</div>
16433
- <div class="craft-sidebar-space-switcher">${J}</div>`}function BW($){if(!$)return;if(Array.isArray($))return $;if(typeof $!=="string")return;try{let Z=JSON.parse($);return Array.isArray(Z)?Z:void 0}catch{return}}function A8($,Z){let Y=$.header||$.title||$.id;return`<section class="craft-sidebar-section" data-section-id="${f0($.id)}">
16433
+ <div class="craft-sidebar-space-switcher">${J}</div>`}function HW($){if(!$)return;if(Array.isArray($))return $;if(typeof $!=="string")return;try{let Z=JSON.parse($);return Array.isArray(Z)?Z:void 0}catch{return}}function A8($,Z){let Y=$.header||$.title||$.id;return`<section class="craft-sidebar-section" data-section-id="${g0($.id)}">
16434
16434
  <div class="craft-sidebar-section-title">${B1(Y)}</div>
16435
16435
  ${$.items.map((J)=>M8(J,J.id===Z)).join("")}
16436
- </section>`}function M8($,Z){let Y=$.tintColor?` style="--craft-sidebar-icon-color:${f0($.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${f0($.id)}" data-selected="${Z?"true":"false"}">
16437
- ${$.icon?`<span class="craft-sidebar-item-icon" data-icon="${f0($.icon)}"${Y}></span>`:""}
16436
+ </section>`}function M8($,Z){let Y=$.tintColor?` style="--craft-sidebar-icon-color:${g0($.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${g0($.id)}" data-selected="${Z?"true":"false"}">
16437
+ ${$.icon?`<span class="craft-sidebar-item-icon" data-icon="${g0($.icon)}"${Y}></span>`:""}
16438
16438
  <span class="craft-sidebar-item-label">${B1($.label)}</span>
16439
16439
  ${$.badge?`<span class="craft-sidebar-item-badge">${B1($.badge)}</span>`:""}
16440
- </button>`}function V5($){return $.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function HW($){let Z=5381;for(let Y=0;Y<$.length;Y++)Z=Z*33^$.charCodeAt(Y);return(Z>>>0).toString(36)}function B1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function f0($){return B1($).replace(/`/g,"&#96;")}function _W($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function OW($,Z,Y){let J=[];J.push(`class="${Y.join(" ")}"`),J.push(`data-craft="${Z.nativeType}"`);for(let[X,Q]of Object.entries($))if(Q===!0)J.push(X);else if(Q!==!1&&Q!==void 0&&Q!==null){let G=String(Q).replace(/"/g,"&quot;");J.push(`${X}="${G}"`)}return J.join(" ")}function pL($,Z){n7[$]=Z}function cL(){return{...n7}}var $$=new Map,Z$=new Map;function FW($,Z){let Y=Z?.id||kW($),J=bW($),X=$$.get(Y);if(X&&X.hash===J)return X;let Q=LW($),G=TW($),K=IW($),W=MW(Q),{staticParts:q,dynamicParts:U}=NW(Q),z=DW($),j={id:Y,hash:J,tree:Q,scripts:G,styles:K,staticParts:q,dynamicParts:U,dependencies:z,metadata:W};return $$.set(Y,j),j}async function nL($,Z={},Y={}){let J=performance.now();if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`,W=Z$.get(K);if(W&&Date.now()-W.timestamp<(Y.cacheTTL||60000))return{html:W.html,styles:$.styles.join(`
16440
+ </button>`}function V5($){return $.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function _W($){let Z=5381;for(let Y=0;Y<$.length;Y++)Z=Z*33^$.charCodeAt(Y);return(Z>>>0).toString(36)}function B1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function g0($){return B1($).replace(/`/g,"&#96;")}function OW($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function FW($,Z,Y){let J=[];J.push(`class="${Y.join(" ")}"`),J.push(`data-craft="${Z.nativeType}"`);for(let[X,Q]of Object.entries($))if(Q===!0)J.push(X);else if(Q!==!1&&Q!==void 0&&Q!==null){let G=String(Q).replace(/"/g,"&quot;");J.push(`${X}="${G}"`)}return J.join(" ")}function cL($,Z){n7[$]=Z}function iL(){return{...n7}}var $$=new Map,Z$=new Map;function LW($,Z){let Y=Z?.id||bW($),J=SW($),X=$$.get(Y);if(X&&X.hash===J)return X;let Q=VW($),G=IW($),K=DW($),W=NW(Q),{staticParts:q,dynamicParts:U}=TW(Q),z=EW($),j={id:Y,hash:J,tree:Q,scripts:G,styles:K,staticParts:q,dynamicParts:U,dependencies:z,metadata:W};return $$.set(Y,j),j}async function sL($,Z={},Y={}){let J=performance.now();if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`,W=Z$.get(K);if(W&&Date.now()-W.timestamp<(Y.cacheTTL||60000))return{html:W.html,styles:$.styles.join(`
16441
16441
  `),scripts:$.scripts.join(`
16442
- `),metadata:{renderTime:0,cacheHit:!0,totalSize:W.html.length,componentCount:$.metadata.componentCount}}}let X;if(Y.streaming)X=await wW($.tree,Z);else X=Y$($.tree,Z);let Q;if(Y.hydrate){let K=AW(X,$,Z);X=K.html,Q=K.data}if(Y.minify)X=EW(X);if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`;Z$.set(K,{html:X,timestamp:Date.now()})}let G=performance.now()-J;return{html:X,styles:$.styles.join(`
16442
+ `),metadata:{renderTime:0,cacheHit:!0,totalSize:W.html.length,componentCount:$.metadata.componentCount}}}let X;if(Y.streaming)X=await RW($.tree,Z);else X=Y$($.tree,Z);let Q;if(Y.hydrate){let K=MW(X,$,Z);X=K.html,Q=K.data}if(Y.minify)X=kW(X);if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`;Z$.set(K,{html:X,timestamp:Date.now()})}let G=performance.now()-J;return{html:X,styles:$.styles.join(`
16443
16443
  `),scripts:$.scripts.join(`
16444
- `),hydrationData:Q,metadata:{renderTime:G,cacheHit:!1,totalSize:X.length,componentCount:$.metadata.componentCount}}}function sL($,Z){let Y=[],J=[],X=[],Q=new Map,G=[];return J$($.tree,(K,W)=>{if(K.type==="component"&&K.componentName){if(b8(K.componentName))Y.push(K.componentName)}if(K.type==="element"&&K.tag){let q=PW(K);if(q)G.push(q);if(K.props){for(let[U,z]of Object.entries(K.props))if(U.startsWith("on")&&typeof z==="string"){let j=`handler_${Q.size}`;Q.set(j,z)}}}if(K.isStatic&&K.type==="element")J.push(I8(K));else if(!K.isStatic&&K.type!=="text")X.push(K.tag||K.componentName||"unknown")}),{nativeComponents:Y,staticHTML:J,dynamicParts:X,eventHandlers:Q,nativeWidgets:G}}function oL($,Z={}){let Y=FW($),J=RW(Y,Z),X=new Map,Q=[];return J$(Y.tree,(G)=>{if(G.type==="component"&&G.componentName){if(b8(G.componentName)){Q.push(G.componentName);let K=`<!--craft:${G.componentName}:${G.hydrationKey||"default"}-->`;X.set(G.hydrationKey||G.componentName,K)}}}),{staticHTML:J,dynamicPlaceholders:X,craftComponents:Q}}function LW($){let Z={type:"fragment",children:[]},Y=Z,J=[Z],X=$,Q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(X.length>0){let G=X.match(/^<(@?[\w-]+)([^>]*)>/);if(G){let[q,U,z]=G,j=VW(z),H=U.startsWith("@craft-"),B=H?U:U.toLowerCase(),_={type:H?"component":"element",tag:B,props:j,children:[],componentName:H?B.slice(1):void 0,isStatic:!N8(z),hydrationKey:yW()};if(Y.children=Y.children||[],Y.children.push(_),!Q.has(B)&&!z.endsWith("/"))J.push(_),Y=_;X=X.slice(q.length);continue}let K=X.match(/^<\/(@?[\w-]+)>/);if(K){let[q,U]=K,j=U.startsWith("@craft-")?U:U.toLowerCase();while(J.length>1){let H=J.pop();if(Y=J[J.length-1],H.tag===j)break}X=X.slice(q.length);continue}let W=X.match(/^[^<]+/);if(W){let q=W[0];if(q.trim()){let U={type:"text",text:q,isStatic:!N8(q)};Y.children=Y.children||[],Y.children.push(U)}X=X.slice(q.length);continue}X=X.slice(1)}return Z}function VW($){let Z={},Y=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,J;while((J=Y.exec($))!==null){let[,X,Q,G,K]=J,W=Q??G??K??!0;Z[X]=W}return Z}function J$($,Z,Y=[]){if(Z($,Y),$.children)$.children.forEach((J,X)=>{J$(J,Z,[...Y,`${X}`])})}function Y$($,Z){switch($.type){case"text":return E8($.text||"",Z);case"element":case"component":{let Y=$.tag||"div",J=D8($.props||{},Z),X=($.children||[]).map((Q)=>Y$(Q,Z)).join("");if(!$.children||$.children.length===0){if(["input","br","hr","img","meta","link"].includes(Y))return`<${Y}${J} />`}return`<${Y}${J}>${X}</${Y}>`}case"fragment":return($.children||[]).map((Y)=>Y$(Y,Z)).join("");case"slot":return`<!--slot:${$.slotName||"default"}-->`;default:return""}}function I8($){if($.type==="text")return $.text||"";let Z=$.tag||"div",Y=D8($.props||{},{});return`<${Z}${Y}></${Z}>`}function D8($,Z){let Y=[];for(let[J,X]of Object.entries($))if(X===!0)Y.push(` ${J}`);else if(X!==!1&&X!==null&&X!==void 0){let Q=E8(String(X),Z);Y.push(` ${J}="${k8(Q)}"`)}return Y.join("")}async function wW($,Z){return Y$($,Z)}function RW($,Z){let Y=[];return J$($.tree,(J)=>{if(J.isStatic)Y.push(Y$(J,Z))}),Y.join("")}function AW($,Z,Y){let J={templateId:Z.id,context:Y,dynamicParts:Array.from(Z.dynamicParts.entries())},X=`
16444
+ `),hydrationData:Q,metadata:{renderTime:G,cacheHit:!1,totalSize:X.length,componentCount:$.metadata.componentCount}}}function oL($,Z){let Y=[],J=[],X=[],Q=new Map,G=[];return J$($.tree,(K,W)=>{if(K.type==="component"&&K.componentName){if(b8(K.componentName))Y.push(K.componentName)}if(K.type==="element"&&K.tag){let q=CW(K);if(q)G.push(q);if(K.props){for(let[U,z]of Object.entries(K.props))if(U.startsWith("on")&&typeof z==="string"){let j=`handler_${Q.size}`;Q.set(j,z)}}}if(K.isStatic&&K.type==="element")J.push(I8(K));else if(!K.isStatic&&K.type!=="text")X.push(K.tag||K.componentName||"unknown")}),{nativeComponents:Y,staticHTML:J,dynamicParts:X,eventHandlers:Q,nativeWidgets:G}}function rL($,Z={}){let Y=LW($),J=AW(Y,Z),X=new Map,Q=[];return J$(Y.tree,(G)=>{if(G.type==="component"&&G.componentName){if(b8(G.componentName)){Q.push(G.componentName);let K=`<!--craft:${G.componentName}:${G.hydrationKey||"default"}-->`;X.set(G.hydrationKey||G.componentName,K)}}}),{staticHTML:J,dynamicPlaceholders:X,craftComponents:Q}}function VW($){let Z={type:"fragment",children:[]},Y=Z,J=[Z],X=$,Q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(X.length>0){let G=X.match(/^<(@?[\w-]+)([^>]*)>/);if(G){let[q,U,z]=G,j=wW(z),H=U.startsWith("@craft-"),B=H?U:U.toLowerCase(),_={type:H?"component":"element",tag:B,props:j,children:[],componentName:H?B.slice(1):void 0,isStatic:!N8(z),hydrationKey:PW()};if(Y.children=Y.children||[],Y.children.push(_),!Q.has(B)&&!z.endsWith("/"))J.push(_),Y=_;X=X.slice(q.length);continue}let K=X.match(/^<\/(@?[\w-]+)>/);if(K){let[q,U]=K,j=U.startsWith("@craft-")?U:U.toLowerCase();while(J.length>1){let H=J.pop();if(Y=J[J.length-1],H.tag===j)break}X=X.slice(q.length);continue}let W=X.match(/^[^<]+/);if(W){let q=W[0];if(q.trim()){let U={type:"text",text:q,isStatic:!N8(q)};Y.children=Y.children||[],Y.children.push(U)}X=X.slice(q.length);continue}X=X.slice(1)}return Z}function wW($){let Z={},Y=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,J;while((J=Y.exec($))!==null){let[,X,Q,G,K]=J,W=Q??G??K??!0;Z[X]=W}return Z}function J$($,Z,Y=[]){if(Z($,Y),$.children)$.children.forEach((J,X)=>{J$(J,Z,[...Y,`${X}`])})}function Y$($,Z){switch($.type){case"text":return E8($.text||"",Z);case"element":case"component":{let Y=$.tag||"div",J=D8($.props||{},Z),X=($.children||[]).map((Q)=>Y$(Q,Z)).join("");if(!$.children||$.children.length===0){if(["input","br","hr","img","meta","link"].includes(Y))return`<${Y}${J} />`}return`<${Y}${J}>${X}</${Y}>`}case"fragment":return($.children||[]).map((Y)=>Y$(Y,Z)).join("");case"slot":return`<!--slot:${$.slotName||"default"}-->`;default:return""}}function I8($){if($.type==="text")return $.text||"";let Z=$.tag||"div",Y=D8($.props||{},{});return`<${Z}${Y}></${Z}>`}function D8($,Z){let Y=[];for(let[J,X]of Object.entries($))if(X===!0)Y.push(` ${J}`);else if(X!==!1&&X!==null&&X!==void 0){let Q=E8(String(X),Z);Y.push(` ${J}="${k8(Q)}"`)}return Y.join("")}async function RW($,Z){return Y$($,Z)}function AW($,Z){let Y=[];return J$($.tree,(J)=>{if(J.isStatic)Y.push(Y$(J,Z))}),Y.join("")}function MW($,Z,Y){let J={templateId:Z.id,context:Y,dynamicParts:Array.from(Z.dynamicParts.entries())},X=`
16445
16445
  <script data-craft-hydration>
16446
16446
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(J)};
16447
- </script>`;return{html:$+X,data:J}}function MW($){let Z=!1,Y=!1,J=!1,X=!1,Q=0,G=0;function K(W,q){if(G=Math.max(G,q),W.type==="slot")Z=!0;if(W.type==="component")Q++;if(!W.isStatic)Y=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))J=!0;if(U==="@async"||U==="data-async")X=!0}if(W.children)W.children.forEach((U)=>K(U,q+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:J,hasAsyncContent:X,componentCount:Q,maxDepth:G,estimatedSize:JSON.stringify($).length}}function NW($){let Z=new Map,Y=new Map;return J$($,(J,X)=>{let Q=X.join(".");if(J.isStatic)Z.set(Q,I8(J));else Y.set(Q,J.tag||J.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function TW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function IW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function DW($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,J;while((J=Y.exec($))!==null)Z.push(J[1]);let X=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((J=X.exec($))!==null)Z.push(J[1]);let Q=/<@craft-[\w-]+/g;while((J=Q.exec($))!==null)Z.push(J[0].slice(2));return[...new Set(Z)]}function N8($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function E8($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return k8(String(Q??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return String(Q??"")}catch{return""}}),Y}function T8($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),J=Z;for(let X of Y)if(J&&typeof J==="object"&&X in J)J=J[X];else return;return J}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function k8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function EW($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function kW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function bW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}var SW=0;function yW(){return`h_${++SW}`}function b8($){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes($)}function PW($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,J={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},X=Y?`${Z}:${Y}`:Z,Q=J[X||""]||J[Z||""];if(Q)return{htmlSelector:X||Z||"",nativeComponent:Q.component,confidence:Q.confidence,reason:Q.reason};return null}function CW(){$$.clear()}function vW(){Z$.clear()}function rL(){CW(),vW()}function aL(){return{templateCacheSize:$$.size,renderCacheSize:Z$.size,totalEntries:$$.size+Z$.size}}import{existsSync as SK,mkdirSync as s0,copyFileSync as p1,chmodSync as c1}from"fs";import{join as h,basename as VL}from"path";import{spawn as d7,execSync as wL}from"child_process";import{tmpdir as yK,homedir as K8,platform as RL}from"os";O1();u5();I4();N5();N4();import{dirname as OL,resolve as DK}from"path";function TK($){return $.endsWith(".md")||$.endsWith(".markdown")}function _L($){let Z=[];J(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Y=[...Z];J(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Y);function J(G,K){let W;while((W=G.exec($))!==null){let q=W.index,U=q+W[0].length;if(K?.some((z)=>q>=z.start&&U<=z.end))continue;Z.push({start:q,end:U})}}if(Z.length===0)return $;Z.sort((G,K)=>G.start-K.start);let X="",Q=0;for(let G of Z){if(G.start<Q)continue;X+=$.slice(Q,G.start),X+=`@raw${$.slice(G.start,G.end)}@endraw`,Q=G.end}return X+=$.slice(Q),X}async function IK($,Z={}){let{data:Y,content:J}=n$($),Q=await(Z.renderer??((G)=>n1(G)))(J);return{html:_L(Q),frontmatter:Y??{}}}function FL($){let Z=$,Y=P5($);if(Y)Z=Y.content.trim();let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X=[],Q=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),W;while((W=J.exec($))!==null){let U=W[1],z=W[2],j=W[0],H=U.includes("server");if(K(z))G.push(j);else if(H)Q.push(z);else X.push(j)}let q=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,j=[];while((z=U.exec(q))!==null){let H=z.index+z[0].length,B=1,_=H;while(_<q.length&&B>0){let O=q.indexOf("<script",_),F=q.indexOf("</script>",_);if(F===-1)break;if(O!==-1&&O<F)B++,_=O+7;else{if(B--,B===0){j.push({start:z.index,end:F+9});break}_=F+9}}}for(let H=j.length-1;H>=0;H--)q=q.substring(0,j[H].start)+q.substring(j[H].end)}for(let U of X)q=q.replace(U,"");return{templateContent:q,serverScripts:Q,clientScripts:X,signalsScripts:G}}function LL($,Z){return`<!DOCTYPE html>
16447
+ </script>`;return{html:$+X,data:J}}function NW($){let Z=!1,Y=!1,J=!1,X=!1,Q=0,G=0;function K(W,q){if(G=Math.max(G,q),W.type==="slot")Z=!0;if(W.type==="component")Q++;if(!W.isStatic)Y=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))J=!0;if(U==="@async"||U==="data-async")X=!0}if(W.children)W.children.forEach((U)=>K(U,q+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:J,hasAsyncContent:X,componentCount:Q,maxDepth:G,estimatedSize:JSON.stringify($).length}}function TW($){let Z=new Map,Y=new Map;return J$($,(J,X)=>{let Q=X.join(".");if(J.isStatic)Z.set(Q,I8(J));else Y.set(Q,J.tag||J.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function IW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function DW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function EW($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,J;while((J=Y.exec($))!==null)Z.push(J[1]);let X=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((J=X.exec($))!==null)Z.push(J[1]);let Q=/<@craft-[\w-]+/g;while((J=Q.exec($))!==null)Z.push(J[0].slice(2));return[...new Set(Z)]}function N8($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function E8($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return k8(String(Q??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return String(Q??"")}catch{return""}}),Y}function T8($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),J=Z;for(let X of Y)if(J&&typeof J==="object"&&X in J)J=J[X];else return;return J}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function k8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function kW($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function bW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function SW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}var yW=0;function PW(){return`h_${++yW}`}function b8($){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes($)}function CW($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,J={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},X=Y?`${Z}:${Y}`:Z,Q=J[X||""]||J[Z||""];if(Q)return{htmlSelector:X||Z||"",nativeComponent:Q.component,confidence:Q.confidence,reason:Q.reason};return null}function vW(){$$.clear()}function xW(){Z$.clear()}function aL(){vW(),xW()}function tL(){return{templateCacheSize:$$.size,renderCacheSize:Z$.size,totalEntries:$$.size+Z$.size}}import{existsSync as yK,mkdirSync as s0,copyFileSync as p1,chmodSync as c1}from"fs";import{join as h,basename as wL}from"path";import{spawn as d7,execSync as RL}from"child_process";import{tmpdir as PK,homedir as K8,platform as AL}from"os";O1();u5();I4();N5();N4();import{dirname as FL,resolve as EK}from"path";function IK($){return $.endsWith(".md")||$.endsWith(".markdown")}function OL($){let Z=[];J(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Y=[...Z];J(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Y);function J(G,K){let W;while((W=G.exec($))!==null){let q=W.index,U=q+W[0].length;if(K?.some((z)=>q>=z.start&&U<=z.end))continue;Z.push({start:q,end:U})}}if(Z.length===0)return $;Z.sort((G,K)=>G.start-K.start);let X="",Q=0;for(let G of Z){if(G.start<Q)continue;X+=$.slice(Q,G.start),X+=`@raw${$.slice(G.start,G.end)}@endraw`,Q=G.end}return X+=$.slice(Q),X}async function DK($,Z={}){let{data:Y,content:J}=n$($),Q=await(Z.renderer??((G)=>n1(G)))(J);return{html:OL(Q),frontmatter:Y??{}}}function LL($){let Z=$,Y=P5($);if(Y)Z=Y.content.trim();let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X=[],Q=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),W;while((W=J.exec($))!==null){let U=W[1],z=W[2],j=W[0],H=U.includes("server");if(K(z))G.push(j);else if(H)Q.push(z);else X.push(j)}let q=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,j=[];while((z=U.exec(q))!==null){let H=z.index+z[0].length,B=1,_=H;while(_<q.length&&B>0){let O=q.indexOf("<script",_),F=q.indexOf("</script>",_);if(F===-1)break;if(O!==-1&&O<F)B++,_=O+7;else{if(B--,B===0){j.push({start:z.index,end:F+9});break}_=F+9}}}for(let H=j.length-1;H>=0;H--)q=q.substring(0,j[H].start)+q.substring(j[H].end)}for(let U of X)q=q.replace(U,"");return{templateContent:q,serverScripts:Q,clientScripts:X,signalsScripts:G}}function VL($,Z){return`<!DOCTYPE html>
16448
16448
  <html lang="en">
16449
16449
  <head>
16450
16450
  <meta charset="UTF-8">
@@ -16454,30 +16454,30 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,
16454
16454
  <body>
16455
16455
  ${$}
16456
16456
  </body>
16457
- </html>`}function EK($,Z,Y){if($&&typeof $==="object")$[Z]=Y}async function kK($,Z={}){let Y=DK($),J=Bun.file(Y);if(!await J.exists())throw Error(`Template file not found: ${Y}`);let X=await J.text(),Q=null;if(TK(Y)){let G=await IK(X,{renderer:Z.markdownRenderer});X=G.html,Q=G.frontmatter}if(Q)Z={...Z,context:{...Q,...Z.context||{}}};if(Z.layout){let G=DK(Z.layout),K=Bun.file(G);if(!await K.exists())throw Error(`Layout template not found: ${G}`);let{layout:W,injectCSS:q,...U}=Z,z=await G8(X,Y,{...U,injectCSS:!1}),j=await K.text(),H={...Z.context||{},content:z},B={...U,context:H,injectCSS:q};return G8(j,G,B)}return G8(X,Y,Z)}async function G8($,Z,Y={}){let{templateContent:J,serverScripts:X,clientScripts:Q}=FL($),G={...R1,...Y.options},K={__filename:Z,__dirname:OL(Z),__stx:{},__stx_options:G,__stx_sfc_mode:!0,__stx_inject_css:Y.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)EK(Y.context,"__stxResponseStatus",U)},setResponseHeader:(U,z)=>{if(!U)return;let j=Y.context?.__stxResponseHeaders||{};j[String(U)]=String(z),EK(Y.context,"__stxResponseHeaders",j)},definePageMeta:()=>{},...Y.context||{}};for(let U of X)await w1(U,K,Z);let W=new Set,q=J;if(q=await w0(q,K,Z,G,W),Y.templateOnly){if(q=q.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),q=q.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),Q.length>0)q+=`
16457
+ </html>`}function kK($,Z,Y){if($&&typeof $==="object")$[Z]=Y}async function bK($,Z={}){let Y=EK($),J=Bun.file(Y);if(!await J.exists())throw Error(`Template file not found: ${Y}`);let X=await J.text(),Q=null;if(IK(Y)){let G=await DK(X,{renderer:Z.markdownRenderer});X=G.html,Q=G.frontmatter}if(Q)Z={...Z,context:{...Q,...Z.context||{}}};if(Z.layout){let G=EK(Z.layout),K=Bun.file(G);if(!await K.exists())throw Error(`Layout template not found: ${G}`);let{layout:W,injectCSS:q,...U}=Z,z=await G8(X,Y,{...U,injectCSS:!1}),j=await K.text(),H={...Z.context||{},content:z},B={...U,context:H,injectCSS:q};return G8(j,G,B)}return G8(X,Y,Z)}async function G8($,Z,Y={}){let{templateContent:J,serverScripts:X,clientScripts:Q}=LL($),G={...R1,...Y.options},K={__filename:Z,__dirname:FL(Z),__stx:{},__stx_options:G,__stx_sfc_mode:!0,__stx_inject_css:Y.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)kK(Y.context,"__stxResponseStatus",U)},setResponseHeader:(U,z)=>{if(!U)return;let j=Y.context?.__stxResponseHeaders||{};j[String(U)]=String(z),kK(Y.context,"__stxResponseHeaders",j)},definePageMeta:()=>{},...Y.context||{}};for(let U of X)await w1(U,K,Z);let W=new Set,q=J;if(q=await w0(q,K,Z,G,W),Y.templateOnly){if(q=q.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),q=q.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),Q.length>0)q+=`
16458
16458
  ${Q.join(`
16459
16459
  `)}`}else{if(Y.processClientScripts!==!1&&Q.length>0){let U=K.__stx_event_bindings||[],z=r1(K),H=(await Promise.all(Q.map(async(_)=>{let O=_.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!O)return _;return await a1(O[1],{eventBindings:U,templateContent:q,serverData:z,filePath:Z})}))).join(`
16460
16460
  `);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${H}
16461
16461
  $1`);else q+=`
16462
- ${H}`}q=await Z9(q)}if(Y.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=LL(q,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (V3(),Y2));q=await U(q)}catch{}return q}async function Zk($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||m7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||m7(),J=$.format||bL(Y),X=$.output||h(process.cwd(),"dist","native");if(!SK(X))s0(X,{recursive:!0});let Q=await kK($.input,{context:$.context,options:{isDev:!1}});if(Q=U8(Q,{debug:$.verbose}),Q=w8(Q),!Q.includes("craft-component-styles")){if(Q.includes("</head>"))Q=Q.replace("</head>",`${V8}
16463
- </head>`)}let G=$.name||VL($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await kL();if(!W)return{success:!1,target:Y,format:J,error:"Craft binary not found. Please install Craft or specify craftPath."};if($.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Y}...`),console.log(` Input: ${$.input}`),console.log(` Output: ${X}`),console.log(` Craft: ${W}`);let q;switch(Y){case"macos":q=await AL(Q,G,K,X,J,$,W);break;case"windows":q=await TL(Q,G,K,X,J,$,W);break;case"linux":q=await IL(Q,G,K,X,J,$,W);break;case"ios":q=await DL(Q,G,K,X,$,W);break;case"android":q=await EL(Q,G,K,X,$,W);break;default:q={success:!1,target:Y,format:J,error:`Unsupported target: ${Y}`}}return q.duration=Date.now()-Z,q}catch(Y){return{success:!1,target:$.target||m7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function AL($,Z,Y,J,X,Q,G){let K=Q.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=h(J,`${Z}.app`),q=h(W,"Contents"),U=h(q,"MacOS"),z=h(q,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let j=h(z,"index.html");await Bun.write(j,$);let H="";if(Q.sidebar?.enabled&&Q.sidebar?.config)H=h(z,"sidebar-config.json"),await Bun.write(H,JSON.stringify(Q.sidebar.config));let B=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",_=Q.menubarOnly??Q.systemTray;if((Q.bundleStyle||(await ML(G)?"executable":"launcher"))==="executable"){let V=h(U,Z);p1(G,V),c1(V,493);let w={html:"index.html",title:Q.window?.title||Z,width:Q.window?.width||1200,height:Q.window?.height||800,devTools:Boolean(Q.devTools)};if(_)w.menubarOnly=!0;else if(Q.systemTray)w.systemTray=!0;if(Q.window?.frameless)w.frameless=!0;if(Q.window?.transparent)w.transparent=!0;if(Q.window?.alwaysOnTop)w.alwaysOnTop=!0;if(Q.window?.resizable===!1)w.resizable=!1;await Bun.write(h(z,"craft.json"),`${JSON.stringify(w,null,2)}
16462
+ ${H}`}q=await Z9(q)}if(Y.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=VL(q,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (V3(),J2));q=await U(q)}catch{}return q}async function Yk($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||m7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||m7(),J=$.format||SL(Y),X=$.output||h(process.cwd(),"dist","native");if(!yK(X))s0(X,{recursive:!0});let Q=await bK($.input,{context:$.context,options:{isDev:!1}});if(Q=U8(Q,{debug:$.verbose}),Q=w8(Q),!Q.includes("craft-component-styles")){if(Q.includes("</head>"))Q=Q.replace("</head>",`${V8}
16463
+ </head>`)}let G=$.name||wL($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await bL();if(!W)return{success:!1,target:Y,format:J,error:"Craft binary not found. Please install Craft or specify craftPath."};if($.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Y}...`),console.log(` Input: ${$.input}`),console.log(` Output: ${X}`),console.log(` Craft: ${W}`);let q;switch(Y){case"macos":q=await ML(Q,G,K,X,J,$,W);break;case"windows":q=await IL(Q,G,K,X,J,$,W);break;case"linux":q=await DL(Q,G,K,X,J,$,W);break;case"ios":q=await EL(Q,G,K,X,$,W);break;case"android":q=await kL(Q,G,K,X,$,W);break;default:q={success:!1,target:Y,format:J,error:`Unsupported target: ${Y}`}}return q.duration=Date.now()-Z,q}catch(Y){return{success:!1,target:$.target||m7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function ML($,Z,Y,J,X,Q,G){let K=Q.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=h(J,`${Z}.app`),q=h(W,"Contents"),U=h(q,"MacOS"),z=h(q,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let j=h(z,"index.html");await Bun.write(j,$);let H="";if(Q.sidebar?.enabled&&Q.sidebar?.config)H=h(z,"sidebar-config.json"),await Bun.write(H,JSON.stringify(Q.sidebar.config));let B=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",_=Q.menubarOnly??Q.systemTray;if((Q.bundleStyle||(await NL(G)?"executable":"launcher"))==="executable"){let V=h(U,Z);p1(G,V),c1(V,493);let w={html:"index.html",title:Q.window?.title||Z,width:Q.window?.width||1200,height:Q.window?.height||800,devTools:Boolean(Q.devTools)};if(_)w.menubarOnly=!0;else if(Q.systemTray)w.systemTray=!0;if(Q.window?.frameless)w.frameless=!0;if(Q.window?.transparent)w.transparent=!0;if(Q.window?.alwaysOnTop)w.alwaysOnTop=!0;if(Q.window?.resizable===!1)w.resizable=!1;await Bun.write(h(z,"craft.json"),`${JSON.stringify(w,null,2)}
16464
16464
  `)}else{let V=h(U,"craft");p1(G,V),c1(V,493);let w=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",A=`#!/bin/bash
16465
16465
  set -euo pipefail
16466
16466
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
16467
16467
  RESOURCES="$DIR/../Resources"
16468
16468
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
16469
16469
  ${[`--title "${Q.window?.title||Z}"`,`--width ${Q.window?.width||1200}`,`--height ${Q.window?.height||800}`,_?"--menubar-only":Q.systemTray?"--system-tray":"",Q.devTools?"":"--no-devtools",Q.window?.frameless?"--frameless":"",Q.window?.transparent?"--transparent":"",Q.window?.alwaysOnTop?"--always-on-top":"",Q.window?.resizable===!1?"--no-resize":"",w].filter(Boolean).join(" \\\n ")}
16470
- `,M=h(U,Z);await Bun.write(M,A),c1(M,493)}let F=Boolean(Q.icon&&await Bun.file(Q.icon).exists());if(F)p1(Q.icon,h(z,"AppIcon.icns"));let L={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:Q.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:Q.menubarOnly??Boolean(Q.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...Q.category?{LSApplicationCategoryType:Q.category}:{},...Q.copyright?{NSHumanReadableCopyright:Q.copyright}:{},...Q.infoPlist||{}};if(await Bun.write(h(q,"Info.plist"),NL(L)),X==="dmg"){let V=h(J,`${Z}-${Y}.dmg`),w=await SL(W,V,Z);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:V}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function ML($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,J]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let Q=`${Y}
16471
- ${J}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!Q)return!1;let[G,K,W]=Q.slice(1).map(Number);if(G>0||K>0)return!0;return W>=57}catch{return!1}}function bK($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NL($){return`<?xml version="1.0" encoding="UTF-8"?>
16470
+ `,M=h(U,Z);await Bun.write(M,A),c1(M,493)}let F=Boolean(Q.icon&&await Bun.file(Q.icon).exists());if(F)p1(Q.icon,h(z,"AppIcon.icns"));let L={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:Q.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:Q.menubarOnly??Boolean(Q.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...Q.category?{LSApplicationCategoryType:Q.category}:{},...Q.copyright?{NSHumanReadableCopyright:Q.copyright}:{},...Q.infoPlist||{}};if(await Bun.write(h(q,"Info.plist"),TL(L)),X==="dmg"){let V=h(J,`${Z}-${Y}.dmg`),w=await yL(W,V,Z);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:V}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function NL($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,J]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let Q=`${Y}
16471
+ ${J}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!Q)return!1;let[G,K,W]=Q.slice(1).map(Number);if(G>0||K>0)return!0;return W>=57}catch{return!1}}function SK($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TL($){return`<?xml version="1.0" encoding="UTF-8"?>
16472
16472
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
16473
16473
  <plist version="1.0">
16474
16474
  <dict>
16475
- ${Object.entries($).map(([Y,J])=>{let X=typeof J==="boolean"?`<${J}/>`:typeof J==="number"?`<integer>${J}</integer>`:`<string>${bK(String(J))}</string>`;return` <key>${bK(Y)}</key>
16475
+ ${Object.entries($).map(([Y,J])=>{let X=typeof J==="boolean"?`<${J}/>`:typeof J==="number"?`<integer>${J}</integer>`:`<string>${SK(String(J))}</string>`;return` <key>${SK(Y)}</key>
16476
16476
  ${X}`}).join(`
16477
16477
  `)}
16478
16478
  </dict>
16479
16479
  </plist>
16480
- `}async function TL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$),p1(G,h(K,"craft.exe"));let q=`@echo off
16480
+ `}async function IL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$),p1(G,h(K,"craft.exe"));let q=`@echo off
16481
16481
  set DIR=%~dp0
16482
16482
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
16483
16483
  --title "${Q.window?.title||Z}" ^
@@ -16485,7 +16485,7 @@ set DIR=%~dp0
16485
16485
  --height ${Q.window?.height||800} ^
16486
16486
  ${Q.systemTray?"--system-tray":""} ^
16487
16487
  ${Q.devTools?"":"--no-devtools"}
16488
- `;if(await Bun.write(h(K,`${Z}.bat`),q),X==="zip"){let U=h(J,`${Z}-${Y}-windows.zip`),z=await yL(K,U);if(!z.success)return{success:!1,target:"windows",format:"zip",error:z.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:K}}async function IL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$);let q=h(K,"craft");p1(G,q),c1(q,493);let U=`#!/bin/bash
16488
+ `;if(await Bun.write(h(K,`${Z}.bat`),q),X==="zip"){let U=h(J,`${Z}-${Y}-windows.zip`),z=await PL(K,U);if(!z.success)return{success:!1,target:"windows",format:"zip",error:z.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:K}}async function DL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$);let q=h(K,"craft");p1(G,q),c1(q,493);let U=`#!/bin/bash
16489
16489
  set -euo pipefail
16490
16490
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
16491
16491
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -16500,8 +16500,8 @@ Name=${Z}
16500
16500
  Exec=${z}
16501
16501
  Terminal=false
16502
16502
  Categories=Utility;
16503
- `;if(await Bun.write(h(K,`${Z.toLowerCase()}.desktop`),j),X==="deb"){let H=h(J,`${Z.toLowerCase()}_${Y}_amd64.deb`),B=await PL(K,H,Z,Y,Q);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:H}}if(X==="appimage"){let H=h(J,`${Z}-${Y}-x86_64.AppImage`),B=await CL(K,H,Z,Q);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:H}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function DL($,Z,Y,J,X,Q){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${Z}' to create an iOS project.`}}async function EL($,Z,Y,J,X,Q){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${Z}' to create an Android project.`}}async function kL(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(K8(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=wL("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
16504
- `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function m7(){switch(RL()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function bL($){switch($){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function SL($,Z,Y){return new Promise((J)=>{let X=d7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);X.on("close",(Q)=>{if(Q===0)J({success:!0});else J({success:!1,error:`hdiutil exited with code ${Q}`})}),X.on("error",(Q)=>{J({success:!1,error:Q.message})})})}async function yL($,Z){return new Promise((Y)=>{let J=d7("zip",["-r",Z,"."],{cwd:$});J.on("close",(X)=>{if(X===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${X}`})}),J.on("error",(X)=>{Y({success:!1,error:X.message})})})}async function PL($,Z,Y,J,X){return new Promise((Q)=>{try{let G=h(yK(),`stx-deb-${Date.now()}`),K=h(G,"DEBIAN"),W=h(G,"usr","bin"),q=h(G,"usr","share","applications"),U=h(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(W,{recursive:!0}),s0(q,{recursive:!0}),s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let _ of z)p1(h($,_),h(U,_));let j=`#!/bin/bash
16503
+ `;if(await Bun.write(h(K,`${Z.toLowerCase()}.desktop`),j),X==="deb"){let H=h(J,`${Z.toLowerCase()}_${Y}_amd64.deb`),B=await CL(K,H,Z,Y,Q);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:H}}if(X==="appimage"){let H=h(J,`${Z}-${Y}-x86_64.AppImage`),B=await vL(K,H,Z,Q);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:H}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function EL($,Z,Y,J,X,Q){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${Z}' to create an iOS project.`}}async function kL($,Z,Y,J,X,Q){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${Z}' to create an Android project.`}}async function bL(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(K8(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=RL("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
16504
+ `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function m7(){switch(AL()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function SL($){switch($){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function yL($,Z,Y){return new Promise((J)=>{let X=d7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);X.on("close",(Q)=>{if(Q===0)J({success:!0});else J({success:!1,error:`hdiutil exited with code ${Q}`})}),X.on("error",(Q)=>{J({success:!1,error:Q.message})})})}async function PL($,Z){return new Promise((Y)=>{let J=d7("zip",["-r",Z,"."],{cwd:$});J.on("close",(X)=>{if(X===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${X}`})}),J.on("error",(X)=>{Y({success:!1,error:X.message})})})}async function CL($,Z,Y,J,X){return new Promise((Q)=>{try{let G=h(PK(),`stx-deb-${Date.now()}`),K=h(G,"DEBIAN"),W=h(G,"usr","bin"),q=h(G,"usr","share","applications"),U=h(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(W,{recursive:!0}),s0(q,{recursive:!0}),s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let _ of z)p1(h($,_),h(U,_));let j=`#!/bin/bash
16505
16505
  exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;e("fs").writeFileSync(h(W,Y.toLowerCase()),j),c1(h(W,Y.toLowerCase()),493);let H=`Package: ${Y.toLowerCase()}
16506
16506
  Version: ${J}
16507
16507
  Section: utils
@@ -16510,7 +16510,7 @@ Architecture: amd64
16510
16510
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
16511
16511
  Maintainer: ${X.author||"Unknown"}
16512
16512
  Description: ${X.description||Y}
16513
- `;e("fs").writeFileSync(h(K,"control"),H);let B=d7("dpkg-deb",["--build",G,Z]);B.on("close",(_)=>{if(e("fs").rmSync(G,{recursive:!0,force:!0}),_===0)Q({success:!0});else Q({success:!1,error:`dpkg-deb exited with code ${_}`})}),B.on("error",(_)=>{e("fs").rmSync(G,{recursive:!0,force:!0}),Q({success:!1,error:_.message})})}catch(G){Q({success:!1,error:G.message})}})}async function CL($,Z,Y,J){return new Promise((X)=>{try{let Q=h(yK(),`stx-appimage-${Date.now()}`),G=h(Q,`${Y}.AppDir`),K=h(G,"usr"),W=h(K,"bin"),q=h(K,"share");s0(W,{recursive:!0}),s0(q,{recursive:!0});let U=h(q,Y.toLowerCase());s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let O of z)p1(h($,O),h(U,O));let j=`#!/bin/bash
16513
+ `;e("fs").writeFileSync(h(K,"control"),H);let B=d7("dpkg-deb",["--build",G,Z]);B.on("close",(_)=>{if(e("fs").rmSync(G,{recursive:!0,force:!0}),_===0)Q({success:!0});else Q({success:!1,error:`dpkg-deb exited with code ${_}`})}),B.on("error",(_)=>{e("fs").rmSync(G,{recursive:!0,force:!0}),Q({success:!1,error:_.message})})}catch(G){Q({success:!1,error:G.message})}})}async function vL($,Z,Y,J){return new Promise((X)=>{try{let Q=h(PK(),`stx-appimage-${Date.now()}`),G=h(Q,`${Y}.AppDir`),K=h(G,"usr"),W=h(K,"bin"),q=h(K,"share");s0(W,{recursive:!0}),s0(q,{recursive:!0});let U=h(q,Y.toLowerCase());s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let O of z)p1(h($,O),h(U,O));let j=`#!/bin/bash
16514
16514
  SELF=$(readlink -f "$0")
16515
16515
  HERE=\${SELF%/*}
16516
16516
  export PATH="\${HERE}/usr/bin:\${PATH}"
@@ -16522,4 +16522,4 @@ Exec=${Y.toLowerCase()}
16522
16522
  Terminal=false
16523
16523
  Categories=Utility;
16524
16524
  Icon=${Y.toLowerCase()}
16525
- `;e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.desktop`),H);let B=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.png`),B),J.icon&&SK(J.icon))p1(J.icon,h(G,`${Y.toLowerCase()}.png`));let _=d7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});_.on("close",(O)=>{if(e("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)c1(Z,493),X({success:!0});else X({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),_.on("error",(O)=>{e("fs").rmSync(Q,{recursive:!0,force:!0}),X({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){X({success:!1,error:Q.message})}})}function Yk(){return[m7()]}function Jk($){switch($){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{nL as renderSSR,pL as registerCraftComponent,gL as processCraftDirective,w8 as processCraftComponents,oL as prerenderForCraft,fL as isCraftEnvironment,U8 as injectCraftBridge,aL as getSSRCacheStats,cL as getCraftComponents,Yk as getAvailableTargets,Jk as getAvailableFormats,sL as generateCraftOptimizations,q8 as generateCraftBridgeScript,mL as createHotReloadServer,uL as compileToNative,FW as compileTemplate,CW as clearTemplateCache,vW as clearRenderCache,rL as clearAllCaches,Zk as buildNative,fK as NATIVE_COMPONENTS,V8 as CRAFT_COMPONENT_STYLES,lL as CRAFT_COMPONENT_RUNTIME,n7 as CRAFT_COMPONENTS,xL as CRAFT_BRIDGE_SCRIPT};
16525
+ `;e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.desktop`),H);let B=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.png`),B),J.icon&&yK(J.icon))p1(J.icon,h(G,`${Y.toLowerCase()}.png`));let _=d7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});_.on("close",(O)=>{if(e("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)c1(Z,493),X({success:!0});else X({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),_.on("error",(O)=>{e("fs").rmSync(Q,{recursive:!0,force:!0}),X({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){X({success:!1,error:Q.message})}})}function Jk(){return[m7()]}function Xk($){switch($){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{sL as renderSSR,cL as registerCraftComponent,hL as processCraftDirective,w8 as processCraftComponents,rL as prerenderForCraft,gL as isCraftEnvironment,U8 as injectCraftBridge,tL as getSSRCacheStats,iL as getCraftComponents,Jk as getAvailableTargets,Xk as getAvailableFormats,oL as generateCraftOptimizations,q8 as generateCraftBridgeScript,dL as createHotReloadServer,mL as compileToNative,LW as compileTemplate,vW as clearTemplateCache,xW as clearRenderCache,aL as clearAllCaches,Yk as buildNative,gK as NATIVE_COMPONENTS,V8 as CRAFT_COMPONENT_STYLES,pL as CRAFT_COMPONENT_RUNTIME,n7 as CRAFT_COMPONENTS,fL as CRAFT_BRIDGE_SCRIPT};