@stacksjs/stx 0.2.146 → 0.2.148

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 oQ=Object.defineProperty;var rQ=($)=>$;function aQ($,Z){this[$]=rQ.bind(null,Z)}var t=($,Z)=>{for(var Y in Z)oQ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:aQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var a=import.meta.require;function d9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{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: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var m9,l9;var I7=k(()=>{m9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},l9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function aG($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...z1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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 ZG=Object.defineProperty;var YG=($)=>$;function XG($,Z){this[$]=YG.bind(null,Z)}var t=($,Z)=>{for(var Y in Z)ZG($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:XG.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var o=import.meta.require;function l9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{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: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var p9,c9;var I7=k(()=>{p9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},c9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function XK($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...z1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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 oQ=Object.defineProperty;var rQ=($)=>$;function aQ($,Z){this[$]=rQ.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`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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 tG(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function JK(){return`
13
13
  <script data-stx-scoped>
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function eG($){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 $K($=0.1,Z="0px"){return`
40
+ `}function QK($){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 GK($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped>
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function ZK(){return`
83
+ `}function KK(){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 YK($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
198
+ `}function qK($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
199
199
  <script data-stx-scoped>
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function s9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!eG(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=ZK();Q=Q.replace("</head>",`${K}
236
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=$K(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
237
- `+Q.slice(W)}}return Q}var z1,p9,c9,i9,n9;var E7=k(()=>{z1={duration:300,delay:0,ease:"ease",direction:"both"};p9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||z1.duration:z1.duration,G=Z.length>2?Z[2]||z1.ease:z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||z1.delay:z1.delay,q=Z.length>4?Z[4]||z1.direction:z1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=aG(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${W}" class="${z} ${_} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},c9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},i9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=YK(Q,J,{staggerDelay:G,sequence:K});return`${$}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},n9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=tG();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as o9}from"stx-router";var r9=k(()=>{D7()});async function XK($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=o9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var a9;var D7=k(()=>{r9();a9={name:"stxRouter",handler:XK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function t9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...JK,...Z};return`
235
+ `}function o9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!QK(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=KK();Q=Q.replace("</head>",`${K}
236
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=GK(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
237
+ `+Q.slice(W)}}return Q}var z1,i9,n9,s9,r9;var E7=k(()=>{z1={duration:300,delay:0,ease:"ease",direction:"both"};i9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||z1.duration:z1.duration,G=Z.length>2?Z[2]||z1.ease:z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||z1.delay:z1.delay,q=Z.length>4?Z[4]||z1.direction:z1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=XK(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${W}" class="${z} ${_} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},n9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},s9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=qK(Q,J,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},r9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=JK();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as a9}from"stx-router";var t9=k(()=>{D7()});async function WK($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=a9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var e9;var D7=k(()=>{t9();e9={name:"stxRouter",handler:WK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function $8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...UK,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,8 +619,8 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function e9($,Z){let Y=t9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function QK($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var JK,$8;var k7=k(()=>{JK={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};$8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=QK(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return t9(Q)}}});function V1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Z8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function Y8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),U=K.slice(q+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)}J[W]=U}return{data:J,content:Q.trim()}}function i5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,_)=>{let B=J.length,j=z?` class="language-${V1(z)}"`:"";return J.push(`<pre><code${j}>${V1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${V1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,_)=>{return`<img src="${Z8(_)?V1(_):""}" alt="${V1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,_)=>{return`<a href="${Z8(_)?V1(_):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
622
+ `}function Z8($,Z){let Y=$8(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function zK($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var UK,Y8;var k7=k(()=>{UK={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};Y8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=zK(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return $8(Q)}}});function V1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function X8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function J8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),U=K.slice(q+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)}J[W]=U}return{data:J,content:Q.trim()}}function i5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,_)=>{let B=J.length,j=z?` class="language-${V1(z)}"`:"";return J.push(`<pre><code${j}>${V1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${V1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,_)=>{return`<img src="${X8(_)?V1(_):""}" alt="${V1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,_)=>{return`<a href="${X8(_)?V1(_):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,_)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${V1(L)}</th>`).join("")}</tr>`,H=_.trim().split(`
625
625
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${V1(O)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
@@ -639,8 +639,8 @@ ${H}
639
639
  `),X)Q=Q.replace(/\n/g,`<br />
640
640
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}function GK(){let $=globalThis;return $[X8]??=new Map,$[X8]}function e($,Z){let Y=GK(),X=`${import.meta.url}\x00${$}`,Q=Y.get(X);if(Q)return Q;let J=Z();return Y.set(X,J),J.catch(()=>{if(Y.get(X)===J)Y.delete(X)}),J}var X8;var n5=k(()=>{X8=Symbol.for("stx.lazy-module-promises")});import KK from"process";function c0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(KK.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var x1=()=>{};import s5 from"path";function Q8($){J8=$?.trim()||null}function o5(){return process.env[qK]?.trim()||J8||W5}function r5($=process.cwd(),...Z){let Y=o5();return s5.isAbsolute(Y)?s5.join(Y,...Z):s5.join($,Y,...Z)}function a5($){if(!$||s5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==W5&&!Z.startsWith(`${W5}/`))return $;let Y=Z.slice(W5.length+1);return Y?s5.join(o5(),Y):o5()}var W5=".stx",qK="STX_DIR",J8=null;var C$=()=>{};var t5={};t(t5,{shouldLogBundlerDiagnostics:()=>W8,queueClientBundleBuild:()=>U8,hasUserImports:()=>UK,bundleClientScript:()=>_K});import H0 from"path";import C0 from"fs";function W8($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function f1(...$){if(W8())console.log("[stx:bundler]",...$)}function UK($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!G8.some((G)=>G.test(Q)))return f1("detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!G8.some((G)=>G.test(Q)))return f1("detected side-effect import:",Q),!0}return!1}function zK($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return f1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=H0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:q}})}}}function U8($){let Z=globalThis,X=(Z[K8]??Promise.resolve()).then($,$);return Z[K8]=X.then(()=>{return},()=>{return}),X}async function _K($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||r5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${WK}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==q8||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(C0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return f1("cache hit:",K),await U.text();f1("cache invalidated by dep change:",K)}let z=b7.get(K);if(z)return await z;let _=U8(()=>BK($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));b7.set(K,_);try{return await _}finally{b7.delete(K)}}async function BK($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=r5(X,"bundle-tmp"),U=H0.join(W,`${G}.ts`),z=H0.join(W,"out",G);C0.mkdirSync(W,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let _=H0.dirname(Z),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let F=B.length>0?`
643
- export { ${B.join(", ")} }`:"";await Bun.write(U,$+F),f1("bundling:",G,"from:",H0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[zK(X,_,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...c0()},root:X});if(!V.success){let E=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",E),$}let w="";for(let E of V.outputs){w=await E.text();break}let A=[];for(let E of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of E[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let M=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 R=`__stxBundle_${G}`,N=A.map(([E,y])=>`${JSON.stringify(E)}: ${y}`).join(", "),T=A.map(([E])=>`var ${E} = undefined;`).join(`
642
+ `}),$}function _K(){let $=globalThis;return $[Q8]??=new Map,$[Q8]}function e($,Z){let Y=_K(),X=`${import.meta.url}\x00${$}`,Q=Y.get(X);if(Q)return Q;let J=Z();return Y.set(X,J),J.catch(()=>{if(Y.get(X)===J)Y.delete(X)}),J}var Q8;var n5=k(()=>{Q8=Symbol.for("stx.lazy-module-promises")});import BK from"process";function c0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(BK.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var x1=()=>{};import s5 from"path";function K8($){G8=$?.trim()||null}function r5(){return process.env[jK]?.trim()||G8||W5}function o5($=process.cwd(),...Z){let Y=r5();return s5.isAbsolute(Y)?s5.join(Y,...Z):s5.join($,Y,...Z)}function a5($){if(!$||s5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==W5&&!Z.startsWith(`${W5}/`))return $;let Y=Z.slice(W5.length+1);return Y?s5.join(r5(),Y):r5()}var W5=".stx",jK="STX_DIR",G8=null;var C$=()=>{};var t5={};t(t5,{shouldLogBundlerDiagnostics:()=>z8,queueClientBundleBuild:()=>_8,hasUserImports:()=>OK,bundleClientScript:()=>FK});import H0 from"path";import C0 from"fs";function z8($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function f1(...$){if(z8())console.log("[stx:bundler]",...$)}function OK($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!q8.some((G)=>G.test(Q)))return f1("detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!q8.some((G)=>G.test(Q)))return f1("detected side-effect import:",Q),!0}return!1}function LK($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return f1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=H0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:q}})}}}function _8($){let Z=globalThis,X=(Z[W8]??Promise.resolve()).then($,$);return Z[W8]=X.then(()=>{return},()=>{return}),X}async function FK($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||o5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${HK}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==U8||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(C0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return f1("cache hit:",K),await U.text();f1("cache invalidated by dep change:",K)}let z=b7.get(K);if(z)return await z;let _=_8(()=>VK($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));b7.set(K,_);try{return await _}finally{b7.delete(K)}}async function VK($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=o5(X,"bundle-tmp"),U=H0.join(W,`${G}.ts`),z=H0.join(W,"out",G);C0.mkdirSync(W,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let _=H0.dirname(Z),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let F=B.length>0?`
643
+ export { ${B.join(", ")} }`:"";await Bun.write(U,$+F),f1("bundling:",G,"from:",H0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[LK(X,_,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...c0()},root:X});if(!V.success){let E=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",E),$}let w="";for(let E of V.outputs){w=await E.text();break}let A=[];for(let E of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of E[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let M=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 R=`__stxBundle_${G}`,N=A.map(([E,y])=>`${JSON.stringify(E)}: ${y}`).join(", "),T=A.map(([E])=>`var ${E} = undefined;`).join(`
644
644
  `),I=A.map(([E])=>`${E} = ${R}[${JSON.stringify(E)}];`).join(`
645
645
  `);if(w=`${M.join(`
646
646
  `)}
@@ -649,20 +649,25 @@ var ${R} = (function() {
649
649
  ${w}
650
650
  return { ${N} };
651
651
  })();
652
- ${I}`.trim(),f1("bundled:",G,"output:",w.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${H0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let D=Array.from(O).map((E)=>{try{return{path:E,mtimeMs:C0.statSync(E).mtimeMs}}catch{return null}}).filter((E)=>E!==null);return await Bun.write(q,JSON.stringify({metadataVersion:q8,files:D})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,M=Array.isArray(A)&&A.length>0?`
652
+ ${I}`.trim(),f1("bundled:",G,"output:",w.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${H0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let D=Array.from(O).map((E)=>{try{return{path:E,mtimeMs:C0.statSync(E).mtimeMs}}catch{return null}}).filter((E)=>E!==null);return await Bun.write(q,JSON.stringify({metadataVersion:U8,files:D})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,M=Array.isArray(A)&&A.length>0?`
653
653
  ${A.map((R)=>`- ${R?.message??R}`).join(`
654
- `)}`:"";return console.warn(`[stx:bundler] error: ${w}${M}`),$}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var WK=5,q8=1,G8,b7,K8;var e5=k(()=>{x1();C$();G8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];b7=new Map,K8=Symbol.for("stx.client-bundle-build-queue")});var O8={};t(O8,{renderVendorStyleTags:()=>x$,processClientScript:()=>u1,injectBrowserCoreAutoImports:()=>U5,generateServerDataBridge:()=>f$,generateBrowserAutoImportDestructuring:()=>MK,generateAutoImportDestructuring:()=>S7,extractBridgeData:()=>h1,extractAndStripCssImports:()=>v$});import g1 from"path";import $$ from"fs";function HK($){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 OK($,Z){let Y=Z;while(!0){let X=g1.join(Y,"node_modules",$,"package.json");if($$.existsSync(X))return g1.dirname(X);let Q=g1.dirname(Y);if(Q===Y)return null;Y=Q}}function LK($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function FK($,Z){let Y=HK($);if(!Y||!Y.subpath)return null;let X=OK(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse($$.readFileSync(g1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=LK(Q.exports,J);if(!G)return null;let K=g1.resolve(X,G);return $$.existsSync(K)?K:null}function v$($,Z){let Y=Z.filePath?g1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(jK,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:g1.resolve(Y,q),!$$.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=FK(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=$$.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function VK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${VK(Z.source)}" data-stx-layer="vendor">
654
+ `)}`:"";return console.warn(`[stx:bundler] error: ${w}${M}`),$}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var HK=5,U8=1,q8,b7,W8;var e5=k(()=>{x1();C$();q8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];b7=new Map,W8=Symbol.for("stx.client-bundle-build-queue")});var V8={};t(V8,{stripCommentsAndLiterals:()=>O8,renderVendorStyleTags:()=>x$,processClientScript:()=>u1,injectBrowserCoreAutoImports:()=>U5,generateServerDataBridge:()=>f$,generateBrowserAutoImportDestructuring:()=>kK,generateAutoImportDestructuring:()=>S7,extractBridgeData:()=>h1,extractAndStripCssImports:()=>v$});import g1 from"path";import $$ from"fs";function AK($){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 RK($,Z){let Y=Z;while(!0){let X=g1.join(Y,"node_modules",$,"package.json");if($$.existsSync(X))return g1.dirname(X);let Q=g1.dirname(Y);if(Q===Y)return null;Y=Q}}function MK($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function NK($,Z){let Y=AK($);if(!Y||!Y.subpath)return null;let X=RK(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse($$.readFileSync(g1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=MK(Q.exports,J);if(!G)return null;let K=g1.resolve(X,G);return $$.existsSync(K)?K:null}function v$($,Z){let Y=Z.filePath?g1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(wK,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:g1.resolve(Y,q),!$$.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=NK(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=$$.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function TK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${TK(Z.source)}" data-stx-layer="vendor">
655
655
  @layer vendor {
656
656
  ${Z.contents}
657
657
  }
658
658
  </style>`}).join(`
659
659
  `)}
660
- `}function U5($){let Z=new Set;for(let G of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of G[1].split(",")){let q=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Z.add(q)}let Y=new Set;for(let G of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(G[1]);for(let G of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of G[1].split(",")){let q=K.trim().split(/[:=]/).pop()?.trim();if(q)Y.add(q)}let X=B8.filter((G)=>{if(Z.has(G)||Y.has(G))return!1;return new RegExp(`\\b${G}\\b`).test($)}),Q=j8($).filter((G)=>!Z.has(G)&&!Y.has(G));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(`
660
+ `}function U5($){let Z=O8($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of K[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Y.add(W)}let X=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of K[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)X.add(W)}let Q=H8.filter((K)=>{if(Y.has(K)||X.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),J=L8(Z).filter((K)=>!Y.has(K)&&!X.has(K));if(Q.length===0&&J.length===0)return{code:$,imports:Q,models:J};return{code:`${[Q.length>0?`import { ${Q.join(", ")} } from '@stacksjs/browser'`:"",J.length>0?"import '@stacksjs/browser'":"",J.length>0?`const { ${J.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
661
661
  `)}
662
- ${$}`,imports:X,models:Q}}function j8($){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,X;while((X=Y.exec($))!==null)if(!AK.has(X[1]))Z.add(X[1]);return Array.from(Z)}function RK($){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 X of Y[1].split(",")){let Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function H8($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let H=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let L=H[1],F=H[2]||L;if(Q.add(L),Q.add(F),U==="stx"||U==="@stacksjs/stx")Z.add(L);else Y.add(L);if(F!==L)z.push(`${F} = ${L}`)}let _=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],_)}let K=RK(X);for(let W of wK){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of B8){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=j8(X);for(let W of q)if(!Q.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function S7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
662
+ ${$}`,imports:Q,models:J}}function O8($){let Z="",Y=0;while(Y<$.length){let X=$.slice(Y,Y+2);if(X==="//"){while(Y<$.length&&$[Y]!==`
663
+ `)Z+=" ",Y++;continue}if(X==="/*"){while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Z+=$[Y]===`
664
+ `?`
665
+ `:" ",Y++;Z+=" ",Y+=2;continue}let Q=$[Y];if(Q==='"'||Q==="'"||Q==="`"){let J=Q;Z+=" ",Y++;while(Y<$.length&&$[Y]!==J){if($[Y]==="\\"){Z+=" ",Y+=2;continue}Z+=$[Y]===`
666
+ `?`
667
+ `:" ",Y++}Z+=" ",Y++;continue}Z+=Q,Y++}return Z}function L8($){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,X;while((X=Y.exec($))!==null)if(!EK.has(X[1]))Z.add(X[1]);return Array.from(Z)}function DK($){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 X of Y[1].split(",")){let Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function F8($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let H=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let L=H[1],F=H[2]||L;if(Q.add(L),Q.add(F),U==="stx"||U==="@stacksjs/stx")Z.add(L);else Y.add(L);if(F!==L)z.push(`${F} = ${L}`)}let _=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],_)}let K=DK(X);for(let W of IK){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of H8){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=L8(X);for(let W of q)if(!Q.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function S7($,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
663
668
  ${Y.join(`
664
669
  `)}
665
- ${NK($,Z)}`;return""}function MK($,Z=[]){let{browserImports:Y}=H8($),X=new Set(Z);return S7([],Y.filter((Q)=>!X.has(Q)))}function NK($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
670
+ ${bK($,Z)}`;return""}function kK($,Z=[]){let{browserImports:Y}=F8($),X=new Set(Z);return S7([],Y.filter((Q)=>!X.has(Q)))}function bK($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
666
671
  [${Y.join(", ")}].forEach(function (e) {
667
672
  if (e[1] !== 'undefined') return;
668
673
  console.error(
@@ -671,10 +676,10 @@ ${NK($,Z)}`;return""}function MK($,Z=[]){let{browserImports:Y}=H8($),X=new Set(Z
671
676
  + 'or it should be imported from a relative path so the bundler includes it.'
672
677
  );
673
678
  });
674
- `}function h1($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function z8($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function TK($,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(z8(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(z8(Y[1],!1).has(Z))return!0;return!1}function f$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(TK($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
679
+ `}function h1($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function B8($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function SK($,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(B8(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B8(Y[1],!1).has(Z))return!0;return!1}function f$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(SK($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
675
680
  ${Y.join(`
676
681
  `)}
677
- `}function EK($){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((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=IK[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function DK($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=EK(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
682
+ `}function PK($){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((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=yK[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function CK($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=PK(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
678
683
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
679
684
  };`;function _(B){if(/\$emit\s*\(/.test(B))return`${z}
680
685
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -717,11 +722,11 @@ else {
717
722
  else {
718
723
  ${Q}
719
724
  }
720
- }${q})`}function kK($){if($.length===0)return"";return`
725
+ }${q})`}function vK($){if($.length===0)return"";return`
721
726
  // STX: auto-generated event bindings
722
- ${$.map((Y,X)=>DK(Y,X)).join(`
723
- `)}`}function _8($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
724
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let _=z[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=z[0].length;continue}}G++}return Z}function SK($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!bK.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function u1($,Z={}){let Y=$,X="",Q=!1,J=[],G=v$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=x$(G.styles),q=U5(Y);Y=q.code,J=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5)));if(W(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=H8(Y);Y=O.code,X=S7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${f$(Y,Z.serverData)}${X}`,Y=a0(Y),!Q&&d1(Z.attrs||""))Y=m1(Y);let z=kK(Z.eventBindings||[]),_=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(_)){let O=_.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
727
+ ${$.map((Y,X)=>CK(Y,X)).join(`
728
+ `)}`}function j8($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
729
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let _=z[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=z[0].length;continue}}G++}return Z}function fK($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!xK.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function u1($,Z={}){let Y=$,X="",Q=!1,J=[],G=v$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=x$(G.styles),q=U5(Y);Y=q.code,J=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5)));if(W(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=F8(Y);Y=O.code,X=S7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${f$(Y,Z.serverData)}${X}`,Y=a0(Y),!Q&&d1(Z.attrs||""))Y=m1(Y);let z=vK(Z.eventBindings||[]),_=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(_)){let O=_.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
725
730
  ${X}${Y}
726
731
  ${z}
727
732
  </script>`}let j=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
@@ -730,12 +735,12 @@ window.stx.mount(function() {
730
735
  'use strict';
731
736
  ${X}${Y}
732
737
  ${z}${V}
733
- })</script>`}if(!L&&!H){if(j)return F(_8($));if(Z.templateContent){let O=_8($);if(O.length>0){let V=SK(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
738
+ })</script>`}if(!L&&!H){if(j)return F(j8($));if(Z.templateContent){let O=j8($);if(O.length>0){let V=fK(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
734
739
  ;(function() {
735
740
  'use strict';
736
741
  ${X}${Y}
737
742
  ${z}
738
- })()</script>`}var jK,wK,B8,AK,IK,bK;var z5=k(()=>{w0();n5();jK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;wK=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],B8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];AK=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"]);IK={left:0,middle:1,right:2};bK=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 yK}from"crypto";function L8($){let Z=$[g$];return Z instanceof Map?Z:null}function F8($){$[g$]=new Map}function V8($,Z){let Y=L8($);if(!Y)return null;let X=yK("sha256").update(Z).digest("hex").slice(0,16),Q=Y.get(X);if(Q)Q.instances++;else Y.set(X,{body:Z,instances:1});return X}function w8($,Z){let Y=L8(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(U,(z,_)=>`(${W.body})(${_});`)}let Q=[...Y].filter(([,q])=>q.instances>1);if(Q.length===0)return X;let G=`<script data-stx-scoped data-stx-component-factories>
743
+ })()</script>`}var wK,IK,H8,EK,yK,xK;var z5=k(()=>{w0();n5();wK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;IK=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],H8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];EK=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"]);yK={left:0,middle:1,right:2};xK=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 gK}from"crypto";function w8($){let Z=$[g$];return Z instanceof Map?Z:null}function A8($){$[g$]=new Map}function R8($,Z){let Y=w8($);if(!Y)return null;let X=gK("sha256").update(Z).digest("hex").slice(0,16),Q=Y.get(X);if(Q)Q.instances++;else Y.set(X,{body:Z,instances:1});return X}function M8($,Z){let Y=w8(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(U,(z,_)=>`(${W.body})(${_});`)}let Q=[...Y].filter(([,q])=>q.instances>1);if(Q.length===0)return X;let G=`<script data-stx-scoped data-stx-component-factories>
739
744
  (function() {
740
745
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
741
746
  ${Q.map(([q,W])=>` factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body};`).join(`
@@ -743,7 +748,7 @@ ${Q.map(([q,W])=>` factories[${JSON.stringify(q)}] = factories[${JSON.stringify
743
748
  })();
744
749
  </script>`,K=X.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
745
750
  ${X}`;return`${X.slice(0,K)}${G}
746
- ${X.slice(K)}`}var g$="__stx_component_client_factories";var y7=()=>{};function xK($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function fK($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(CK.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&N8.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function gK($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!N8.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function h$($){let Z=$.trim(),Y=xK(Z);fK(Y,Z),gK(Z);for(let X of M8)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!R8.allowBracketNotation&&vK.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function hK($){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,X]of Object.entries($)){if(Y.startsWith("__")||M8.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=P7(X);else Z[Y]=X}return Z}function P7($,Z=0){if(Z>=R8.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>P7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=P7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=hK(Z),X=Object.keys(Y),Q=Object.values(Y);return q0($,X)(...Q)}catch{return}}function K0($){try{return h$($),!0}catch{return!1}}function A0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=h$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(T8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
751
+ ${X.slice(K)}`}var g$="__stx_component_client_factories";var y7=()=>{};function mK($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function lK($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(uK.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&E8.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function pK($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!E8.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function h$($){let Z=$.trim(),Y=mK(Z);lK(Y,Z),pK(Z);for(let X of I8)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!T8.allowBracketNotation&&dK.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function cK($){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,X]of Object.entries($)){if(Y.startsWith("__")||I8.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=P7(X);else Z[Y]=X}return Z}function P7($,Z=0){if(Z>=T8.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>P7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=P7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=cK(Z),X=Object.keys(Y),Q=Object.values(Y);return q0($,X)(...Q)}catch{return}}function K0($){try{return h$($),!0}catch{return!1}}function A0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=h$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(D8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
747
752
  'use strict';
748
753
  try {
749
754
  return ${Y};
@@ -754,7 +759,7 @@ catch (e) {
754
759
  }
755
760
  throw e;
756
761
  }
757
- `),K=G([]);if(J.length===Z.length)return A8(K,J,G);return A8((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function A8($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let _=z instanceof Error?z.message:"",B=J.exec(_);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||T8.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function u$($){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 X of Y)if(X.test(Z))return!1;return!0}var PK,R8,M8,CK,N8,vK,T8;var O0=k(()=>{PK={maxSanitizeDepth:10,allowBracketNotation:!1},R8={...PK},M8=[/\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/],CK=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"]),N8=new Set(["__proto__","constructor","prototype"]),vK=/[\w)\]]\s*\[\s*['"]/;T8=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 d$($,Z){let Y=uK++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return dK.set(X,{type:$,expression:Z}),X}var uK=0,dK;var I8=k(()=>{dK=new Map});function S8($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function w1($,Z){return S8($,Z,E8,D8)}function _5($,Z){return S8($,Z,k8,b8)}function Z$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function mK($,Z){if($.startsWith("<!--",Z)){let Y=Z$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[E8,D8],[k8,b8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function C7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=mK($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function X1($,Z,Y){let X=C7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function A1($){let{output:Z,tokens:Y}=X1($,w1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function Y$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var E8,D8,k8,b8;var l1=k(()=>{E8=/<script\b[^>]*>/iy,D8=/<\/script\s*>/ig,k8=/<style\b[^>]*>/iy,b8=/<\/style\s*>/ig});var f8={};t(f8,{usesSignalsInScript:()=>B5,unescapeHtml:()=>v7,registerFilters:()=>pK,registerFilter:()=>C8,processExpressions:()=>R1,interpolateScriptsInTemplate:()=>iK,interpolateScriptExpressions:()=>m$,getAllFilters:()=>v8,evaluateExpression:()=>i0,escapeHtml:()=>t0,defaultFilters:()=>J$,clearCustomFilters:()=>cK,applyFilters:()=>x8});function lK($){let Z=y8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),y8.set($,Z)}return Z.lastIndex=0,Z}function C8($,Z){if($ in J$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);X$[$]=Z}function pK($){for(let[Z,Y]of Object.entries($))C8(Z,Y)}function v8(){return{...J$,...X$}}function cK(){for(let $ of Object.keys(X$))delete X$[$]}function t0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B5($){let{scripts:Z}=A1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))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 P8($,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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function m$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=i0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=i0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function iK($,Z,Y={}){let{output:X,scripts:Q}=A1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-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 _=m$(z,Z);return q[0]+_+G.slice(W)});return Y$(X,J)}function R1($,Z,Y,X){let Q=$,J=(_,B)=>{let j=_5(_,B);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_.slice(B,j))?-1:j},G=(_,B,j,H)=>{let L=j.length,{output:F,tokens:O}=X1(_,B,(V,w)=>H(L+w));return j.push(...O),F},K=[];Q=G(Q,J,K,(_)=>`<!--__STX_STYLE_${_}__-->`);let q=[];Q=G(Q,w1,q,(_)=>`<!--__STX_SCRIPT_EXPR_${_}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||B5($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(_,B,j)=>{try{let H=i0(B,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${L}`,Y,$,j,_)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(_,B,j)=>{try{let H=i0(B,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return d$("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return d$("raw",B.trim());let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${L}`,Y,$,j,_)}}),Q=G(Q,w1,q,(_)=>`<!--__STX_SCRIPT_EXPR_${_}__-->`),Q=G(Q,J,K,(_)=>`<!--__STX_STYLE_${_}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(_,B,j)=>{let H=B.trim();if(z.has(H))return _;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),M=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(M),N=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=i0(B,Z);if(A)return _;if(W&&!P8(H,Z))return _;if(T===void 0&&Z.__stx_buildMode==="compile"&&!W)return d$("expr",H);return T!==void 0&&T!==null?t0(String(T)):""}catch(T){if(A)return _;if(W&&!P8(H,Z))return _;if(N)return _;let I=T instanceof Error?T.message:String(T);return U0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,_)}});for(let _=0;_<q.length;_++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${_}__-->`,()=>q[_]);for(let _=0;_<K.length;_++)Q=Q.replace(`<!--__STX_STYLE_${_}__-->`,()=>K[_]);return Q}function x8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=X$[G]||J$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(v8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[i0(`(${z})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return i0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function nK($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){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(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function i0($,Z,Y=!1){try{let X=$.trim(),Q=nK(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=i0(J,Z,!0);return x8(K,G,Z)}if(!K0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=sK(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function sK($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=oK($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function oK($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function v7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var X$,y8,J$;var J1=k(()=>{O0();w0();I8();l1();X$={},y8=new Map;J$={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 X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.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 X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(lK(q),String(W))}),K},t:($,Z,Y={})=>{return J$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={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 Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},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,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},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 X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function j5($="const",Z=[],Y){let X=Z.length?l$.filter((Q)=>!Z.includes(Q)):l$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var l$,g8;var Q$=k(()=>{l$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],g8=["onMount","onDestroy"]});class p1{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 O5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!H5.has(Y)){if(H5.size>=rK){let X=H5.keys().next().value;if(X)H5.delete(X)}H5.set(Y,new RegExp($,Z))}return H5.get(Y)}class h8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
762
+ `),K=G([]);if(J.length===Z.length)return N8(K,J,G);return N8((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function N8($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let _=z instanceof Error?z.message:"",B=J.exec(_);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||D8.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function u$($){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 X of Y)if(X.test(Z))return!1;return!0}var hK,T8,I8,uK,E8,dK,D8;var O0=k(()=>{hK={maxSanitizeDepth:10,allowBracketNotation:!1},T8={...hK},I8=[/\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/],uK=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"]),E8=new Set(["__proto__","constructor","prototype"]),dK=/[\w)\]]\s*\[\s*['"]/;D8=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 d$($,Z){let Y=iK++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return nK.set(X,{type:$,expression:Z}),X}var iK=0,nK;var k8=k(()=>{nK=new Map});function C8($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function w1($,Z){return C8($,Z,b8,S8)}function _5($,Z){return C8($,Z,y8,P8)}function Z$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function sK($,Z){if($.startsWith("<!--",Z)){let Y=Z$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[b8,S8],[y8,P8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function C7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=sK($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function X1($,Z,Y){let X=C7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function A1($){let{output:Z,tokens:Y}=X1($,w1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function Y$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var b8,S8,y8,P8;var l1=k(()=>{b8=/<script\b[^>]*>/iy,S8=/<\/script\s*>/ig,y8=/<style\b[^>]*>/iy,P8=/<\/style\s*>/ig});var u8={};t(u8,{usesSignalsInScript:()=>B5,unescapeHtml:()=>v7,registerFilters:()=>oK,registerFilter:()=>f8,processExpressions:()=>R1,interpolateScriptsInTemplate:()=>tK,interpolateScriptExpressions:()=>m$,getAllFilters:()=>g8,evaluateExpression:()=>i0,escapeHtml:()=>t0,defaultFilters:()=>J$,clearCustomFilters:()=>aK,applyFilters:()=>h8});function rK($){let Z=v8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),v8.set($,Z)}return Z.lastIndex=0,Z}function f8($,Z){if($ in J$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);X$[$]=Z}function oK($){for(let[Z,Y]of Object.entries($))f8(Z,Y)}function g8(){return{...J$,...X$}}function aK(){for(let $ of Object.keys(X$))delete X$[$]}function t0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B5($){let{scripts:Z}=A1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))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 x8($,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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function m$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=i0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=i0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function tK($,Z,Y={}){let{output:X,scripts:Q}=A1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-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 _=m$(z,Z);return q[0]+_+G.slice(W)});return Y$(X,J)}function R1($,Z,Y,X){let Q=$,J=(_,B)=>{let j=_5(_,B);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_.slice(B,j))?-1:j},G=(_,B,j,H)=>{let L=j.length,{output:F,tokens:O}=X1(_,B,(V,w)=>H(L+w));return j.push(...O),F},K=[];Q=G(Q,J,K,(_)=>`<!--__STX_STYLE_${_}__-->`);let q=[];Q=G(Q,w1,q,(_)=>`<!--__STX_SCRIPT_EXPR_${_}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||B5($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(_,B,j)=>{try{let H=i0(B,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${L}`,Y,$,j,_)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(_,B,j)=>{try{let H=i0(B,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return d$("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return d$("raw",B.trim());let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${L}`,Y,$,j,_)}}),Q=G(Q,w1,q,(_)=>`<!--__STX_SCRIPT_EXPR_${_}__-->`),Q=G(Q,J,K,(_)=>`<!--__STX_STYLE_${_}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(_,B,j)=>{let H=B.trim();if(z.has(H))return _;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),M=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(M),N=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=i0(B,Z);if(A)return _;if(W&&!x8(H,Z))return _;if(T===void 0&&Z.__stx_buildMode==="compile"&&!W)return d$("expr",H);return T!==void 0&&T!==null?t0(String(T)):""}catch(T){if(A)return _;if(W&&!x8(H,Z))return _;if(N)return _;let I=T instanceof Error?T.message:String(T);return U0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,_)}});for(let _=0;_<q.length;_++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${_}__-->`,()=>q[_]);for(let _=0;_<K.length;_++)Q=Q.replace(`<!--__STX_STYLE_${_}__-->`,()=>K[_]);return Q}function h8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=X$[G]||J$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(g8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[i0(`(${z})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return i0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function eK($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){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(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function i0($,Z,Y=!1){try{let X=$.trim(),Q=eK(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=i0(J,Z,!0);return h8(K,G,Z)}if(!K0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=$q(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function $q($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=Zq($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function Zq($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function v7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var X$,v8,J$;var J1=k(()=>{O0();w0();k8();l1();X$={},v8=new Map;J$={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 X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.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 X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(rK(q),String(W))}),K},t:($,Z,Y={})=>{return J$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={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 Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},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,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},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 X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function j5($="const",Z=[],Y){let X=Z.length?l$.filter((Q)=>!Z.includes(Q)):l$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var l$,d8;var Q$=k(()=>{l$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],d8=["onMount","onDestroy"]});class p1{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 O5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!H5.has(Y)){if(H5.size>=Yq){let X=H5.keys().next().value;if(X)H5.delete(X)}H5.set(Y,new RegExp($,Z))}return H5.get(Y)}class m8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
758
763
  'use strict';
759
764
  try {
760
765
  return ${q};
@@ -765,14 +770,14 @@ catch (e) {
765
770
  }
766
771
  throw e;
767
772
  }
768
- `),Q.set(W,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 u8{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(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-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(J)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 X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.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 X of this.violations)if($[X.label]=($[X.label]||0)+1,X.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 aK(){if(!x7)x7=new u8;return x7}var H5,rK=500,eO,x7=null,d8;var L5=k(()=>{H5=new Map;eO=new h8;d8=new Proxy({},{get($,Z){return aK()[Z]}})});var j0;var m8=k(()=>{j0={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 s8={};t(s8,{resetCssCache:()=>Qq,resetCrosswindCache:()=>Gq,rebuildCrosswindCSS:()=>Kq,loadCrosswindConfig:()=>u7,loadCrosswind:()=>h7,injectCrosswindCSS:()=>d7,getCrosswindServeAsset:()=>$q,getCachedCSS:()=>qq,generateCrosswindCSS:()=>n8,extractClassNames:()=>i8,buildCrosswindCSS:()=>c8});import X0 from"path";import{hasLocalConfig as tK}from"bunfig/discovery";function c$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f7($,Z){if(_1.has($))_1.delete($);else if(_1.size>=p8)_1.delete(_1.keys().next().value);_1.set($,Z)}function eK($){let Z=c$($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=p8)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function $q($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function Zq($){if(!M1)return null;try{let Z=Bun.file(X0.join(M1,`cw-${c$($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Yq($,Z){if(!M1)return;try{if(!fs.existsSync(M1))fs.mkdirSync(M1,{recursive:!0});await Bun.write(X0.join(M1,`cw-${c$($)}.css`),Z)}catch{}}async function l8($){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 Xq(){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 Jq(){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 h7(){if(g7)return Q1;g7=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await l8(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=X0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(Xq());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await l8(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return Q1}}let X=await $(Jq());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}function Qq(){_1.clear(),e0.clear()}function Gq(){Q1=null,g7=!1,$1=null,G$="",_1.clear(),e0.clear(),p$=null}async function u7($){try{if(!tK({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 X=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function c8($){if(F5)return G$;F5=!0;try{let Z=await h7();if(!Z||!Z.build)return F5=!1,"";if(!$1)$1=await u7($);if(!$1)return F5=!1,"";let Y=Z.defaultConfig?.theme||{},X=$1.theme||{},Q={...Z.defaultConfig,...$1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},J=performance.now(),G=await Z.build(Q),K=performance.now()-J;if(G$=G.css,console.log(`${j0.cyan}[Crosswind]${j0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=X0.isAbsolute(Q.output)?Q.output:X0.join($,Q.output),W=X0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return F5=!1,G.css}catch(Z){return console.error(`${j0.red}[Crosswind]${j0.reset} Build error:`,Z),F5=!1,G$}}async function Kq($){$1=null,await c8($)}function qq(){return G$}function i8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function n8($,Z){try{let Y=await h7();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):i8($);if(X.size===0)return"";let Q=Z?X0.resolve(Z):process.cwd();if(!M1)M1=r5(Q,"cache");let J=[...X].sort().join(" "),G=`${p$||"default"}::${J}`,K=_1.get(G);if(K!==void 0)return f7(G,K),K;let q=await Zq(G);if(q!==null)return f7(G,q),q;if(!$1){let A=null;try{let{loadStxConfig:M}=await Promise.resolve().then(() => (c1(),o8)),R=await M(Q);if(R.css)if(typeof R.css==="string"){let N=X0.isAbsolute(R.css)?R.css:X0.resolve(Q,R.css);if(await Bun.file(N).exists()){let T=await import(N);A=T.default||T,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(Q,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);A={...T.default||T,...A}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=A||await u7(Q);try{p$=c$(JSON.stringify($1??{}))}catch{p$="unhashable"}}let W=Y.defaultConfig||Y.config,U=$1||{},z=W.theme||{},B=(U.theme||{}).extend||{},j={...z};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,M]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=M.split(/\s+/).filter(Boolean);for(let N of R)F.generate(N)}O=F.toCSS(!0,!1);let w=O.split(`
773
+ `),Q.set(W,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 l8{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(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-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(J)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 X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.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 X of this.violations)if($[X.label]=($[X.label]||0)+1,X.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 Xq(){if(!x7)x7=new l8;return x7}var H5,Yq=500,UL,x7=null,p8;var L5=k(()=>{H5=new Map;UL=new m8;p8=new Proxy({},{get($,Z){return Xq()[Z]}})});var j0;var c8=k(()=>{j0={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 a8={};t(a8,{resetCssCache:()=>zq,resetCrosswindCache:()=>_q,rebuildCrosswindCSS:()=>Bq,loadCrosswindConfig:()=>u7,loadCrosswind:()=>h7,injectCrosswindCSS:()=>d7,getCrosswindServeAsset:()=>Gq,getCachedCSS:()=>jq,generateCrosswindCSS:()=>o8,extractClassNames:()=>r8,buildCrosswindCSS:()=>s8});import X0 from"path";import{hasLocalConfig as Jq}from"bunfig";function c$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f7($,Z){if(_1.has($))_1.delete($);else if(_1.size>=n8)_1.delete(_1.keys().next().value);_1.set($,Z)}function Qq($){let Z=c$($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=n8)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function Gq($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function Kq($){if(!M1)return null;try{let Z=Bun.file(X0.join(M1,`cw-${c$($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function qq($,Z){if(!M1)return;try{if(!fs.existsSync(M1))fs.mkdirSync(M1,{recursive:!0});await Bun.write(X0.join(M1,`cw-${c$($)}.css`),Z)}catch{}}async function i8($){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 Wq(){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 Uq(){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 h7(){if(g7)return Q1;g7=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await i8(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=X0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(Wq());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await i8(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return Q1}}let X=await $(Uq());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}function zq(){_1.clear(),e0.clear()}function _q(){Q1=null,g7=!1,$1=null,G$="",_1.clear(),e0.clear(),p$=null}async function u7($){try{if(!Jq({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 X=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function s8($){if(F5)return G$;F5=!0;try{let Z=await h7();if(!Z||!Z.build)return F5=!1,"";if(!$1)$1=await u7($);if(!$1)return F5=!1,"";let Y=Z.defaultConfig?.theme||{},X=$1.theme||{},Q={...Z.defaultConfig,...$1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},J=performance.now(),G=await Z.build(Q),K=performance.now()-J;if(G$=G.css,console.log(`${j0.cyan}[Crosswind]${j0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=X0.isAbsolute(Q.output)?Q.output:X0.join($,Q.output),W=X0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return F5=!1,G.css}catch(Z){return console.error(`${j0.red}[Crosswind]${j0.reset} Build error:`,Z),F5=!1,G$}}async function Bq($){$1=null,await s8($)}function jq(){return G$}function r8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function o8($,Z){try{let Y=await h7();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):r8($);if(X.size===0)return"";let Q=Z?X0.resolve(Z):process.cwd();if(!M1)M1=o5(Q,"cache");let J=[...X].sort().join(" "),G=`${p$||"default"}::${J}`,K=_1.get(G);if(K!==void 0)return f7(G,K),K;let q=await Kq(G);if(q!==null)return f7(G,q),q;if(!$1){let A=null;try{let{loadStxConfig:M}=await Promise.resolve().then(() => (c1(),t8)),R=await M(Q);if(R.css)if(typeof R.css==="string"){let N=X0.isAbsolute(R.css)?R.css:X0.resolve(Q,R.css);if(await Bun.file(N).exists()){let T=await import(N);A=T.default||T,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(Q,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);A={...T.default||T,...A}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=A||await u7(Q);try{p$=c$(JSON.stringify($1??{}))}catch{p$="unhashable"}}let W=Y.defaultConfig||Y.config,U=$1||{},z=W.theme||{},B=(U.theme||{}).extend||{},j={...z};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,M]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=M.split(/\s+/).filter(Boolean);for(let N of R)F.generate(N)}O=F.toCSS(!0,!1);let w=O.split(`
769
774
  `);for(let[A,M]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=M.split(/\s+/).filter(Boolean),N=[],T=[];for(let I of R){let D=I.startsWith("dark:"),S=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let v=w[b].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let h=b,f="";while(h<w.length){if(f+=w[h],w[h].includes("}"))break;h++}let m=f.match(/\{([^}]+)\}/);if(m)if(D)T.push(m[1].trim());else N.push(m[1].trim());break}}}if(N.length)O+=`
770
775
  .${A} { ${N.join(" ")} }`;if(T.length)O+=`
771
- @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return f7(G,O),Yq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function d7($,Z,Y=!1){let X=await n8($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${eK(X)}.css">`:`<style data-crosswind="generated">
776
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return f7(G,O),qq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function d7($,Z,Y=!1){let X=await o8($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Qq(X)}.css">`:`<style data-crosswind="generated">
772
777
  ${X}
773
778
  </style>`,J=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(J.test($)){let G=!1;return $.replace(J,()=>{if(G)return"";return G=!0,Q})}if($.includes("</head>"))return $.replace("</head>",`${Q}
774
779
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
775
- ${Q}`);return Q+$}var Q1=null,g7=!1,$1=null,G$="",F5=!1,p8=256,_1,e0,M1=null,p$=null;var m7=k(()=>{C$();m8();_1=new Map,e0=new Map});function r8(){return`
780
+ ${Q}`);return Q+$}var Q1=null,g7=!1,$1=null,G$="",F5=!1,n8=256,_1,e0,M1=null,p$=null;var m7=k(()=>{C$();c8();_1=new Map,e0=new Map});function e8(){return`
776
781
  // STX Lifecycle Runtime
777
782
  (function() {
778
783
  if (typeof window === 'undefined') return;
@@ -1117,7 +1122,7 @@ else {
1117
1122
 
1118
1123
  console.log('[stx] Lifecycle runtime initialized');
1119
1124
  })();
1120
- `}function l7($){return Symbol($)}var GL,KL,qL;var a8=k(()=>{GL=l7("theme"),KL=l7("router"),qL=l7("i18n")});import*as e8 from"crypto";function t8($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Wq(){return`stx-${e8.randomBytes(4).toString("hex")}`}function Uq($){return/\$\w+\./.test($)}function zq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(Uq(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),t8(A).forEach((R)=>Y.add(R)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Wq(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:t8(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function _q($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
1125
+ `}function l7($){return Symbol($)}var LL,FL,VL;var $Z=k(()=>{LL=l7("theme"),FL=l7("router"),VL=l7("i18n")});import*as YZ from"crypto";function ZZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Hq(){return`stx-${YZ.randomBytes(4).toString("hex")}`}function Oq($){return/\$\w+\./.test($)}function Lq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(Oq(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),ZZ(A).forEach((R)=>Y.add(R)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Hq(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:ZZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Fq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
1121
1126
  <script>
1122
1127
  (function() {
1123
1128
  'use strict';
@@ -1275,10 +1280,10 @@ else {
1275
1280
  }
1276
1281
  })();
1277
1282
  </script>
1278
- `,X}function $Z($){let{html:Z,bindings:Y,stores:X}=zq($);if(Y.length===0)return $;let Q=_q(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var ZZ=()=>{};function Bq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return jq(Z);case"google-analytics":return Hq(Z);case"plausible":return Oq(Z);case"self-hosted":return Lq(Z);case"custom":return Fq(Z);default:return""}}function jq($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${u0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${u0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
1283
+ `,X}function XZ($){let{html:Z,bindings:Y,stores:X}=Lq($);if(Y.length===0)return $;let Q=Fq(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var JZ=()=>{};function Vq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return wq(Z);case"google-analytics":return Aq(Z);case"plausible":return Rq(Z);case"self-hosted":return Mq(Z);case"custom":return Nq(Z);default:return""}}function wq($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${u0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${u0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
1279
1284
  <!-- Fathom Analytics -->
1280
1285
  <script src="${u0(Y)}" ${Q.join(" ")}${X}></script>
1281
- `}function Hq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1286
+ `}function Aq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1282
1287
  <!-- Google Analytics -->
1283
1288
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
1284
1289
  <script>
@@ -1288,10 +1293,10 @@ else {
1288
1293
  gtag('config', '${Y}');
1289
1294
  ${X}
1290
1295
  </script>
1291
- `}function Oq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${u0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
1296
+ `}function Rq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${u0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
1292
1297
  <!-- Plausible Analytics -->
1293
1298
  <script defer data-domain="${u0(Z.domain)}" src="${u0(Q)}"></script>
1294
- `}function Lq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),X=u0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
1299
+ `}function Mq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),X=u0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
1295
1300
  d.addEventListener('click',function(e){
1296
1301
  var a=e.target.closest('a');
1297
1302
  if(a&&a.hostname!==location.hostname){
@@ -1324,7 +1329,7 @@ else {
1324
1329
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
1325
1330
  })();
1326
1331
  </script>
1327
- `}function Fq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1332
+ `}function Nq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1328
1333
  <!-- Custom Analytics -->
1329
1334
  <script>
1330
1335
  ${Z.inlineScript}
@@ -1332,7 +1337,7 @@ ${Z.inlineScript}
1332
1337
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${u0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${u0(Q)}="${u0(J)}"`);return`
1333
1338
  <!-- Custom Analytics -->
1334
1339
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${u0(Z.scriptUrl)}" defer></script>
1335
- `}function YZ($,Z){let Y=Bq(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);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 XZ=()=>{};function GZ($){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 X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(Vq.has(X))Z.systemKeys.push(X);else if(X in KZ)Z.mouse=X;else if(X in QZ||/^[a-z]$/.test(X))Z.keys.push(QZ[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function qZ($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!JZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:GZ(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!JZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:GZ(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function wq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=KZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Aq($,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 Rq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=wq($),Q=Aq($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1340
+ `}function QZ($,Z){let Y=Vq(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);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 GZ=()=>{};function WZ($){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 X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(Tq.has(X))Z.systemKeys.push(X);else if(X in UZ)Z.mouse=X;else if(X in qZ||/^[a-z]$/.test(X))Z.keys.push(qZ[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function zZ($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!KZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:WZ(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!KZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:WZ(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function Iq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=UZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Eq($,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 Dq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Iq($),Q=Eq($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1336
1341
  (function() {
1337
1342
  var $el = document.getElementById('${Y}');
1338
1343
  if (!$el) return;
@@ -1386,7 +1391,7 @@ else {
1386
1391
  __stx_runHandler('${K}', $event, $el);
1387
1392
  }
1388
1393
  }${G});
1389
- })();`}function Mq($){if($.length===0)return"";return`
1394
+ })();`}function kq($){if($.length===0)return"";return`
1390
1395
  <script data-stx-events>
1391
1396
  (function() {
1392
1397
  'use strict';
@@ -1434,11 +1439,11 @@ else {
1434
1439
  }
1435
1440
 
1436
1441
  // Event listeners
1437
- ${$.flatMap((Y)=>Y.events).map(Rq).join(`
1442
+ ${$.flatMap((Y)=>Y.events).map(Dq).join(`
1438
1443
  `)}
1439
1444
  })();
1440
- </script>`}function Nq($){let Z=qZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function WZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=Nq($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=qZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let _ of W.events)_.elementId=z[1]}for(let z of W.events){let _=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");U=U.replace(B,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=Mq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
1441
- `+J.slice(K);else J+=G;return J}var JZ,QZ,Vq,KZ;var UZ=k(()=>{JZ=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"]),QZ={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"},Vq=new Set(["ctrl","alt","shift","meta"]),KZ={left:0,middle:1,right:2}});function i$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function Iq($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=zZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${BZ++}`,U=zZ(G,"x-init"),z=Eq($,J,K+Q.length),_=$.slice(K,z.endIndex),B=Dq(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:B})}return Z}function Eq($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function Dq($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=kq(J);Z.set(G,K)}return Z}function kq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Tq++}`}function bq(){return`
1445
+ </script>`}function bq($){let Z=zZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function _Z($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=bq($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=zZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let _ of W.events)_.elementId=z[1]}for(let z of W.events){let _=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");U=U.replace(B,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=kq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
1446
+ `+J.slice(K);else J+=G;return J}var KZ,qZ,Tq,UZ;var BZ=k(()=>{KZ=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"]),qZ={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Tq=new Set(["ctrl","alt","shift","meta"]),UZ={left:0,middle:1,right:2}});function i$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function yq($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=jZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${OZ++}`,U=jZ(G,"x-init"),z=Pq($,J,K+Q.length),_=$.slice(K,z.endIndex),B=Cq(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:B})}return Z}function Pq($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function Cq($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=vq(J);Z.set(G,K)}return Z}function vq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Sq++}`}function xq(){return`
1442
1447
  // STX Reactive Runtime - x-cloak and transition CSS
1443
1448
  (function() {
1444
1449
  var style = document.createElement('style');
@@ -1645,7 +1650,7 @@ window.__stx_reactive = (function() {
1645
1650
 
1646
1651
  return { initScope: initScope, reactive: reactive };
1647
1652
  })();
1648
- `}function _Z($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=i0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=i0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function Sq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=_Z(X.stateExpr,Z),G=X.initExpr?_Z(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
1653
+ `}function HZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=i0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=i0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function fq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=HZ(X.stateExpr,Z),G=X.initExpr?HZ(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
1649
1654
  (function() {
1650
1655
  var scopeEl = document.querySelector('${X.selector}');
1651
1656
  if (!scopeEl) return;
@@ -1654,42 +1659,42 @@ window.__stx_reactive = (function() {
1654
1659
  })();`}).join(`
1655
1660
  `);return`
1656
1661
  <script data-stx-scoped data-stx-reactive>
1657
- ${bq()}
1662
+ ${xq()}
1658
1663
  ${Y}
1659
- </script>`}function jZ($,Z,Y){if(BZ=0,!Pq($))return $;let X=Iq($);if(X.length===0)return $;let Q=yq($,X),J=Sq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
1660
- `+Q.slice(G);else Q+=J;return Q}function yq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${i$(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${i$(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${i$(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${i$(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Pq($){return/x-data\s*=\s*["']/.test($)}var BZ=0,Tq=0;var HZ=k(()=>{J1()});import Cq from"fs";import p7 from"path";import{createHighlighter as vq}from"ts-syntax-highlighter";async function xq($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await Cq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let z=c7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=Y8(Q),K=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=i5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await fq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)c7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function fq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!n$)try{n$=await vq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!n$.getSupportedLanguages().includes(_))return K;return(await n$.highlight(z,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,_=await Q(q,W,U,z);J=J.replace(q,_)}return J}async function OZ($,Z,Y="",X={}){return await gq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!p7.isAbsolute(K))U=p7.resolve(p7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),M=V.substring(w+1).trim(),R=M.startsWith('"')&&M.endsWith('"'),N=M.startsWith("'")&&M.endsWith("'");if(R||N)M=M.substring(1,M.length-1);z[A]=M}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await xq(U,X),j={...Z,...B,...z},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return U0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function gq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var c7,n$=null;var LZ=k(()=>{c1();w0();c7=new Map});function N1($,Z){try{let Y=$.trim();if(K0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var FZ=k(()=>{O0()});function n7($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var s$=k(()=>{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 K$(){return!1}function q$(){return!K$()||process.env.STX_DEBUG==="true"}function o$(){return!1}import hq from"path";function r$(){return{...s7}}function a$($){if(!s7.showRelativePaths||!$)return $;let Z=s7.baseDir||process.cwd();try{let Y=hq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var uq,s7,t$,i1,e$;var $4=k(()=>{s$();uq={showRelativePaths:!1,enableAutoRecovery:q$(),logRecoveryWarnings:!0},s7={...uq};t$=class t$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=a$(this.filePath)}};i1=class i1 extends t${constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};e$=class e$ extends t${isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function wZ($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,_=J,B=G;if(!_&&K&&q!==void 0){let O=iq(K,q);_=O.line,B=O.column}let j=Q?a$(Q):void 0,H=X?n7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=mq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=lq(L,K,q);break;case"text":default:F=dq(L,K,q);break}return{formatted:F,data:L}}function dq($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
1661
- ${$.message}`),Z&&$.line){let J=pq(Z,$.line,2);if(J)X.push(`
1664
+ </script>`}function LZ($,Z,Y){if(OZ=0,!hq($))return $;let X=yq($);if(X.length===0)return $;let Q=gq($,X),J=fq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
1665
+ `+Q.slice(G);else Q+=J;return Q}function gq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${i$(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${i$(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${i$(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${i$(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function hq($){return/x-data\s*=\s*["']/.test($)}var OZ=0,Sq=0;var FZ=k(()=>{J1()});import uq from"fs";import p7 from"path";import{createHighlighter as dq}from"ts-syntax-highlighter";async function mq($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await uq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let z=c7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=J8(Q),K=Z.markdown||i7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=i5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await lq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)c7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function lq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!n$)try{n$=await dq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!n$.getSupportedLanguages().includes(_))return K;return(await n$.highlight(z,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,_=await Q(q,W,U,z);J=J.replace(q,_)}return J}async function VZ($,Z,Y="",X={}){return await pq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!p7.isAbsolute(K))U=p7.resolve(p7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),M=V.substring(w+1).trim(),R=M.startsWith('"')&&M.endsWith('"'),N=M.startsWith("'")&&M.endsWith("'");if(R||N)M=M.substring(1,M.length-1);z[A]=M}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await mq(U,X),j={...Z,...B,...z},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return U0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function pq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var c7,n$=null;var wZ=k(()=>{c1();w0();c7=new Map});function N1($,Z){try{let Y=$.trim();if(K0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var AZ=k(()=>{O0()});function n7($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var s$=k(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function K$(){return!1}function q$(){return!K$()||process.env.STX_DEBUG==="true"}function r$(){return!1}import cq from"path";function o$(){return{...s7}}function a$($){if(!s7.showRelativePaths||!$)return $;let Z=s7.baseDir||process.cwd();try{let Y=cq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var iq,s7,t$,i1,e$;var $4=k(()=>{s$();iq={showRelativePaths:!1,enableAutoRecovery:q$(),logRecoveryWarnings:!0},s7={...iq};t$=class t$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=a$(this.filePath)}};i1=class i1 extends t${constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};e$=class e$ extends t${isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function MZ($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,_=J,B=G;if(!_&&K&&q!==void 0){let O=tq(K,q);_=O.line,B=O.column}let j=Q?a$(Q):void 0,H=X?n7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=sq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=rq(L,K,q);break;case"text":default:F=nq(L,K,q);break}return{formatted:F,data:L}}function nq($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
1666
+ ${$.message}`),Z&&$.line){let J=oq(Z,$.line,2);if(J)X.push(`
1662
1667
  ${J}`)}if($.snippet)X.push(`
1663
1668
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
1664
- Suggestion: ${$.suggestion}`);return X.join(" ")}function mq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${VZ($.message)}`;if($.suggestion)X+=` | Suggestion: ${VZ($.suggestion)}`;return X+=" -->",X}function lq($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.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`}W.push(`
1669
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function sq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${RZ($.message)}`;if($.suggestion)X+=` | Suggestion: ${RZ($.suggestion)}`;return X+=" -->",X}function rq($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.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`}W.push(`
1665
1670
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
1666
1671
 
1667
- ${$.message}`),Z&&$.line){let z=cq(Z,$.line,2);if(z)W.push(`
1672
+ ${$.message}`),Z&&$.line){let z=aq(Z,$.line,2);if(z)W.push(`
1668
1673
 
1669
1674
  \x1B[90mContext:\x1B[0m
1670
1675
  ${z}`)}if($.suggestion)W.push(`
1671
1676
 
1672
1677
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
1673
- ${"\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"}`),W.join("")}function pq($,Z,Y){let X=$.split(`
1678
+ ${"\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"}`),W.join("")}function oq($,Z,Y){let X=$.split(`
1674
1679
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
1675
- `)}function cq($,Z,Y){let X=$.split(`
1680
+ `)}function aq($,Z,Y){let X=$.split(`
1676
1681
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
1677
- `)}function VZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function iq($,Z){let X=$.substring(0,Z).split(`
1678
- `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return wZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function V5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var AZ=k(()=>{s$();$4()});class r7{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 X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}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(`
1682
+ `)}function RZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function tq($,Z){let X=$.substring(0,Z).split(`
1683
+ `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return MZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function V5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var NZ=k(()=>{s$();$4()});class o7{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 X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}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(`
1679
1684
  `).slice(1).join(`
1680
1685
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1681
1686
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
1682
1687
  `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let J=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(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
1683
1688
 
1684
- `),"utf-8")}}async flush(){await this.writeQueue}}var o7,Z1,a7;var RZ=k(()=>{$4();o7={isEnabled(){return r$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=r$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
1685
- @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(q$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new r7,a7={isDevelopment(){return q$()},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(`
1686
- `)}}});var MZ=()=>{};var NZ=k(()=>{s$();AZ();RZ();MZ();$4()});var B1=k(()=>{NZ()});function v0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}function T1($,Z){let Y=nq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function nq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=v0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function sq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function n1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function TZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=T1($,X);if(!Q)return null;let J=Q.endPos,G=n1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(sq(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(_,W),start:J+_,end:J+W});let F=W+L[0].length,O=T1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(_,W),start:J+_,end:J+W}),U="else",z=void 0,W+=5,_=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(_),start:J+_,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function W$($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=TZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function Z4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=v0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,_=n1($,Z,Y,z);if(_===-1){J=Q.exec($);continue}let B=$.slice(z,_),j=_+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:B,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function t7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=T1($,X);if(!Q)return null;let J=Q.endPos,G=n1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(z++,U)U.content+=B[0];W+=B[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=T1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var IZ=()=>{};var EZ=()=>{};var Y4=k(()=>{IZ();EZ()});function tq($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=t7(X,G);if(!K)break;try{let q;if(K0(K.expression))q=q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let _;if(z.value&&K0(z.value))_=q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)_=Y0(z.value,Z);if(q===_){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function s1($,Z,Y){let X=$;X=tq(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=T1(X,K+7);if(!q)break;let W=q.endPos,U=n1(X,"unless","endunless",W);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=X.slice(W,U),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.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=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((A,M)=>A.pos-M.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=z.slice(0,B),L=z.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=$3(X,Z,Y),X=Z3(X,Z,Y),X=e7(X,Z);let Q=()=>{let J=W$(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&K0(U.condition))z=q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=Y0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function DZ($){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 X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function e7($,Z){let Y=$;function X(K,q,W,U){let z=1,_=U,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&z>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,_=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;_=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,_=Y.slice(W+5),B=DZ(_);if(B)U=B.value,z=W+5+B.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?N1(`auth?.check && auth?.user?.[${U}]`,Z):N1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,_=Y.slice(W+6),B=DZ(_);if(B)U=B.value,z=W+6+B.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?N1(`!auth?.check || !auth?.user?.[${U}]`,Z):N1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){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(q)U.push(q);if(W){let z=N1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=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 _=z.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),M=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,N=[],T;while((T=w.exec(F))!==null)N.push({pos:T.index,type:"open"});while((T=A.exec(F))!==null)N.push({pos:T.index,type:"close"});while((T=M.exec(F))!==null)N.push({pos:T.index,type:"elseDirective"});while((T=R.exec(F))!==null)N.push({pos:T.index,type:"else"});N.sort((b,v)=>b.pos-v.pos);for(let b of N){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],D=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:F.slice(D,v.pos),ability:void 0}),v.type==="elseDirective"){let h=F.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:F.slice(D,v.pos)},D=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:F.length;I.push({content:F.slice(D,r),ability:f.ability,type:f.type,id:f.id}),D=r}}else D=v.pos+5}if(D<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),y=K==="can"?E:!E,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,_)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function $3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),_=J.match(z);if(!_||_.index===void 0)break;let B=_.index,j=T1(J,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=n1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let M=F.indexOf("@",A);if(M===-1)break;let R=F.substring(M);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=M+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=M+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=M;break}A=M+1}try{let M=q(O.trim()),R;if(V!==-1){let N=F.slice(0,V),T=F.slice(V+5);R=M?N:T}else R=M?F:"";J=J.substring(0,B)+R+J.substring(L+`@${K}`.length),U=!0}catch(M){let R=M instanceof Error?M.message:String(M),N=$0(W,`Error processing @${G} directive: ${R}`,o.EVALUATION_ERROR);J=J.substring(0,B)+N+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=N1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=N1(J,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"),X}function Z3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(j),y=z.exec(j),S=E?E.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+E[0].length;else if(b<1/0){if(V--,V===0){A=b;break}w=b+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let M=j.substring(O,A),R=-1,N=0,T=0;while(T<M.length){let E=M.indexOf("@",T);if(E===-1)break;let y=M.substring(E);if(_.test(y)){N++,T=E+1;continue}if(B.test(y)){N--,T=E+1;continue}if(N===0&&/^@else(?![a-z])/.test(y)){R=E;break}T=E+1}let I;if(R!==-1){let E=M.slice(0,R),y=M.slice(R+5);I=W?E:y}else I=W?M:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var X4=k(()=>{FZ();B1();Y4();O0()});function bZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function J4($,Z){if(!$)return Z?.nonceGenerator?.()??bZ();let Y=kZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??bZ(),kZ.set($,Y);return Y}function eq($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function SZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${eq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function yZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?J4(Y,Z):void 0,Q=SZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
1687
- ${Q}`)}function PZ($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function CZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?J4(Z,J):void 0;return SZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return J4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=J4(Z,J);return Q}var kZ;var vZ=k(()=>{kZ=new WeakMap});import $W from"crypto";function YW($=ZW){let Z=$W.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Y3=Z,Z}function XW(){if(!Y3)YW();return Y3}function JW($=xZ){let Z=XW();return`<input type="hidden" name="${$}" value="${Z}">`}function fZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return JW(X||xZ)})}var ZW=40,xZ="_token",Y3=null;var gZ=()=>{};async function hZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await QW(Q,J,Z,Y,X);else Q=await GW(Q,J,Z,Y,X)}return Q}async function QW($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=O5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],_=U.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?uZ(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:B,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}_=U.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:H}=z[B];W=W.replace(j,H)}return W}async function GW($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=O5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[B,j=""]=U,H=U.index||0;try{let L=uZ(j),F=await G("",L,Y,X);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:B,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=O5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),_=z.exec(K);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,X);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:B,processed:$0("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}_=z.exec(K)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];K=K.replace(j,H)}return K}function uZ($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var dZ=k(()=>{B1();L5()});function o1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function qW($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(o1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(o1(Y.key,"appearance.key"),o1(Y.attribute,"appearance.attribute"),o1(Y.default,"appearance.default"),o1(X.key,"colorMode.key"),o1(X.attribute,"colorMode.attribute"),o1(X.default,"colorMode.default"),!lZ.test(Y.key)||!lZ.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!mZ.test(Y.attribute)||!mZ.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.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(!KW.has(X.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:X.key,attribute:X.attribute,default:X.default}}}function WW($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function UW($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${WW($)};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 zW($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function pZ($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=zW(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=Y0(`(${K})`,Z),W=UW(qW(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var mZ,lZ,KW;var cZ=k(()=>{O0();mZ=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,lZ=/^[A-Za-z_$][\w$]*$/,KW=new Set(["light","dark","system"])});var Q3={};t(Q3,{useTitle:()=>OW,useSeoMeta:()=>iZ,usePageTitle:()=>OW,useHead:()=>J3,seoMetaToHeadConfig:()=>G4,resetHead:()=>jW,renderHtmlAttrs:()=>FW,renderHead:()=>LW,renderBodyAttrs:()=>VW,processTitleDirective:()=>RW,processMetaDirective:()=>MW,processHeadDirective:()=>AW,mergeHeadConfigs:()=>w5,getPageMeta:()=>BW,getHead:()=>X3,definePageMeta:()=>HW,applyHead:()=>wW});function X3(){return I1}function BW(){return Q4}function jW(){I1={},_W.length=0,Q4={}}function J3($){I1=w5(I1,$)}function w5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function iZ($){J3(G4($))}function G4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function HW($){if(Q4={...Q4,...$},$.title||$.description)iZ({title:$.title,description:$.description})}function OW($){let Z=typeof $==="function"?$():$;J3({title:Z})}function LW($=I1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${r1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${r1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${r1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${r1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${r1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1688
- `)}function FW($=I1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${r1(Y)}"`).join(" ")}function VW($=I1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${r1(Y)}"`).join(" ")}function r1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function wW($=I1){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 X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function AW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1689
- `,""}),headContent:Z.trim()}}function RW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(K,{title:G}),""})}function MW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},_=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(_,{meta:[z]}),""})}var I1,_W,Q4;var U$=k(()=>{I1={},_W=[],Q4={}});import NW from"crypto";function R0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function K4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function TW(){return NW.randomUUID()}function q4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=TW();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${R0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${R0(J)}">`;return X}),Y}function oZ($,Z,Y=sZ){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",_=E1(W),B=U.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${R0(j)}" action="${R0(z)}"${_?` ${_}`:""}>`;if(H+=`
1689
+ `),"utf-8")}}async flush(){await this.writeQueue}}var r7,Z1,a7;var TZ=k(()=>{$4();r7={isEnabled(){return o$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=o$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
1690
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(q$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new o7,a7={isDevelopment(){return q$()},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(`
1691
+ `)}}});var IZ=()=>{};var EZ=k(()=>{s$();NZ();TZ();IZ();$4()});var B1=k(()=>{EZ()});function v0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}function T1($,Z){let Y=eq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function eq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=v0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function $W($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function n1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function DZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=T1($,X);if(!Q)return null;let J=Q.endPos,G=n1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if($W(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(_,W),start:J+_,end:J+W});let F=W+L[0].length,O=T1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(_,W),start:J+_,end:J+W}),U="else",z=void 0,W+=5,_=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(_),start:J+_,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function W$($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=DZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function Z4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=v0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,_=n1($,Z,Y,z);if(_===-1){J=Q.exec($);continue}let B=$.slice(z,_),j=_+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:B,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function t7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=T1($,X);if(!Q)return null;let J=Q.endPos,G=n1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(z++,U)U.content+=B[0];W+=B[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=T1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var kZ=()=>{};var bZ=()=>{};var Y4=k(()=>{kZ();bZ()});function JW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=t7(X,G);if(!K)break;try{let q;if(K0(K.expression))q=q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let _;if(z.value&&K0(z.value))_=q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)_=Y0(z.value,Z);if(q===_){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function s1($,Z,Y){let X=$;X=JW(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=T1(X,K+7);if(!q)break;let W=q.endPos,U=n1(X,"unless","endunless",W);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=X.slice(W,U),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.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=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((A,M)=>A.pos-M.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=z.slice(0,B),L=z.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=$3(X,Z,Y),X=Z3(X,Z,Y),X=e7(X,Z);let Q=()=>{let J=W$(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&K0(U.condition))z=q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=Y0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,s.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function SZ($){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 X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function e7($,Z){let Y=$;function X(K,q,W,U){let z=1,_=U,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&z>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,_=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;_=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,_=Y.slice(W+5),B=SZ(_);if(B)U=B.value,z=W+5+B.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?N1(`auth?.check && auth?.user?.[${U}]`,Z):N1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,_=Y.slice(W+6),B=SZ(_);if(B)U=B.value,z=W+6+B.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?N1(`!auth?.check || !auth?.user?.[${U}]`,Z):N1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){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(q)U.push(q);if(W){let z=N1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=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 _=z.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),M=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,N=[],T;while((T=w.exec(F))!==null)N.push({pos:T.index,type:"open"});while((T=A.exec(F))!==null)N.push({pos:T.index,type:"close"});while((T=M.exec(F))!==null)N.push({pos:T.index,type:"elseDirective"});while((T=R.exec(F))!==null)N.push({pos:T.index,type:"else"});N.sort((b,v)=>b.pos-v.pos);for(let b of N){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],D=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:F.slice(D,v.pos),ability:void 0}),v.type==="elseDirective"){let h=F.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:F.slice(D,v.pos)},D=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:F.length;I.push({content:F.slice(D,r),ability:f.ability,type:f.type,id:f.id}),D=r}}else D=v.pos+5}if(D<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),y=K==="can"?E:!E,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,_)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function $3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),_=J.match(z);if(!_||_.index===void 0)break;let B=_.index,j=T1(J,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=n1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let M=F.indexOf("@",A);if(M===-1)break;let R=F.substring(M);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=M+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=M+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=M;break}A=M+1}try{let M=q(O.trim()),R;if(V!==-1){let N=F.slice(0,V),T=F.slice(V+5);R=M?N:T}else R=M?F:"";J=J.substring(0,B)+R+J.substring(L+`@${K}`.length),U=!0}catch(M){let R=M instanceof Error?M.message:String(M),N=$0(W,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);J=J.substring(0,B)+N+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=N1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=N1(J,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"),X}function Z3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(j),y=z.exec(j),S=E?E.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+E[0].length;else if(b<1/0){if(V--,V===0){A=b;break}w=b+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let M=j.substring(O,A),R=-1,N=0,T=0;while(T<M.length){let E=M.indexOf("@",T);if(E===-1)break;let y=M.substring(E);if(_.test(y)){N++,T=E+1;continue}if(B.test(y)){N--,T=E+1;continue}if(N===0&&/^@else(?![a-z])/.test(y)){R=E;break}T=E+1}let I;if(R!==-1){let E=M.slice(0,R),y=M.slice(R+5);I=W?E:y}else I=W?M:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var X4=k(()=>{AZ();B1();Y4();O0()});function PZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function J4($,Z){if(!$)return Z?.nonceGenerator?.()??PZ();let Y=yZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??PZ(),yZ.set($,Y);return Y}function QW($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function CZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${QW($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function vZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?J4(Y,Z):void 0,Q=CZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
1692
+ ${Q}`)}function xZ($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function fZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?J4(Z,J):void 0;return CZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return J4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=J4(Z,J);return Q}var yZ;var gZ=k(()=>{yZ=new WeakMap});import GW from"crypto";function qW($=KW){let Z=GW.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Y3=Z,Z}function WW(){if(!Y3)qW();return Y3}function UW($=hZ){let Z=WW();return`<input type="hidden" name="${$}" value="${Z}">`}function uZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return UW(X||hZ)})}var KW=40,hZ="_token",Y3=null;var dZ=()=>{};async function mZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await zW(Q,J,Z,Y,X);else Q=await _W(Q,J,Z,Y,X)}return Q}async function zW($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=O5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],_=U.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?lZ(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:B,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}_=U.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:H}=z[B];W=W.replace(j,H)}return W}async function _W($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=O5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[B,j=""]=U,H=U.index||0;try{let L=lZ(j),F=await G("",L,Y,X);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:B,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=O5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),_=z.exec(K);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,X);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:B,processed:$0("CustomDirective",`Error in @${J}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}_=z.exec(K)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];K=K.replace(j,H)}return K}function lZ($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var pZ=k(()=>{B1();L5()});function r1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function jW($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(r1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(r1(Y.key,"appearance.key"),r1(Y.attribute,"appearance.attribute"),r1(Y.default,"appearance.default"),r1(X.key,"colorMode.key"),r1(X.attribute,"colorMode.attribute"),r1(X.default,"colorMode.default"),!iZ.test(Y.key)||!iZ.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!cZ.test(Y.attribute)||!cZ.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.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(!BW.has(X.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:X.key,attribute:X.attribute,default:X.default}}}function HW($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function OW($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HW($)};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 LW($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function nZ($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=LW(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=Y0(`(${K})`,Z),W=OW(jW(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var cZ,iZ,BW;var sZ=k(()=>{O0();cZ=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,iZ=/^[A-Za-z_$][\w$]*$/,BW=new Set(["light","dark","system"])});var Q3={};t(Q3,{useTitle:()=>RW,useSeoMeta:()=>rZ,usePageTitle:()=>RW,useHead:()=>J3,seoMetaToHeadConfig:()=>G4,resetHead:()=>wW,renderHtmlAttrs:()=>NW,renderHead:()=>MW,renderBodyAttrs:()=>TW,processTitleDirective:()=>DW,processMetaDirective:()=>kW,processHeadDirective:()=>EW,mergeHeadConfigs:()=>w5,getPageMeta:()=>VW,getHead:()=>X3,definePageMeta:()=>AW,applyHead:()=>IW});function X3(){return I1}function VW(){return Q4}function wW(){I1={},FW.length=0,Q4={}}function J3($){I1=w5(I1,$)}function w5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function rZ($){J3(G4($))}function G4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function AW($){if(Q4={...Q4,...$},$.title||$.description)rZ({title:$.title,description:$.description})}function RW($){let Z=typeof $==="function"?$():$;J3({title:Z})}function MW($=I1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${o1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${o1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${o1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${o1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${o1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1693
+ `)}function NW($=I1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${o1(Y)}"`).join(" ")}function TW($=I1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${o1(Y)}"`).join(" ")}function o1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function IW($=I1){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 X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function EW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1694
+ `,""}),headContent:Z.trim()}}function DW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(K,{title:G}),""})}function kW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},_=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(_,{meta:[z]}),""})}var I1,FW,Q4;var U$=k(()=>{I1={},FW=[],Q4={}});import bW from"crypto";function R0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function K4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function SW(){return bW.randomUUID()}function q4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=SW();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${R0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${R0(J)}">`;return X}),Y}function tZ($,Z,Y=aZ){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",_=E1(W),B=U.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${R0(j)}" action="${R0(z)}"${_?` ${_}`:""}>`;if(H+=`
1690
1695
  ${q4("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
1691
- ${q4(`@method('${B}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",_=E1(W),B=z$(U,Z),j=B!==void 0&&B!==null?B:z||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=_$(U,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=K4(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${R0(L)}" name="${R0(U)}" value="${R0(j)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=E1(G),W=z$(J,Z)||K.trim(),U=_$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),_=K4(z?z[1]:"",Y.input,U,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${R0(J)}" class="${_}"${B?` ${B}`:""}>${R0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=E1(G),W=z$(J,Z),U=_$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),_=K4(z?z[1]:"",Y.input,U,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${R0(J)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=E1(K),W=z$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),_=z?z[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${R0(J)}" value="${R0(G)}" class="${_}"${U?" checked":""}${B?` ${B}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=E1(K),W=z$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),_=z?z[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${R0(J)}" value="${R0(G)}" class="${_}"${U?" checked":""}${B?` ${B}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=E1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=_$(J,Z),_=K.match(/class=['"]([^'"]+)['"]/i),B=K4(_?_[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${R0(J)}"`,`class="${B}"`];if(W)H.push(`accept="${R0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=E1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${R0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function rZ($,Z,Y=sZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(_$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return nZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return nZ(Q,Z)}let q=K.trim();if(K0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function _$($,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 nZ($,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 z$($,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 X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function E1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var sZ;var aZ=k(()=>{O0();sZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import q3 from"path";async function IW(){if(B$!==void 0)return B$;try{B$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{B$=null}return B$}function EW($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function DW($,Z){if({...z3,...Z.i18n}.cache&&W3[$]){let Q=W3[$],J=Z.i18n?.cacheMaxAge??0;if(!EW(Q,J))return Q.translations}if(j$[$]?.state==="loading")return j$[$].promise;G3[$]="loading";let X=U3($,Z).then((Q)=>{return G3[$]="loaded",delete j$[$],Q}).catch((Q)=>{throw G3[$]="error",j$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return j$[$]={promise:X,state:"loading"},X}async function U3($,Z){let Y={...z3,...Z.i18n},X=q3.isAbsolute(Y.translationsDir)?Y.translationsDir:q3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await IW(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:PW(Y.format)}):await kW($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)W3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}}async function kW($,Z,Y){let X=q3.join(Y,`${$}${bW(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return SW(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function bW($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function SW($){let Z={},Y=$.split(`
1692
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),_=U.trim();if(_==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=yW(_)}}return Z}function yW($){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 PW($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function CW($,Z){return DW($,Z)}function vW($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function xW($,Z={}){return $2($,Z)}function $2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=fW($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=gW(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function fW($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function gW($,Z){let Y=hW($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return uW(Q,Y.slice(2).join(","),Z);case"select":return mW(Q,Y.slice(2).join(","));case"selectordinal":return lW(Q,Y.slice(2).join(","));case"number":return cW(Q,Y[2]?.trim());case"date":return iW(Q,Y[2]?.trim());case"time":return nW(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function hW($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function uW($,Z,Y){let X=Number($)||0,Q=_3(Z),J=`=${X}`;if(Q[J])return K3(Q[J],X,Y);let G=dW(X);if(Q[G])return K3(Q[G],X,Y);if(Q.other)return K3(Q.other,X,Y);return String(X)}function K3($,Z,Y){let X=$.replace(/#/g,String(Z));return $2(X,Y)}function dW($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function mW($,Z){let Y=String($||""),X=_3(Z);if(X[Y])return X[Y];return X.other||String($)}function lW($,Z){let Y=Number($)||0,X=_3(Z),Q=pW(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function pW($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function _3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function cW($,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 iW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function nW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function sW($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function tZ($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(sW(G))return xW(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=vW(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function Z2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...z3,...X.i18n},K=await CW(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await eZ(Q,J,async(U,z,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return A0(_,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return tZ(z,K,G.fallbackToKey,H)||B.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,_)=>console.warn(`Match ${_}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await eZ(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return A0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return tZ(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function eZ($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var B$,z3,W3,j$,G3;var Y2=k(()=>{B1();O0();z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},W3={},j$={},G3={}});function rW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return oW.test(Z)}function A5($){H$.lastIndex=0;let Z;while((Z=H$.exec($))!==null){if(Z[0].startsWith("</")||rW(Z[0]))continue;let Y=Z.index,X=H$.lastIndex,Q=1,J;while((J=H$.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:H$.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var H$,oW;var W4=k(()=>{H$=/<\/?template\b[^>]*>/gi,oW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var H3={};t(H3,{streamingSuspenseDirective:()=>Q2,streamToResponse:()=>qU,streamTemplateSimple:()=>JU,streamTemplate:()=>tW,renderStreamingPage:()=>$U,registerStreamingDirectives:()=>GU,processStreamDirectives:()=>YU,processSectionDirectives:()=>KU,islandDirective:()=>G2,generateHydrationRuntime:()=>WU,extractStreamBoundaries:()=>XU,createStreamRenderer:()=>QU,buildSuspenseResolveScript:()=>j3,SUSPENSE_RESOLVER_RUNTIME:()=>J2});import U4 from"path";function aW($){let Z=[],Y=0,X;X2.lastIndex=0;while((X=X2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function tW($,Z={},Y={}){let X={...H1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:U4.dirname($)};if(q.trim())await j1(q,U,$);let z=aW(W),_=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(a1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await L0(W,U,$,X,_);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(a1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let N=await L0(R,U,$,X,_);J.enqueue(N),await new Promise((T)=>setTimeout(T,0))}}let M=await L0(A.content,U,$,X,_);J.enqueue(M),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let M=await L0(A,U,$,X,_);J.enqueue(M)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await L0(L.content,U,$,X,_);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
1696
+ ${q4(`@method('${B}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",_=E1(W),B=z$(U,Z),j=B!==void 0&&B!==null?B:z||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=_$(U,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=K4(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${R0(L)}" name="${R0(U)}" value="${R0(j)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=E1(G),W=z$(J,Z)||K.trim(),U=_$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),_=K4(z?z[1]:"",Y.input,U,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${R0(J)}" class="${_}"${B?` ${B}`:""}>${R0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=E1(G),W=z$(J,Z),U=_$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),_=K4(z?z[1]:"",Y.input,U,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${R0(J)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=E1(K),W=z$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),_=z?z[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${R0(J)}" value="${R0(G)}" class="${_}"${U?" checked":""}${B?` ${B}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=E1(K),W=z$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),_=z?z[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${R0(J)}" value="${R0(G)}" class="${_}"${U?" checked":""}${B?` ${B}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=E1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=_$(J,Z),_=K.match(/class=['"]([^'"]+)['"]/i),B=K4(_?_[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${R0(J)}"`,`class="${B}"`];if(W)H.push(`accept="${R0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=E1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${R0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function eZ($,Z,Y=aZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(_$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return oZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return oZ(Q,Z)}let q=K.trim();if(K0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function _$($,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 oZ($,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 z$($,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 X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function E1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var aZ;var $2=k(()=>{O0();aZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import q3 from"path";async function yW(){if(B$!==void 0)return B$;try{B$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{B$=null}return B$}function PW($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function CW($,Z){if({...z3,...Z.i18n}.cache&&W3[$]){let Q=W3[$],J=Z.i18n?.cacheMaxAge??0;if(!PW(Q,J))return Q.translations}if(j$[$]?.state==="loading")return j$[$].promise;G3[$]="loading";let X=U3($,Z).then((Q)=>{return G3[$]="loaded",delete j$[$],Q}).catch((Q)=>{throw G3[$]="error",j$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return j$[$]={promise:X,state:"loading"},X}async function U3($,Z){let Y={...z3,...Z.i18n},X=q3.isAbsolute(Y.translationsDir)?Y.translationsDir:q3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await yW(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:hW(Y.format)}):await vW($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)W3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}}async function vW($,Z,Y){let X=q3.join(Y,`${$}${xW(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return fW(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function xW($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function fW($){let Z={},Y=$.split(`
1697
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),_=U.trim();if(_==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=gW(_)}}return Z}function gW($){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 hW($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function uW($,Z){return CW($,Z)}function dW($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function mW($,Z={}){return X2($,Z)}function X2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=lW($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=pW(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function lW($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function pW($,Z){let Y=cW($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return iW(Q,Y.slice(2).join(","),Z);case"select":return sW(Q,Y.slice(2).join(","));case"selectordinal":return rW(Q,Y.slice(2).join(","));case"number":return aW(Q,Y[2]?.trim());case"date":return tW(Q,Y[2]?.trim());case"time":return eW(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function cW($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function iW($,Z,Y){let X=Number($)||0,Q=_3(Z),J=`=${X}`;if(Q[J])return K3(Q[J],X,Y);let G=nW(X);if(Q[G])return K3(Q[G],X,Y);if(Q.other)return K3(Q.other,X,Y);return String(X)}function K3($,Z,Y){let X=$.replace(/#/g,String(Z));return X2(X,Y)}function nW($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function sW($,Z){let Y=String($||""),X=_3(Z);if(X[Y])return X[Y];return X.other||String($)}function rW($,Z){let Y=Number($)||0,X=_3(Z),Q=oW(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function oW($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function _3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function aW($,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 tW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function eW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function $U($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function Z2($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if($U(G))return mW(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=dW(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function J2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...z3,...X.i18n},K=await uW(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await Y2(Q,J,async(U,z,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return A0(_,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return Z2(z,K,G.fallbackToKey,H)||B.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,_)=>console.warn(`Match ${_}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await Y2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return A0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return Z2(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),Q}async function Y2($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var B$,z3,W3,j$,G3;var Q2=k(()=>{B1();O0();z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},W3={},j$={},G3={}});function YU($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return ZU.test(Z)}function A5($){H$.lastIndex=0;let Z;while((Z=H$.exec($))!==null){if(Z[0].startsWith("</")||YU(Z[0]))continue;let Y=Z.index,X=H$.lastIndex,Q=1,J;while((J=H$.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:H$.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var H$,ZU;var W4=k(()=>{H$=/<\/?template\b[^>]*>/gi,ZU=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var H3={};t(H3,{streamingSuspenseDirective:()=>q2,streamToResponse:()=>jU,streamTemplateSimple:()=>UU,streamTemplate:()=>JU,renderStreamingPage:()=>GU,registerStreamingDirectives:()=>_U,processStreamDirectives:()=>qU,processSectionDirectives:()=>BU,islandDirective:()=>W2,generateHydrationRuntime:()=>HU,extractStreamBoundaries:()=>WU,createStreamRenderer:()=>zU,buildSuspenseResolveScript:()=>j3,SUSPENSE_RESOLVER_RUNTIME:()=>K2});import U4 from"path";function XU($){let Z=[],Y=0,X;G2.lastIndex=0;while((X=G2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function JU($,Z={},Y={}){let X={...H1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:U4.dirname($)};if(q.trim())await j1(q,U,$);let z=XU(W),_=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(a1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await L0(W,U,$,X,_);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(a1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let N=await L0(R,U,$,X,_);J.enqueue(N),await new Promise((T)=>setTimeout(T,0))}}let M=await L0(A.content,U,$,X,_);J.enqueue(M),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let M=await L0(A,U,$,X,_);J.enqueue(M)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await L0(L.content,U,$,X,_);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
1693
1698
  <template data-suspense-fallback>Loading...</template>
1694
1699
  </div>`),j.set(L.name,L0(L.content,U,$,X,_))}J.enqueue(`
1695
1700
  <script>
@@ -1713,7 +1718,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
1713
1718
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
1714
1719
  <script>
1715
1720
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(X)}</div>');
1716
- </script>`}}function eW($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function $U($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(J2),await Promise.all(Z.map(async(J)=>{let G=eW(J.render(),X,J.id);Q.enqueue(await j3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function YU($,Z){return $.replace(ZU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function XU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function JU($,Z={},Y={}){let X={...H1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:U4.dirname($)};if(q.trim())await j1(q,U,$);let z=new Set,_=X.streaming?.strategy||"auto",B=new RegExp(a1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await L0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(a1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let M=await L0(A,U,$,X,z);J.enqueue(M)}}let w=await L0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await L0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function QU($,Z={}){let Y={...H1,...Z,streaming:{...B3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;a1.lastIndex=0;while((W=a1.exec(G))!==null){let _=W[1],B=W[2];q[_]=B}let U=G.replace(a1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:U4.dirname($)};return await j1(J,B,$),L0(U,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!q[_])return`<div class="error-message">Section "${t0(_)}" not found in template "${t0($)}"</div>`;let j={...B,__filename:$,__dirname:U4.dirname($)};await j1(J,j,$);let H=new Set;return await L0(q[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return U0("Expression",H,$,q[_]||"",0,q[_]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function GU($={}){let Z=[];if($.streaming?.enabled)Z.push(Q2);if($.hydration?.enabled)Z.push(G2);return Z}async function KU($,Z,Y,X={}){return $}function qU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function WU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
1721
+ </script>`}}function QU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function GU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(K2),await Promise.all(Z.map(async(J)=>{let G=QU(J.render(),X,J.id);Q.enqueue(await j3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function qU($,Z){return $.replace(KU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function WU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function UU($,Z={},Y={}){let X={...H1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:U4.dirname($)};if(q.trim())await j1(q,U,$);let z=new Set,_=X.streaming?.strategy||"auto",B=new RegExp(a1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await L0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(a1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let M=await L0(A,U,$,X,z);J.enqueue(M)}}let w=await L0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await L0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function zU($,Z={}){let Y={...H1,...Z,streaming:{...B3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;a1.lastIndex=0;while((W=a1.exec(G))!==null){let _=W[1],B=W[2];q[_]=B}let U=G.replace(a1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:U4.dirname($)};return await j1(J,B,$),L0(U,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!q[_])return`<div class="error-message">Section "${t0(_)}" not found in template "${t0($)}"</div>`;let j={...B,__filename:$,__dirname:U4.dirname($)};await j1(J,j,$);let H=new Set;return await L0(q[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return U0("Expression",H,$,q[_]||"",0,q[_]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function _U($={}){let Z=[];if($.streaming?.enabled)Z.push(q2);if($.hydration?.enabled)Z.push(W2);return Z}async function BU($,Z,Y,X={}){return $}function jU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function HU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
1717
1722
  `);if(Z==="loader")return`
1718
1723
  (function() {
1719
1724
  window.__stx = window.__stx || {};
@@ -1855,7 +1860,7 @@ else {
1855
1860
  else {
1856
1861
  stx.hydrate();
1857
1862
  }
1858
- })();`}var B3,a1,X2,J2=`
1863
+ })();`}var B3,a1,G2,K2=`
1859
1864
  <script>
1860
1865
  (function(){
1861
1866
  window.__stxSuspense = window.__stxSuspense || {
@@ -1875,25 +1880,25 @@ else {
1875
1880
  }
1876
1881
  };
1877
1882
  })();
1878
- </script>`,ZU,Q2,G2;var O3=k(()=>{c1();J1();z4();w0();B3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},a1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,X2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;ZU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;Q2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},G2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
1883
+ </script>`,KU,q2,W2;var O3=k(()=>{c1();J1();z4();w0();B3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},a1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,G2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;KU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;q2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},W2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
1879
1884
  ${W}
1880
1885
  <script type="application/json" data-island-props="${G}">
1881
1886
  ${q?`{${q}}`:"{}"}
1882
1887
  </script>
1883
- </div>`}}});var W2={};t(W2,{warnUnbalancedTags:()=>L3,findUnbalancedTags:()=>q2});function R5($){return $.replace(/[^\n]/g," ")}function q2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,R5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,R5).replace(/<!--[\s\S]*?-->/g,R5).replace(/\{\{\{[\s\S]*?\}\}\}/g,R5).replace(/\{\{[\s\S]*?\}\}/g,R5).replace(/\{!![\s\S]*?!!\}/g,R5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(UU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
1884
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(zU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function L3($,Z){let Y;try{Y=q2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(K2.has(X))return;K2.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var UU,zU,K2;var F3=k(()=>{UU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);K2=new Set});import n0 from"path";import V3 from"fs";function U2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function z2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class _2{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,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let B=[Q,Q.toLowerCase(),U2(Q),z2(Q)];for(let j of B)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${U2(Q)}.stx`,`${z2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let B=n0.resolve(n0.dirname(Z),`${Q}.stx`);if(await c(B))return B;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(n0.join(n0.dirname(W),"components"));if(q)K.push(q);let U=n0.join(n0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),_=[n0.resolve(z,"src/components"),n0.resolve(z,"components"),n0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=n0.join(B,j);if(await c(H))return H}try{if(!V3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=V3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=n0.join(B,L.name);for(let O of G){let V=n0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var x0;var w3=k(()=>{w0();x0=new _2});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(k0(J));continue}Y.push(`${k0(J)}="${k0(Q)}"`)}return Y}var _4=()=>{};function O$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _U($){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 A3;var R3=k(()=>{_4();A3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=_U($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${O$(X.value)}"`);else q.push(`href="${O$(X.value)}"`);if(Q)q.push(`class="${O$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${O$(J)}"`),q.push(`data-stx-exact-active-class="${O$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...M5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){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 N3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function B2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=BU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function T3($,Z,Y,X){return Z.map((Q)=>`${L$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function jU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${L$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function L$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function HU($,Z,Y="#e5e7eb"){let X=`<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(X)}`}var BU,M3,I3;var E3=k(()=>{_4();BU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M3=[320,640,768,1024,1280,1536,1920];I3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",Q=b0($,"alt")||"",J=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),_=b0($,"placeholderColor")||"#e5e7eb",B=b0($,"provider"),j=b0($,"class")||b0($,"className")||"",H=b0($,"style")||"",L=b0($,"quality"),F=N3($,"lazy",!0),O=N3($,"preload",!1),V=N3($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,M=q||"",R="";if(!M&&K)M=T3(X,M3,B,U),R=B2(K);else if(!M&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));M=jU(X,S,w,B,U)}else if(K)R=B2(K);let N=[];if(H)N.push(H);if(w&&A)N.push(`aspect-ratio:${w}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=HU(w||16,A||9,_);N.push(`background-image:url(${S})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")N.push(`background-image:url(${N0(z)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let T=L$(X,w,A,B,U),I=[];if(I.push(`src="${N0(T)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${N0(j)}"`);if(N.length>0)I.push(`style="${N0(N.join(";"))}"`);if(M)I.push(`srcset="${N0(M)}"`);if(R)I.push(`sizes="${N0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...M5($,D));let E=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${N0(T)}"${b?` type="${b}"`:""}${M?` imagesrcset="${N0(M)}"`:""}${R?` imagesizes="${N0(R)}"`:""} />
1888
+ </div>`}}});var _2={};t(_2,{warnUnbalancedTags:()=>L3,findUnbalancedTags:()=>z2});function R5($){return $.replace(/[^\n]/g," ")}function z2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,R5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,R5).replace(/<!--[\s\S]*?-->/g,R5).replace(/\{\{\{[\s\S]*?\}\}\}/g,R5).replace(/\{\{[\s\S]*?\}\}/g,R5).replace(/\{!![\s\S]*?!!\}/g,R5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(OU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
1889
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(LU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function L3($,Z){let Y;try{Y=z2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(U2.has(X))return;U2.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var OU,LU,U2;var F3=k(()=>{OU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),LU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);U2=new Set});import n0 from"path";import V3 from"fs";function B2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function j2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class H2{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,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let B=[Q,Q.toLowerCase(),B2(Q),j2(Q)];for(let j of B)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${B2(Q)}.stx`,`${j2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let B=n0.resolve(n0.dirname(Z),`${Q}.stx`);if(await c(B))return B;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(n0.join(n0.dirname(W),"components"));if(q)K.push(q);let U=n0.join(n0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),_=[n0.resolve(z,"src/components"),n0.resolve(z,"components"),n0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=n0.join(B,j);if(await c(H))return H}try{if(!V3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=V3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=n0.join(B,L.name);for(let O of G){let V=n0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var x0;var w3=k(()=>{w0();x0=new H2});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(k0(J));continue}Y.push(`${k0(J)}="${k0(Q)}"`)}return Y}var _4=()=>{};function O$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FU($){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 A3;var R3=k(()=>{_4();A3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=FU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${O$(X.value)}"`);else q.push(`href="${O$(X.value)}"`);if(Q)q.push(`class="${O$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${O$(J)}"`),q.push(`data-stx-exact-active-class="${O$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...M5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){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 N3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function O2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=VU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function T3($,Z,Y,X){return Z.map((Q)=>`${L$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function wU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${L$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function L$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function AU($,Z,Y="#e5e7eb"){let X=`<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(X)}`}var VU,M3,I3;var E3=k(()=>{_4();VU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M3=[320,640,768,1024,1280,1536,1920];I3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",Q=b0($,"alt")||"",J=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),_=b0($,"placeholderColor")||"#e5e7eb",B=b0($,"provider"),j=b0($,"class")||b0($,"className")||"",H=b0($,"style")||"",L=b0($,"quality"),F=N3($,"lazy",!0),O=N3($,"preload",!1),V=N3($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,M=q||"",R="";if(!M&&K)M=T3(X,M3,B,U),R=O2(K);else if(!M&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));M=wU(X,S,w,B,U)}else if(K)R=O2(K);let N=[];if(H)N.push(H);if(w&&A)N.push(`aspect-ratio:${w}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=AU(w||16,A||9,_);N.push(`background-image:url(${S})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")N.push(`background-image:url(${N0(z)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let T=L$(X,w,A,B,U),I=[];if(I.push(`src="${N0(T)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${N0(j)}"`);if(N.length>0)I.push(`style="${N0(N.join(";"))}"`);if(M)I.push(`srcset="${N0(M)}"`);if(R)I.push(`sizes="${N0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...M5($,D));let E=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${N0(T)}"${b?` type="${b}"`:""}${M?` imagesrcset="${N0(M)}"`:""}${R?` imagesizes="${N0(R)}"`:""} />
1885
1890
  `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=L$(X,w,A,B,"avif"),v=M?T3(X,M3,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=L$(X,w,A,B,"webp"),v=M?T3(X,M3,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(v)}"${R?` sizes="${N0(R)}"`:""} />`)}return`${y}<picture>
1886
1891
  ${S.join(`
1887
1892
  `)}
1888
1893
  ${E}
1889
- </picture>`}return`${y}${E}`}}});function F$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var j2="/images/safe-image-default.svg",OU,D3;var k3=k(()=>{_4();OU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${j2}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=N5($,"src")||"",Q=N5($,"alt")||"",J=N5($,"fallback")||j2,G=N5($,"class")||N5($,"className")||"",K=N5($,"fallbackClassName")||"",q=[];if(q.push(`src="${F$(X)}"`),q.push(`alt="${F$(Q)}"`),G)q.push(`class="${F$(G)}"`);if(q.push(`data-fallback="${F$(J)}"`),K)q.push(`data-fallback-class="${F$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...M5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${OU}${U}`;return U}}});function b3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function V$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function B4($,Z,Y){let X=V$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var S3;var y3=k(()=>{S3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=b3(V$($,"color")||"#6366f1"),Q=b3(V$($,"initialColor")||V$($,"initial-color")||""),J=b3(V$($,"height")||"3px"),G=B4($,"duration",2000),K=B4($,"throttle",200),q=B4($,"zIndex",999999)||B4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
1894
+ </picture>`}return`${y}${E}`}}});function F$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var L2="/images/safe-image-default.svg",RU,D3;var k3=k(()=>{_4();RU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${L2}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=N5($,"src")||"",Q=N5($,"alt")||"",J=N5($,"fallback")||L2,G=N5($,"class")||N5($,"className")||"",K=N5($,"fallbackClassName")||"",q=[];if(q.push(`src="${F$(X)}"`),q.push(`alt="${F$(Q)}"`),G)q.push(`class="${F$(G)}"`);if(q.push(`data-fallback="${F$(J)}"`),K)q.push(`data-fallback-class="${F$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...M5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${RU}${U}`;return U}}});function b3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function V$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function B4($,Z,Y){let X=V$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var S3;var y3=k(()=>{S3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=b3(V$($,"color")||"#6366f1"),Q=b3(V$($,"initialColor")||V$($,"initial-color")||""),J=b3(V$($,"height")||"3px"),G=B4($,"duration",2000),K=B4($,"throttle",200),q=B4($,"zIndex",999999)||B4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
1890
1895
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
1891
1896
  <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>
1892
1897
  </div>
1893
1898
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
1894
1899
  <script>
1895
1900
  (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()})})();
1896
- </script>`}}});function O2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function LU($,Z,Y){let X=O2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var H2,P3;var C3=k(()=>{H2={"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%)"},P3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=k0(O2($,"position")||"top-right"),Q=LU($,"max",5),J=H2[X]||H2["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1901
+ </script>`}}});function V2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function MU($,Z,Y){let X=V2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var F2,P3;var C3=k(()=>{F2={"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%)"},P3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=k0(V2($,"position")||"top-right"),Q=MU($,"max",5),J=F2[X]||F2["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1897
1902
  <style>
1898
1903
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
1899
1904
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -1901,7 +1906,7 @@ ${E}
1901
1906
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
1902
1907
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
1903
1908
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
1904
- </style>`}}});function j4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var L2,v3;var x3=k(()=>{L2={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)"},v3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=j4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=k0(X),J=j4($,"size")||"md",G=j4($,"closeOnBackdrop")!=="false",K=j4($,"closeOnEscape")!=="false",q=L2[J]||L2.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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">
1909
+ </style>`}}});function j4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var w2,v3;var x3=k(()=>{w2={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)"},v3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=j4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=k0(X),J=j4($,"size")||"md",G=j4($,"closeOnBackdrop")!=="false",K=j4($,"closeOnEscape")!=="false",q=w2[J]||w2.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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">
1905
1910
  <div class="stx-modal-panel" style="${q};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)">
1906
1911
  <div style="padding:1.5rem">${Z}</div>
1907
1912
  </div>
@@ -1910,7 +1915,7 @@ ${E}
1910
1915
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
1911
1916
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
1912
1917
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
1913
- </style>`}}});function T5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var F2,f3;var g3=k(()=>{F2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},f3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=T5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=k0(X),J=T5($,"side")||"right",G=T5($,"size")||"md",K=T5($,"closeOnBackdrop")!=="false",q=T5($,"closeOnEscape")!=="false",W=T5($,"overlay")!=="false",U=F2[G]||F2.md,z=J==="left",_=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
1918
+ </style>`}}});function T5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var A2,f3;var g3=k(()=>{A2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},f3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=T5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=k0(X),J=T5($,"side")||"right",G=T5($,"size")||"md",K=T5($,"closeOnBackdrop")!=="false",q=T5($,"closeOnEscape")!=="false",W=T5($,"overlay")!=="false",U=A2[G]||A2.md,z=J==="left",_=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
1914
1919
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${_};width:${U};max-width:100vw;transform:${B};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">
1915
1920
  <div style="padding:1.5rem">${Z}</div>
1916
1921
  </div>
@@ -1919,36 +1924,36 @@ ${E}
1919
1924
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
1920
1925
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
1921
1926
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
1922
- </style>`}}});import{existsSync as FU,readFileSync as VU}from"fs";function wU($){if(V2.has($))return;V2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function AU($){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(FU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return a.resolve(Y)}catch{}return null}function RU($){if(H4.has($))return H4.get($);let Z=AU($);if(!Z)return wU($),null;try{let Y=JSON.parse(VU(Z,"utf8"));return H4.set($,Y.icons),Y.icons}catch{return null}}function I5($,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 H4,V2,h3;var u3=k(()=>{H4=new Map,V2=new Set;h3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=I5($,"name")??I5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=k0(I5($,"size")||"24"),K=k0(I5($,"color")||"currentColor"),q=k0(I5($,"class")||""),W=k0(I5($,"style")||""),U=H4.get(Q)??RU(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let _=z.width||24,B=z.height||24,j=`0 0 ${_} ${B}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function w2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function A2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var d3;var m3=k(()=>{d3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=A2(Z,"fallback"),Q=X.rest,J=A2(Q,"error"),G=J.rest,K=X.region??w2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??w2($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function O4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var l3;var p3=k(()=>{l3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(O4($,"name")||"v").replace(/["'<>]/g,""),Q=(O4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=O4($,"class"),G=O4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function R2(){x0.registerBuiltin(A3),x0.registerBuiltin(I3),x0.registerBuiltin(D3),x0.registerBuiltin(S3),x0.registerBuiltin(P3),x0.registerBuiltin(v3),x0.registerBuiltin(f3),x0.registerBuiltin(h3),x0.registerBuiltin(d3),x0.registerBuiltin(l3)}var M2=k(()=>{R3();E3();k3();y3();C3();x3();g3();u3();m3();p3();w3();R3();E3();k3();y3();C3();x3();g3();u3();m3();p3()});function L4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function N2($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){Q=J+1;continue}let j=$.slice(z,B?_-2:_-1).trim();if(B)X.push({fullMatch:$.slice(J,_),tagName:q,attributes:j,content:"",startIndex:J,endIndex:_,isSelfClosing:!0}),Q=_;else{let H=`<${q}`,L=`</${q}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let M=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(M!==-1&&M<R){let N=$[M+H.length];if(N===" "||N===">"||N==="/"||N===`
1923
- `||N==="\t")F++;O=M+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=_;continue}let w=$.slice(_,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:w,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function T2($,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 I2=k(()=>{O0();w0();l1()});var P2={};t(P2,{processESImports:()=>S2,processComponents:()=>w4});import V4 from"fs";import d0 from"path";function NU($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(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,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=T2(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===c3?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!K0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let _=Object.keys(Z),j=q0(z,_)(...Object.values(Z));if(j===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!_.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=j}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(K0(z)){let B=q0(z,Object.keys(Z))(...Object.values(Z));G(W,B!=null?String(B):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=_.exec(q))!==null)try{let j=B[1];if(!K0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=q0(j,Object.keys(Z))(...Object.values(Z));z=z.replace(B[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,z)}continue}G(W,q===c3?"true":q)}return X}function TU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=c3}return Z}function D2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function IU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(x0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function EU($){let Z=k2.get($);if(Z)return Z;let Y=new Map,X=[d0.join($,"src"),d0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=V4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=d0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let _=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return k2.set($,Y),Y}function DU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=d0.join(Y,"node_modules",$);try{if(V4.statSync(X).isDirectory())return X}catch{}let Q=d0.dirname(Y);if(Q===Y)return null;Y=Q}}async function S2($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,H=[];while((j=_.exec(z))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let N=d0.resolve(G,V);if(N.endsWith(".stx"))A=N;else{let T=`${N}.stx`;try{if(V4.statSync(T).isFile())A=T}catch{try{if(V4.statSync(N).isDirectory())w=N}catch{}}}}else w=DU(V,G);if(!w&&!A)continue;let M=!1,R=(N,T)=>{J.set(N,T),J.set(N.toLowerCase(),T);let I=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,T),Q.add(T)};if(O&&A)R(O,A),M=!0;else if(F){let N=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),T=w?EU(w):null;for(let{source:I,local:D}of N){let E=null;if(A)E=A;else if(T)E=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),M=!0}}if(M)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${U}>${B}</script>`}),K}async function kU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of z){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[d0.resolve(d0.dirname(Y),`${_}.stx`),d0.resolve(d0.dirname(Y),_),d0.resolve(X.componentsDir||"components",`${_}.stx`),d0.resolve(X.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${_}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function bU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,_=1,B=z+1;while(B<J.length&&_>0){if(J[B]==="(")_++;else if(J[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=J.substring(z+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=A0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let M="",R=H,T=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)M=T[1].trim(),R=H+T[0].length;let I=await t1(F,A,M,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(R),q.lastIndex=0}return J}async function SU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=A1(J);return J=q.output,J=await _(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await _(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await _(J,/[a-z][a-z0-9]*/,!1,MU),J=Y$(J,q.scripts),J;async function _(B,j,H,L){if(!B)return B;let F=B,O=N2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?L4(w.tagName):w.tagName,M=TU(w.attributes),R=NU(M,Z,X),N=x0.getBuiltin(w.tagName),T=N?await F4(A,G,Z,Y,X):!1;if(N&&!T){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=N.render(R,w.content,y);if(Object.keys(R.clientReactive).length>0)S=b2(S,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([v,h])=>`${v}="${D2(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await F4(A,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(R.static))I[y]=S;for(let[y,S]of Object.entries(R.serverDynamic))I[y]=S;let E=await t1(A,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(R.clientReactive).length>0)E=b2(E,R.clientReactive);if(Object.keys(R.events).length>0){let y=y2(E);if(y){let S=Object.entries(R.events).map(([v,h])=>`${v}="${D2(h)}"`).join(" "),b=Object.keys(R.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+E.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function b2($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>L4(U)).join(" "),G=$,K=Q.length>0?y2(G):null;if(K){let U=Q.map(([_,B])=>`:${L4(_)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function y2($){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 X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function w4($,Z,Y,X,Q){if(!E2)R2(),E2=!0;let J=await S2($,Z,Y,X,Q);J=await kU(J,Z,Y,X,Q),J=await bU(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=X1(J,Z$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await SU(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=IU(J);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 J}var E2=!1,c3="\x00stx-boolean-attribute",MU,k2;var i3=k(()=>{w3();M2();I2();l1();w0();O0();MU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","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"]);k2=new Map});var A4={};t(A4,{stripTypeScript:()=>g2,splitDeclaration:()=>m2,isCompleteImport:()=>h2,hasVariables:()=>c2,extractVariables:()=>j1,extractScriptFromTemplate:()=>p2,convertToCommonJS:()=>s3});import D1 from"path";import E5 from"process";function yU($){let Z=[],Y=0,X=$.split(`
1924
- `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...z)}}}}return[...new Set(Z)]}function g2($){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(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=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){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),_=z?U.slice(3):U,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let B=Z[q];if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let _=Y(z);J.push({start:G+1,end:q,replacement:_})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).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,`
1927
+ </style>`}}});import{existsSync as NU,readFileSync as TU}from"fs";function IU($){if(R2.has($))return;R2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function EU($){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(NU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return o.resolve(Y)}catch{}return null}function DU($){if(H4.has($))return H4.get($);let Z=EU($);if(!Z)return IU($),null;try{let Y=JSON.parse(TU(Z,"utf8"));return H4.set($,Y.icons),Y.icons}catch{return null}}function I5($,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 H4,R2,h3;var u3=k(()=>{H4=new Map,R2=new Set;h3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=I5($,"name")??I5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=k0(I5($,"size")||"24"),K=k0(I5($,"color")||"currentColor"),q=k0(I5($,"class")||""),W=k0(I5($,"style")||""),U=H4.get(Q)??DU(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let _=z.width||24,B=z.height||24,j=`0 0 ${_} ${B}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function M2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function N2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var d3;var m3=k(()=>{d3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=N2(Z,"fallback"),Q=X.rest,J=N2(Q,"error"),G=J.rest,K=X.region??M2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??M2($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function O4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var l3;var p3=k(()=>{l3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(O4($,"name")||"v").replace(/["'<>]/g,""),Q=(O4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=O4($,"class"),G=O4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function T2(){x0.registerBuiltin(A3),x0.registerBuiltin(I3),x0.registerBuiltin(D3),x0.registerBuiltin(S3),x0.registerBuiltin(P3),x0.registerBuiltin(v3),x0.registerBuiltin(f3),x0.registerBuiltin(h3),x0.registerBuiltin(d3),x0.registerBuiltin(l3)}var I2=k(()=>{R3();E3();k3();y3();C3();x3();g3();u3();m3();p3();w3();R3();E3();k3();y3();C3();x3();g3();u3();m3();p3()});function L4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function E2($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){Q=J+1;continue}let j=$.slice(z,B?_-2:_-1).trim();if(B)X.push({fullMatch:$.slice(J,_),tagName:q,attributes:j,content:"",startIndex:J,endIndex:_,isSelfClosing:!0}),Q=_;else{let H=`<${q}`,L=`</${q}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let M=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(M!==-1&&M<R){let N=$[M+H.length];if(N===" "||N===">"||N==="/"||N===`
1928
+ `||N==="\t")F++;O=M+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=_;continue}let w=$.slice(_,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:w,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function D2($,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 k2=k(()=>{O0();w0();l1()});var x2={};t(x2,{processESImports:()=>C2,processComponents:()=>w4});import V4 from"fs";import d0 from"path";function bU($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(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,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=D2(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===c3?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!K0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let _=Object.keys(Z),j=q0(z,_)(...Object.values(Z));if(j===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!_.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=j}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(K0(z)){let B=q0(z,Object.keys(Z))(...Object.values(Z));G(W,B!=null?String(B):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=_.exec(q))!==null)try{let j=B[1];if(!K0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=q0(j,Object.keys(Z))(...Object.values(Z));z=z.replace(B[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,z)}continue}G(W,q===c3?"true":q)}return X}function SU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=c3}return Z}function S2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(x0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function PU($){let Z=y2.get($);if(Z)return Z;let Y=new Map,X=[d0.join($,"src"),d0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=V4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=d0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let _=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return y2.set($,Y),Y}function CU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=d0.join(Y,"node_modules",$);try{if(V4.statSync(X).isDirectory())return X}catch{}let Q=d0.dirname(Y);if(Q===Y)return null;Y=Q}}async function C2($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,H=[];while((j=_.exec(z))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let N=d0.resolve(G,V);if(N.endsWith(".stx"))A=N;else{let T=`${N}.stx`;try{if(V4.statSync(T).isFile())A=T}catch{try{if(V4.statSync(N).isDirectory())w=N}catch{}}}}else w=CU(V,G);if(!w&&!A)continue;let M=!1,R=(N,T)=>{J.set(N,T),J.set(N.toLowerCase(),T);let I=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,T),Q.add(T)};if(O&&A)R(O,A),M=!0;else if(F){let N=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),T=w?PU(w):null;for(let{source:I,local:D}of N){let E=null;if(A)E=A;else if(T)E=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),M=!0}}if(M)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${U}>${B}</script>`}),K}async function vU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of z){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[d0.resolve(d0.dirname(Y),`${_}.stx`),d0.resolve(d0.dirname(Y),_),d0.resolve(X.componentsDir||"components",`${_}.stx`),d0.resolve(X.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${_}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function xU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,_=1,B=z+1;while(B<J.length&&_>0){if(J[B]==="(")_++;else if(J[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=J.substring(z+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=A0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let M="",R=H,T=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)M=T[1].trim(),R=H+T[0].length;let I=await t1(F,A,M,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(R),q.lastIndex=0}return J}async function fU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=A1(J);return J=q.output,J=await _(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await _(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await _(J,/[a-z][a-z0-9]*/,!1,kU),J=Y$(J,q.scripts),J;async function _(B,j,H,L){if(!B)return B;let F=B,O=E2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?L4(w.tagName):w.tagName,M=SU(w.attributes),R=bU(M,Z,X),N=x0.getBuiltin(w.tagName),T=N?await F4(A,G,Z,Y,X):!1;if(N&&!T){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=N.render(R,w.content,y);if(Object.keys(R.clientReactive).length>0)S=P2(S,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([v,h])=>`${v}="${S2(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await F4(A,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(R.static))I[y]=S;for(let[y,S]of Object.entries(R.serverDynamic))I[y]=S;let E=await t1(A,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(R.clientReactive).length>0)E=P2(E,R.clientReactive);if(Object.keys(R.events).length>0){let y=v2(E);if(y){let S=Object.entries(R.events).map(([v,h])=>`${v}="${S2(h)}"`).join(" "),b=Object.keys(R.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+E.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function P2($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>L4(U)).join(" "),G=$,K=Q.length>0?v2(G):null;if(K){let U=Q.map(([_,B])=>`:${L4(_)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function v2($){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 X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function w4($,Z,Y,X,Q){if(!b2)T2(),b2=!0;let J=await C2($,Z,Y,X,Q);J=await vU(J,Z,Y,X,Q),J=await xU(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=X1(J,Z$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await fU(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=yU(J);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 J}var b2=!1,c3="\x00stx-boolean-attribute",kU,y2;var i3=k(()=>{w3();I2();k2();l1();w0();O0();kU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);y2=new Map});var A4={};t(A4,{stripTypeScript:()=>d2,splitDeclaration:()=>c2,isCompleteImport:()=>m2,hasVariables:()=>s2,extractVariables:()=>j1,extractScriptFromTemplate:()=>n2,convertToCommonJS:()=>s3});import D1 from"path";import E5 from"process";function gU($){let Z=[],Y=0,X=$.split(`
1929
+ `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...z)}}}}return[...new Set(Z)]}function d2($){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(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=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){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),_=z?U.slice(3):U,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let B=Z[q];if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let _=Y(z);J.push({start:G+1,end:q,replacement:_})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).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,`
1925
1930
 
1926
- `),Z}async function j1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=C.transformSync(P)}catch{Q=g2($)}let J={exports:{}},G=J.exports,K=E5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of W)try{let P=D1.resolve(K,"node_modules",C),x=D1.join(P,"package.json"),l=JSON.parse(a("fs").readFileSync(x,"utf8")),d=l.main||"index.js";if(l.exports){let z0=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof z0==="string")d=z0;else if(z0?.bun)d=z0.bun;else if(z0?.import)d=z0.import;else if(z0?.default)d=z0.default}q[C]=await import(D1.resolve(P,d))}catch{}let U=(C)=>{if(q[C])return q[C];return a(C)},z=Z.props||{},_=(C)=>{if(!C)return z;let P={};for(let[x,l]of Object.entries(C)){let d=z[x];if(d!==void 0)P[x]=d;else if(typeof l==="function")P[x]=l();else P[x]=l}return P};for(let[C,P]of Object.entries(z))Object.defineProperty(_,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(_,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return z;let P={...z};for(let[x,l]of Object.entries(C)){let d=l&&typeof l==="object"&&!Array.isArray(l)?l:{type:l};if(P[x]===void 0&&d.default!==void 0)P[x]=typeof d.default==="function"?d.default():d.default}return P},j=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[l,d]of Object.entries(P))if(x[l]===void 0)if(typeof d==="function")x[l]=d();else x[l]=d;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},F=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},V=(C)=>C(),w=(C)=>{},A=(C)=>{},M=(C)=>{},R=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},N=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(P,C||{})},I=(C)=>{T(G4(C||{}))},D=(C)=>({value:C}),E=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),S=(C,P)=>{},b=(C)=>{},v=(C)=>{},h=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},m=(C)=>{},r=(C,P)=>{},I0=(C,P)=>P,E0=()=>({value:"light"}),l0=()=>L(!1),Q0=(C)=>L(!1),G0=()=>L(!1),D0=()=>Q0("(prefers-color-scheme: dark)"),o0=()=>Q0("(prefers-color-scheme: light)"),L1=()=>Q0("(prefers-reduced-motion: reduce)"),Q5=()=>Q0("(prefers-contrast: more)"),n={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},J0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),B0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let C=s3(Q,Y),P=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),l=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),d=l.map((i)=>Z[i]),z0=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"]),V0=[],q1=[];for(let[i,g0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(z0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;V0.push(i),q1.push(g0)}let P0=yU(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1927
- `),r0=Z.params??{},v1=[],F1=[];for(let i=0;i<l.length;i++){if(l[i]==="params")continue;v1.push(l[i]),F1.push(d[i])}let W0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...V0,...v1,`return (async () => {
1931
+ `),Z}async function j1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=C.transformSync(P)}catch{Q=d2($)}let J={exports:{}},G=J.exports,K=E5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of W)try{let P=D1.resolve(K,"node_modules",C),x=D1.join(P,"package.json"),l=JSON.parse(o("fs").readFileSync(x,"utf8")),d=l.main||"index.js";if(l.exports){let z0=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof z0==="string")d=z0;else if(z0?.bun)d=z0.bun;else if(z0?.import)d=z0.import;else if(z0?.default)d=z0.default}q[C]=await import(D1.resolve(P,d))}catch{}let U=(C)=>{if(q[C])return q[C];return o(C)},z=Z.props||{},_=(C)=>{if(!C)return z;let P={};for(let[x,l]of Object.entries(C)){let d=z[x];if(d!==void 0)P[x]=d;else if(typeof l==="function")P[x]=l();else P[x]=l}return P};for(let[C,P]of Object.entries(z))Object.defineProperty(_,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(_,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return z;let P={...z};for(let[x,l]of Object.entries(C)){let d=l&&typeof l==="object"&&!Array.isArray(l)?l:{type:l};if(P[x]===void 0&&d.default!==void 0)P[x]=typeof d.default==="function"?d.default():d.default}return P},j=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[l,d]of Object.entries(P))if(x[l]===void 0)if(typeof d==="function")x[l]=d();else x[l]=d;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},F=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},V=(C)=>C(),w=(C)=>{},A=(C)=>{},M=(C)=>{},R=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},N=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(P,C||{})},I=(C)=>{T(G4(C||{}))},D=(C)=>({value:C}),E=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),S=(C,P)=>{},b=(C)=>{},v=(C)=>{},h=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},m=(C)=>{},r=(C,P)=>{},I0=(C,P)=>P,E0=()=>({value:"light"}),l0=()=>L(!1),Q0=(C)=>L(!1),G0=()=>L(!1),D0=()=>Q0("(prefers-color-scheme: dark)"),r0=()=>Q0("(prefers-color-scheme: light)"),L1=()=>Q0("(prefers-reduced-motion: reduce)"),Q5=()=>Q0("(prefers-contrast: more)"),n={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},J0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),B0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let C=s3(Q,Y),P=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),l=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),d=l.map((i)=>Z[i]),z0=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"]),V0=[],q1=[];for(let[i,g0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(z0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;V0.push(i),q1.push(g0)}let P0=gU(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1932
+ `),o0=Z.params??{},v1=[],F1=[];for(let i=0;i<l.length;i++){if(l[i]==="params")continue;v1.push(l[i]),F1.push(d[i])}let W0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...V0,...v1,`return (async () => {
1928
1933
  ${C}
1929
1934
  ${P0}
1930
1935
  return module.exports
1931
- })()`)(J,G,U,z,_,B,H,L,F,O,V,w,A,M,R,N,T,I,D,E,y,S,b,v,h,f,m,j,r,I0,E0,l0,Q0,G0,D0,o0,L1,Q5,J0,B0,M0,n.confirm,n.alert,n.fetch,r0,...q1,...F1);if(X.preserveExisting){for(let[i,g0]of Object.entries(W0))if(!(i in Z)||Z[i]===void 0)Z[i]=g0}else Object.assign(Z,W0);for(let[i,g0]of Object.entries(z))if(!(i in Z))Z[i]=g0}catch(C){if(E5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await fU(Q,Z,Y)}catch(P){if(E5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function h2($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function s3($,Z){let Y=Z?D1.dirname(Z):E5.cwd(),X=E5.cwd(),Q=$.split(`
1932
- `),J=[],G=0;while(G<Q.length){let K=Q[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<Q.length;G++){for(let W of Q[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1;for(let U=G;U<Q.length&&!W;U++){let z=null,_=!1,B=Q[U];for(let j=0;j<B.length;j++){let H=B[j];if(_){_=!1;continue}if(H==="\\"){_=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")q++;else if(H===")"){if(q--,q===0){G=U+1,W=!0;break}}}}if(!W)G=Q.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!h2(q)&&G+W+1<Q.length)W++,q=`${q} ${Q[G+W].trim()}`;G+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),_=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(H)=>{if(H.startsWith("."))return D1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return D1.resolve(X,H.slice(2));return H};if(U){let[,H,L]=U,F=j(L);J.push(`const ${H} = await import('${F}')`),J.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,L]=z,F=H.trim(),O=j(L);J.push(`const { ${F} } = await import('${O}')`);for(let V of F.split(",")){let w=V.trim().split(/\s+as\s+/).pop()?.trim();if(w)J.push(`module.exports.${w} = ${w};`)}}else if(_){let H=j(_[1]);J.push(`await import('${H}')`)}else J.push(B);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("="))J.push(Q[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=C2(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=n3(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=C2(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=n3(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Q];W[G]=q;let U=n3(W,G);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=Q[G].replace(/^export\s+/,""),z=0,_=G;for(;_<Q.length;_++){let B=Q[_];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(_>G)U+=`
1933
- `+B;if(z<=0&&_>=G)break}J.push(U),J.push(`module.exports.${W} = ${W};`),G=_+1}else J.push(K),G++}else if(K.includes("module.exports"))J.push(K),G++;else if(K.trim()&&!K.startsWith("//"))J.push(K),G++;else G++}return PU(J.join(`
1934
- `),Y,X)}function PU($,Z,Y){let X=$.length,Q="",J=0,G=null,K=!1,q=!1,W=0;while(J<X){let U=$[J],z=$[J+1];if(K){if(Q+=U,U===`
1935
- `)K=!1;J++;continue}if(q){if(Q+=U,U==="*"&&z==="/"){Q+=z,J+=2,q=!1;continue}J++;continue}if(!G&&U==="/"&&z==="/"){K=!0,Q+=U,J++;continue}if(!G&&U==="/"&&z==="*"){q=!0,Q+=U,J++;continue}if(G){if(Q+=U,U==="\\"){Q+=z,J+=2;continue}if(U===G&&G!=="`"){G=null,J++;continue}if(G==="`"){if(U==="$"&&z==="{"){W++,Q+=z,J+=2;continue}if(U==="`"){G=null,J++;continue}}J++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){G=U,Q+=U,J++;continue}if(U==="a"&&$.startsWith("await",J)){let _=CU($,J);if(_){let{quote:B,path:j,end:H}=_;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let L=j.startsWith(".")?D1.resolve(Z,j):D1.resolve(Y,j.slice(2));Q+=`await import(${B}${L}${B})`,J=H;continue}}}Q+=U,J++}return Q}function CU($,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 X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function u2($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=v0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function d2($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=u2(Y,X);if(K){let q=d2(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function m2($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function C2($,Z){let Y=$[Z].trim(),X=m2(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),_=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let j=z.startsWith("{")?"}":"]",H=z;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),_=L,$[L].includes(j))break;z=H}let B=u2(z,0);if(B){let j=U[1],H=B.pattern,L=z.slice(B.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(_,Z);if(v2(F)){let R=x2($,V,F);O=R.value,V=R.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=d2(H),A=`__stx_src_${Z}`,M=w.map((R)=>`module.exports.${R} = ${R};`).join(`
1936
+ })()`)(J,G,U,z,_,B,H,L,F,O,V,w,A,M,R,N,T,I,D,E,y,S,b,v,h,f,m,j,r,I0,E0,l0,Q0,G0,D0,r0,L1,Q5,J0,B0,M0,n.confirm,n.alert,n.fetch,o0,...q1,...F1);if(X.preserveExisting){for(let[i,g0]of Object.entries(W0))if(!(i in Z)||Z[i]===void 0)Z[i]=g0}else Object.assign(Z,W0);for(let[i,g0]of Object.entries(z))if(!(i in Z))Z[i]=g0}catch(C){if(E5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await lU(Q,Z,Y)}catch(P){if(E5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function m2($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function s3($,Z){let Y=Z?D1.dirname(Z):E5.cwd(),X=E5.cwd(),Q=$.split(`
1937
+ `),J=[],G=0;while(G<Q.length){let K=Q[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<Q.length;G++){for(let W of Q[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1;for(let U=G;U<Q.length&&!W;U++){let z=null,_=!1,B=Q[U];for(let j=0;j<B.length;j++){let H=B[j];if(_){_=!1;continue}if(H==="\\"){_=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")q++;else if(H===")"){if(q--,q===0){G=U+1,W=!0;break}}}}if(!W)G=Q.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!m2(q)&&G+W+1<Q.length)W++,q=`${q} ${Q[G+W].trim()}`;G+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),_=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(H)=>{if(H.startsWith("."))return D1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return D1.resolve(X,H.slice(2));return H};if(U){let[,H,L]=U,F=j(L);J.push(`const ${H} = await import('${F}')`),J.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,L]=z,F=H.trim(),O=j(L);J.push(`const { ${F} } = await import('${O}')`);for(let V of F.split(",")){let w=V.trim().split(/\s+as\s+/).pop()?.trim();if(w)J.push(`module.exports.${w} = ${w};`)}}else if(_){let H=j(_[1]);J.push(`await import('${H}')`)}else J.push(B);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("="))J.push(Q[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=f2(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=n3(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=f2(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=n3(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Q];W[G]=q;let U=n3(W,G);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=Q[G].replace(/^export\s+/,""),z=0,_=G;for(;_<Q.length;_++){let B=Q[_];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(_>G)U+=`
1938
+ `+B;if(z<=0&&_>=G)break}J.push(U),J.push(`module.exports.${W} = ${W};`),G=_+1}else J.push(K),G++}else if(K.includes("module.exports"))J.push(K),G++;else if(K.trim()&&!K.startsWith("//"))J.push(K),G++;else G++}return hU(J.join(`
1939
+ `),Y,X)}function hU($,Z,Y){let X=$.length,Q="",J=0,G=null,K=!1,q=!1,W=0;while(J<X){let U=$[J],z=$[J+1];if(K){if(Q+=U,U===`
1940
+ `)K=!1;J++;continue}if(q){if(Q+=U,U==="*"&&z==="/"){Q+=z,J+=2,q=!1;continue}J++;continue}if(!G&&U==="/"&&z==="/"){K=!0,Q+=U,J++;continue}if(!G&&U==="/"&&z==="*"){q=!0,Q+=U,J++;continue}if(G){if(Q+=U,U==="\\"){Q+=z,J+=2;continue}if(U===G&&G!=="`"){G=null,J++;continue}if(G==="`"){if(U==="$"&&z==="{"){W++,Q+=z,J+=2;continue}if(U==="`"){G=null,J++;continue}}J++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){G=U,Q+=U,J++;continue}if(U==="a"&&$.startsWith("await",J)){let _=uU($,J);if(_){let{quote:B,path:j,end:H}=_;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let L=j.startsWith(".")?D1.resolve(Z,j):D1.resolve(Y,j.slice(2));Q+=`await import(${B}${L}${B})`,J=H;continue}}}Q+=U,J++}return Q}function uU($,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 X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function l2($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=v0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function p2($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=l2(Y,X);if(K){let q=p2(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function c2($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function f2($,Z){let Y=$[Z].trim(),X=c2(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),_=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let j=z.startsWith("{")?"}":"]",H=z;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),_=L,$[L].includes(j))break;z=H}let B=l2(z,0);if(B){let j=U[1],H=B.pattern,L=z.slice(B.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(_,Z);if(g2(F)){let R=h2($,V,F);O=R.value,V=R.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=p2(H),A=`__stx_src_${Z}`,M=w.map((R)=>`module.exports.${R} = ${R};`).join(`
1936
1941
  `);return{type:j,name:A,value:`${O}; ${j} ${H} = ${A};
1937
- ${M}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(v2(K)){let U=x2($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1938
- ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function n3($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(vU(Y)){let K=xU($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function v2($){let Z=$.trim();if(Z.startsWith("{"))return v0(Z,"{","}",0)===-1;if(Z.startsWith("["))return v0(Z,"[","]",0)===-1;return!l2(Z)}function l2($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function vU($){let Z=$.indexOf("{");if(Z===-1)return!0;return v0($,"{","}",Z)===-1}function x2($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!l2(X)){let J=$[Q];X+=`
1942
+ ${M}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(g2(K)){let U=h2($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1943
+ ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function n3($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(dU(Y)){let K=mU($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function g2($){let Z=$.trim();if(Z.startsWith("{"))return v0(Z,"{","}",0)===-1;if(Z.startsWith("["))return v0(Z,"[","]",0)===-1;return!i2(Z)}function i2($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function dU($){let Z=$.indexOf("{");if(Z===-1)return!0;return v0($,"{","}",Z)===-1}function h2($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!i2(X)){let J=$[Q];X+=`
1939
1944
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1940
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function xU($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(v0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1941
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function f2($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...E5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function fU($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=f2(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=f2(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function p2($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function c2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var D5=k(()=>{U$();x1();O0()});var t2={};t(t2,{processLoops:()=>o3});function uU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,_=U.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=U.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=A0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function R4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=X.substring(K+1,W),B=Y(_);X=X.substring(0,G)+B+X.substring(W+1)}return X}function dU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);h$(J);let W=q0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function mU($,Z){let Y=$;return Y=R4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(K0(J)){let K=q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?M4:""}catch{return""}}),Y=R4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(K0(J)){let K=q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?N4:""}catch{return""}}),Y}function lU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M4),Z=Z.replace(/@continue(?!\()/g,N4),Z}function i2($){let Z=$.includes(M4),Y=Z?$.substring(0,$.indexOf(M4)):$;return{hasBreak:Z,content:Y}}function n2($){let Z=$.includes(N4),Y=Z?$.substring(0,$.indexOf(N4)):$;return{hasContinue:Z,content:Y}}function o2($){let Z=$;return Z=R4(Z,"@break",(Y)=>{let X=Y.trim();if(!u$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=R4(Z,"@continue",(Y)=>{let X=Y.trim();if(!u$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function pU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,_=K.length-1,B=0;while(z<=_){let j=z+_>>1;if(K[j].pos<=U)B=K[j].depth,z=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,_=1,B=z+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,M=/@forelse\s*\(/g,R=/@endforelse/g,N=-1;while(w>0&&A<$.length){M.lastIndex=A,R.lastIndex=A;let S=M.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)w++,A=S.index+S[0].length;else{if(w--,w===0){N=b.index;break}A=b.index+11}}if(N===-1)continue;let T=$.substring(V,N),I=N+11,D=-1,E=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let b=T.substring(S);if(/^@forelse\s*\(/.test(b))E++,y=S+1;else if(b.startsWith("@endforelse"))E--,y=S+11;else if(E===0&&b.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){D=S;break}y=S+1}else y=S+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,D),emptyContent:T.substring(D+6)}}return null}function s2($,Z){let Y=$;while(!0){let X=pU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(K0(G))U=q0(G,Object.keys(Z))(...Object.values(Z));else U=Y0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),_=$0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(J)}}return Y}function o3($,Z,Y,X){let Q=$;Q=s2(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,_=U.index+U[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),A=H+1,M=1,R=A,N=/@foreach\s*\(/g,T=/@endforeach/g;while(M>0&&R<q.length){N.lastIndex=R,T.lastIndex=R;let I=N.exec(q),D=T.exec(q);if(!D)break;if(I&&I.index<D.index)M++,R=I.index+I[0].length;else{if(M--,M===0){let E=q.substring(A,D.index),y=D.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(K0(F))O=q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,_)+D+U.substring(B);continue}let w=X?.loops?.useAltLoopVariable??hU,A=H.trim(),M=null,R,N=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1],N=!0;else R=A}else R=A;let T="",I=O;for(let D=0;D<I.length;D++){let E=I[D],y={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(R.startsWith("[")&&R.endsWith("]")){let f=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))f.forEach((m,r)=>{if(m)S[m]=E[r]});else S[R]=E}else S[R]=E;if(M)if(!N&&V&&Array.isArray(E)&&E.length===2)S[M]=E[0],S[R]=E[1];else S[M]=D;let b=mU(L,S),v=n2(b);if(v.hasContinue){T+=v.content;continue}let h=i2(b);if(h.hasBreak){T+=h.content;break}if(b=s2(b,S),b=G(b,S),b=s1(b,S,Y),b=lU(b),h=i2(b),h.hasBreak){T+=h.content;break}if(v=n2(b),v.hasContinue){T+=v.content;continue}b=R1(b,S,Y),b=dU(b,S),b=uU(b,S),T+=b}U=U.substring(0,_)+T+U.substring(B)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,_)+O+U.substring(B)}}return U}Q=G(Q,Z),Q=a2(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??gU;return Q=nU(Q,Z,K),Q}function r2($){return u$($)}function a2($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=v0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,_=Z4(Q.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!r2(U)){let H=$0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=cU(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let M=iU({forExpr:U,content:B,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+M+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(M,R)=>{return`\${${R}}`});V=o2(V);let A=Function(...F,`
1945
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function mU($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(v0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1946
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function u2($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...E5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function lU($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=u2(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=u2(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function n2($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function s2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var D5=k(()=>{U$();x1();O0()});var ZY={};t(ZY,{processLoops:()=>r3});function iU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,_=U.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=U.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=A0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function R4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=X.substring(K+1,W),B=Y(_);X=X.substring(0,G)+B+X.substring(W+1)}return X}function nU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);h$(J);let W=q0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function sU($,Z){let Y=$;return Y=R4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(K0(J)){let K=q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?M4:""}catch{return""}}),Y=R4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(K0(J)){let K=q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?N4:""}catch{return""}}),Y}function rU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M4),Z=Z.replace(/@continue(?!\()/g,N4),Z}function r2($){let Z=$.includes(M4),Y=Z?$.substring(0,$.indexOf(M4)):$;return{hasBreak:Z,content:Y}}function o2($){let Z=$.includes(N4),Y=Z?$.substring(0,$.indexOf(N4)):$;return{hasContinue:Z,content:Y}}function t2($){let Z=$;return Z=R4(Z,"@break",(Y)=>{let X=Y.trim();if(!u$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=R4(Z,"@continue",(Y)=>{let X=Y.trim();if(!u$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function oU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,_=K.length-1,B=0;while(z<=_){let j=z+_>>1;if(K[j].pos<=U)B=K[j].depth,z=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,_=1,B=z+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,M=/@forelse\s*\(/g,R=/@endforelse/g,N=-1;while(w>0&&A<$.length){M.lastIndex=A,R.lastIndex=A;let S=M.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)w++,A=S.index+S[0].length;else{if(w--,w===0){N=b.index;break}A=b.index+11}}if(N===-1)continue;let T=$.substring(V,N),I=N+11,D=-1,E=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let b=T.substring(S);if(/^@forelse\s*\(/.test(b))E++,y=S+1;else if(b.startsWith("@endforelse"))E--,y=S+11;else if(E===0&&b.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){D=S;break}y=S+1}else y=S+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,D),emptyContent:T.substring(D+6)}}return null}function a2($,Z){let Y=$;while(!0){let X=oU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(K0(G))U=q0(G,Object.keys(Z))(...Object.values(Z));else U=Y0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),_=$0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(J)}}return Y}function r3($,Z,Y,X){let Q=$;Q=a2(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,_=U.index+U[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),A=H+1,M=1,R=A,N=/@foreach\s*\(/g,T=/@endforeach/g;while(M>0&&R<q.length){N.lastIndex=R,T.lastIndex=R;let I=N.exec(q),D=T.exec(q);if(!D)break;if(I&&I.index<D.index)M++,R=I.index+I[0].length;else{if(M--,M===0){let E=q.substring(A,D.index),y=D.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(K0(F))O=q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=$0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);U=U.substring(0,_)+D+U.substring(B);continue}let w=X?.loops?.useAltLoopVariable??cU,A=H.trim(),M=null,R,N=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1],N=!0;else R=A}else R=A;let T="",I=O;for(let D=0;D<I.length;D++){let E=I[D],y={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(R.startsWith("[")&&R.endsWith("]")){let f=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))f.forEach((m,r)=>{if(m)S[m]=E[r]});else S[R]=E}else S[R]=E;if(M)if(!N&&V&&Array.isArray(E)&&E.length===2)S[M]=E[0],S[R]=E[1];else S[M]=D;let b=sU(L,S),v=o2(b);if(v.hasContinue){T+=v.content;continue}let h=r2(b);if(h.hasBreak){T+=h.content;break}if(b=a2(b,S),b=G(b,S),b=s1(b,S,Y),b=rU(b),h=r2(b),h.hasBreak){T+=h.content;break}if(v=o2(b),v.hasContinue){T+=v.content;continue}b=R1(b,S,Y),b=nU(b,S),b=iU(b,S),T+=b}U=U.substring(0,_)+T+U.substring(B)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);U=U.substring(0,_)+O+U.substring(B)}}return U}Q=G(Q,Z),Q=$Y(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??pU;return Q=eU(Q,Z,K),Q}function e2($){return u$($)}function $Y($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=v0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,_=Z4(Q.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!e2(U)){let H=$0("For",`Unsafe expression in @for: ${U}`,s.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=aU(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let M=tU({forExpr:U,content:B,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+M+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(M,R)=>{return`\${${R}}`});V=t2(V);let A=Function(...F,`
1942
1947
  let result = '';
1943
1948
  for (${U}) {
1944
1949
  result += \`${V}\`;
1945
1950
  }
1946
1951
  return result;
1947
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=$0("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function cU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let _=q.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function iU($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
1952
+ `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=$0("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function aU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let _=q.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function tU($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
1948
1953
  for (${Z}) {
1949
1954
  __pushIter([${X.join(", ")}])
1950
1955
  }
1951
- `),U=[];W(...q,(B)=>{U.push(B)});let z=J??"inline.stx",_="";for(let B of U){let j={...Q};X.forEach((L,F)=>{j[L]=B[F]});let H=a2(Y,j,J,G);H=s1(H,j,z),H=R1(H,j,z),_+=H}return _}function nU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=v0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=Z4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,_=G+U[0].end;if(!r2(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+B+X.substring(_),Q=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=o2(H);let F=Function(...B,`
1956
+ `),U=[];W(...q,(B)=>{U.push(B)});let z=J??"inline.stx",_="";for(let B of U){let j={...Q};X.forEach((L,F)=>{j[L]=B[F]});let H=$Y(Y,j,J,G);H=s1(H,j,z),H=R1(H,j,z),_+=H}return _}function eU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=v0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=Z4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,_=G+U[0].end;if(!e2(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);X=X.substring(0,G)+B+X.substring(_),Q=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=t2(H);let F=Function(...B,`
1952
1957
  let result = '';
1953
1958
  let maxIterations = ${Y}; // Configurable safety limit
1954
1959
  let counter = 0;
@@ -1960,8 +1965,8 @@ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function f2($,Z){let Y=Y0($,Z)??Y0(
1960
1965
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
1961
1966
  }
1962
1967
  return result;
1963
- `)(...j);X=X.substring(0,G)+F+X.substring(_),Q=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(_),Q=!0}}return X}var gU=1000,hU=!1,M4="<!--__STX_BREAK__-->",N4="<!--__STX_CONTINUE__-->";var r3=k(()=>{X4();B1();J1();Y4();O0()});import _0 from"path";function a3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function sU($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function oU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function $Y($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
1964
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function ZY($,Z=""){let Y=$Y($).split(",").map((X)=>X.trim()).filter(Boolean);return`
1968
+ `)(...j);X=X.substring(0,G)+F+X.substring(_),Q=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(_),Q=!0}}return X}var pU=1000,cU=!1,M4="<!--__STX_BREAK__-->",N4="<!--__STX_CONTINUE__-->";var o3=k(()=>{X4();B1();J1();Y4();O0()});import _0 from"path";function a3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function $z($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function Zz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function XY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
1969
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function JY($,Z=""){let Y=XY($).split(",").map((X)=>X.trim()).filter(Boolean);return`
1965
1970
  (function() {
1966
1971
  ${j5("var",Y)}
1967
1972
  var __destroyHooks = [];
@@ -1970,11 +1975,11 @@ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function f2($,Z){let Y=Y0($,Z)??Y0(
1970
1975
 
1971
1976
  ${$}
1972
1977
  ${Z}})();
1973
- `}function YY($,Z){return`
1978
+ `}function QY($,Z){return`
1974
1979
  // Register scope variables for STX runtime
1975
1980
  if (!window.stx._scopes) window.stx._scopes = {};
1976
1981
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
1977
- ${$Y($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
1982
+ ${XY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
1978
1983
  `)}
1979
1984
  // #1767: when the bundler renamed a component const that collided with an
1980
1985
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -1982,7 +1987,7 @@ ${$Y($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
1982
1987
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
1983
1988
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
1984
1989
  window.stx._scopes['${Z}'] = __scopeRegistration;
1985
- `}function rU($,Z){let Y=YY($,Z),X=`
1990
+ `}function Yz($,Z){let Y=QY($,Z),X=`
1986
1991
  (function() {
1987
1992
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
1988
1993
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -1991,21 +1996,21 @@ ${$Y($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
1991
1996
  } finally {
1992
1997
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
1993
1998
  }
1994
- })();`;return X+ZY($,Y)+`
1999
+ })();`;return X+JY($,Y)+`
1995
2000
  } finally {
1996
2001
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
1997
2002
  }
1998
- })();`}function aU($,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 Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function eU($){if($.__onceStore instanceof Set)return $.__onceStore;return tU}async function t3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||_0.join(_0.dirname(Y),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=sU($,"@partial","@include"),q=eU(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let M=A[1],R=W(M,G,Y),N="";if(R&&await Bun.file(R).exists())Q.add(R),N=`@include(${w})`;K=K.substring(0,L)+N+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let M=K.substring(V+1,A-1),R=a3(M,0);if(R===-1){L.lastIndex=A;continue}let N=M.substring(0,R).trim(),T=M.substring(R+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=T.substring(I[0].length),y,S=a3(E,0);if(S!==-1)y=E.substring(S+1).trim();try{let b=`Boolean(${N})`,v;if(K0(b)){let m=q0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean(Y0(b,Z));let h=H?!v:v,f="";if(h){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${D}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=U0("Include",`Error evaluating ${j} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),M=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,N,T,I]=M;try{let D,E=N.trim();if(K0(E))D=q0(E,Object.keys(Z))(...Object.values(Z));else D=Y0(E,Z);let y="";if(Array.isArray(D)&&D.length>0)for(let S of D){let b={...Z,[T]:S},v=await z(R,b,$,L);y+=v}else if(I)y=await z(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+U0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),M=w.match(/^\s*(\[[^\]]+\])/);if(!M){j.lastIndex=0,K=K.replace(A,"");continue}let R=M[1],N=w.slice(M[0].length),T,I=N.match(/^\s*,\s*\{/);if(I){N=N.slice(I[0].length-1);let y=1,S=1;while(S<N.length&&y>0){if(N[S]==="{")y++;else if(N[S]==="}"){if(y--,y===0)break}S++}T=N.substring(0,S+1),N=N.slice(S+1)}let D,E=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(T)try{S=A0(T,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=U0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>D||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await c(h)){let f=await z(v,S,$,L);K=K.replace(A,()=>f),b=!0;break}}if(!b)if(D!==void 0)K=K.replace(A,()=>D);else if(X.debug){let v=U0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=U0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=_0.resolve(H),V=_0.resolve(_0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=_0.resolve(H,F);else w=_0.resolve(V,F);let A=_0.normalize(w),M=A.startsWith(O+_0.sep)||A===O,R=A.startsWith(V+_0.sep)||A===V,N=!1,T=_0.dirname(V);if(A.startsWith(T+_0.sep)){if(!_0.relative(T,A).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))N=!0}if(!M&&!R&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=_0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return U0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=_0.resolve(O);if(J.has(V)){let w=[...J,V].map((A)=>_0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return U0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (O3(),H3));w=f(w,Z)}if(w&&(X.debug||!K$()&&!o$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (F3(),W2));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (i3(),P2));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let M=A5(A);if(M)A=M.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(N)T=`<style${N[1]}>${N[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],y="",S=null;for(let f of E){let m=f[1]||"",r=f[2]||"",I0=m.includes("server"),E0=d1(m),l0="";try{let{extractAndStripCssImports:G0,renderVendorStyleTags:D0}=await Promise.resolve().then(() => (z5(),O8)),o0=G0(r,{filePath:O,projectRoot:process.cwd()});r=o0.code,l0=D0(o0.styles)}catch(G0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}if(E0&&r.trim())r=m1(r);if(!I0)try{let{hasUserImports:G0,bundleClientScript:D0}=await Promise.resolve().then(() => (e5(),t5));if(G0(r))r=await D0(r,O,{projectRoot:process.cwd()})}catch(G0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}let Q0=oU(r);if(Q0&&!I0){S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++e2}`;let G0=a0(r),D0=rU(G0,S);y+=`${l0}<script data-stx-scoped>${D0}</script>
1999
- `;continue}if(I0)try{let{extractVariables:G0}=await Promise.resolve().then(() => (D5(),A4));await G0(r,I,O)}catch(G0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,G0)}if(!I0&&!Q0){let G0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++e2}`;let D0=a0(r),o0=YY(D0,S),L1=ZY(D0,o0);y+=`${l0}<script data-stx-scoped${G0?` ${G0}`:""}>${L1}</script>
2000
- `}}if(S){let f=aU(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await t3(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (r3(),t2)),v=b(A,I,O);v=s1(v,I,O);let h=B5(w);if(v=R1(v,I,O,{forceSignals:h}),T)v+=`
2003
+ })();`}function Xz($,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 Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Qz($){if($.__onceStore instanceof Set)return $.__onceStore;return Jz}async function t3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||_0.join(_0.dirname(Y),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=$z($,"@partial","@include"),q=Qz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let M=A[1],R=W(M,G,Y),N="";if(R&&await Bun.file(R).exists())Q.add(R),N=`@include(${w})`;K=K.substring(0,L)+N+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let M=K.substring(V+1,A-1),R=a3(M,0);if(R===-1){L.lastIndex=A;continue}let N=M.substring(0,R).trim(),T=M.substring(R+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=T.substring(I[0].length),y,S=a3(E,0);if(S!==-1)y=E.substring(S+1).trim();try{let b=`Boolean(${N})`,v;if(K0(b)){let m=q0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean(Y0(b,Z));let h=H?!v:v,f="";if(h){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${D}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=U0("Include",`Error evaluating ${j} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),M=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,N,T,I]=M;try{let D,E=N.trim();if(K0(E))D=q0(E,Object.keys(Z))(...Object.values(Z));else D=Y0(E,Z);let y="";if(Array.isArray(D)&&D.length>0)for(let S of D){let b={...Z,[T]:S},v=await z(R,b,$,L);y+=v}else if(I)y=await z(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+U0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),M=w.match(/^\s*(\[[^\]]+\])/);if(!M){j.lastIndex=0,K=K.replace(A,"");continue}let R=M[1],N=w.slice(M[0].length),T,I=N.match(/^\s*,\s*\{/);if(I){N=N.slice(I[0].length-1);let y=1,S=1;while(S<N.length&&y>0){if(N[S]==="{")y++;else if(N[S]==="}"){if(y--,y===0)break}S++}T=N.substring(0,S+1),N=N.slice(S+1)}let D,E=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(T)try{S=A0(T,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=U0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>D||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await c(h)){let f=await z(v,S,$,L);K=K.replace(A,()=>f),b=!0;break}}if(!b)if(D!==void 0)K=K.replace(A,()=>D);else if(X.debug){let v=U0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=U0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=_0.resolve(H),V=_0.resolve(_0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=_0.resolve(H,F);else w=_0.resolve(V,F);let A=_0.normalize(w),M=A.startsWith(O+_0.sep)||A===O,R=A.startsWith(V+_0.sep)||A===V,N=!1,T=_0.dirname(V);if(A.startsWith(T+_0.sep)){if(!_0.relative(T,A).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))N=!0}if(!M&&!R&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=_0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return U0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=_0.resolve(O);if(J.has(V)){let w=[...J,V].map((A)=>_0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return U0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (O3(),H3));w=f(w,Z)}if(w&&(X.debug||!K$()&&!r$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (F3(),_2));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (i3(),x2));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let M=A5(A);if(M)A=M.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(N)T=`<style${N[1]}>${N[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],y="",S=null;for(let f of E){let m=f[1]||"",r=f[2]||"",I0=m.includes("server"),E0=d1(m),l0="";try{let{extractAndStripCssImports:G0,renderVendorStyleTags:D0}=await Promise.resolve().then(() => (z5(),V8)),r0=G0(r,{filePath:O,projectRoot:process.cwd()});r=r0.code,l0=D0(r0.styles)}catch(G0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}if(E0&&r.trim())r=m1(r);if(!I0)try{let{hasUserImports:G0,bundleClientScript:D0}=await Promise.resolve().then(() => (e5(),t5));if(G0(r))r=await D0(r,O,{projectRoot:process.cwd()})}catch(G0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}let Q0=Zz(r);if(Q0&&!I0){S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++YY}`;let G0=a0(r),D0=Yz(G0,S);y+=`${l0}<script data-stx-scoped>${D0}</script>
2004
+ `;continue}if(I0)try{let{extractVariables:G0}=await Promise.resolve().then(() => (D5(),A4));await G0(r,I,O)}catch(G0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,G0)}if(!I0&&!Q0){let G0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++YY}`;let D0=a0(r),r0=QY(D0,S),L1=JY(D0,r0);y+=`${l0}<script data-stx-scoped${G0?` ${G0}`:""}>${L1}</script>
2005
+ `}}if(S){let f=Xz(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await t3(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (o3(),ZY)),v=b(A,I,O);v=s1(v,I,O);let h=B5(w);if(v=R1(v,I,O,{forceSignals:h}),T)v+=`
2001
2006
  `+T;if(y)v+=`
2002
2007
  `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return U0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let _=/@include\s*\(/g,B;while((B=_.exec(K))!==null){let j=B.index,H=j+B[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){_.lastIndex=F;continue}let A=w[1],M,R=V.substring(w[0].length),N=a3(R,0);if(N!==-1)M=R.substring(N+1).trim();let T={};if(M)try{T=A0(M,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,U0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),_.lastIndex=0;continue}let I=await z(A,T,$,j);K=K.substring(0,j)+I+K.substring(F),_.lastIndex=0}return K}function e3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let _=z.index,B=z[1],j=_+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),M=A.match(H),R=A.match(L),N=M?O+M.index:1/0,T=R?O+R.index:1/0;if(N<T)F++,O=N+(M[0].length||1);else if(T<1/0){if(F--,F===0){V=T;break}O=T+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);q=q.substring(0,_)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function $6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
2003
- `)})}var e2=0,Sw,tU;var XY=k(()=>{W4();X4();J1();Q$();L5();O0();w0();Sw=new p1(500),tU=new Set});import*as Z6 from"path";async function JY($,Z,Y=""){if(Z6.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 GY($,Z,Y,"@js","@endjs")}async function QY($,Z,Y=""){if(Z6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return GY($,Z,Y,"@ts","@endts")}async function GY($,Z,Y,X,Q){let J=$,G=O5(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let _={...Z,global:Z},B=Object.keys(_),j=Object.values(_),H=U.trim();if(X==="@ts")H=H.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=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((M)=>M.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2008
+ `)})}var YY=0,mw,Jz;var GY=k(()=>{W4();X4();J1();Q$();L5();O0();w0();mw=new p1(500),Jz=new Set});import*as Z6 from"path";async function KY($,Z,Y=""){if(Z6.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 WY($,Z,Y,"@js","@endjs")}async function qY($,Z,Y=""){if(Z6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return WY($,Z,Y,"@ts","@endts")}async function WY($,Z,Y,X,Q){let J=$,G=O5(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let _={...Z,global:Z},B=Object.keys(_),j=Object.values(_),H=U.trim();if(X==="@ts")H=H.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=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((M)=>M.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2004
2009
  ${H}
2005
2010
  ${O}
2006
- `,A=Function(...B,V)(...j);if(A&&typeof A==="object")Object.assign(Z,A);J=J.replace(W,"")}catch(_){console.error(`Error executing ${X} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=U0(`${X} Directive`,`Error executing code: ${B}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var KY=k(()=>{L5();w0()});function $z($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function qY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return $z(X,J||"_method")})}async function WY($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=U0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
2011
+ `,A=Function(...B,V)(...j);if(A&&typeof A==="object")Object.assign(Z,A);J=J.replace(W,"")}catch(_){console.error(`Error executing ${X} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=U0(`${X} Directive`,`Error executing code: ${B}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var UY=k(()=>{L5();w0()});function Gz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function zY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return Gz(X,J||"_method")})}async function _Y($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=U0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
2007
2012
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(W)}</div>
2008
- `)}}}return J}async function UY($,Z,Y,X){return WY($,Z,Y,X,"before")}async function zY($,Z,Y,X){return WY($,Z,Y,X,"after")}var _Y=k(()=>{J1();w0()});import{defineRoute as pw,defineRoutes as cw,resetRoutes as iw,route as nw,setAppUrl as sw}from"stx-router";import{route as Zz}from"stx-router";function BY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?A0(Q,{}):{};return Zz(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var jY=k(()=>{O0()});function HY($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,_=U.length>1?U[1]:"";if(_&&Z[_])W=Z[_];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),_=U+1,B=(()=>{try{let j=A0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+B+Q.substring(_),J.lastIndex=0}return Q}function OY($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,_=(()=>{try{let B=A0(U,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+_+X.substring(z),Q.lastIndex=0}return X}function LY($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let _=Q.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=Q.substring(K,W),H=Q.substring(G.index,B),L=((F)=>{try{let O=A0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
2013
+ `)}}}return J}async function BY($,Z,Y,X){return _Y($,Z,Y,X,"before")}async function jY($,Z,Y,X){return _Y($,Z,Y,X,"after")}var HY=k(()=>{J1();w0()});import{defineRoute as ZA,defineRoutes as YA,resetRoutes as XA,route as JA,setAppUrl as QA}from"stx-router";import{route as Kz}from"stx-router";function OY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?A0(Q,{}):{};return Kz(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var LY=k(()=>{O0()});function FY($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,_=U.length>1?U[1]:"";if(_&&Z[_])W=Z[_];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),_=U+1,B=(()=>{try{let j=A0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,s.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+B+Q.substring(_),J.lastIndex=0}return Q}function VY($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,_=(()=>{try{let B=A0(U,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return $0("StructuredData",j,s.EVALUATION_ERROR)}})();X=X.substring(0,G)+_+X.substring(z),Q.lastIndex=0}return X}function wY($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let _=Q.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=Q.substring(K,W),H=Q.substring(G.index,B),L=((F)=>{try{let O=A0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
2009
2014
  `,V+=`<meta name="title" content="${p(O.title)}">
2010
2015
  `;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
2011
2016
  `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(w)}">
@@ -2027,7 +2032,7 @@ ${$Y($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
2027
2032
  `}if(w.site)V+=`<meta name="twitter:site" content="${p(w.site)}">
2028
2033
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${p(w.creator)}">
2029
2034
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
2030
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(B),J.lastIndex=G.index+L.length}return Q}function FY($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.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 J=$.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 q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
2035
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(B),J.lastIndex=G.index+L.length}return Q}function AY($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.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 J=$.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 q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
2031
2036
  <!-- stx SEO Tags -->
2032
2037
  <meta name="title" content="${p(G)}">
2033
2038
  <meta name="description" content="${p(K)}">
@@ -2043,25 +2048,26 @@ ${$Y($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
2043
2048
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
2044
2049
  <title>${p(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2045
2050
  ${W}
2046
- `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var VY,wY;var Y6=k(()=>{B1();O0();VY={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},wY={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function AY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(w$.exact[$])for(let X of w$.exact[$])await Promise.resolve(X(Z,$));if(w$.exact[Y])for(let X of w$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of w$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var w$;var RY=k(()=>{w$={patterns:[],exact:{}}});function MY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>MY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function NY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=U,j=!1;while((_=z.exec(U))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 A=Function(...F,`return (${L})`)(...O);if(H==="class"){let M=MY(A);if(M){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${M}"`);else B=B.replace(_[0],` class="${M}"`)}else B=B.replace(_[0],"");j=!0;continue}if(Yz.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let M=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${M}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${B}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:_}=q[W];Y=Y.slice(0,U)+_+Y.slice(z)}return Y}var Yz;var TY=k(()=>{Yz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function e1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&Xz.has(X[1]),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function Qz($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function G1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Qz($,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 IY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function k5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function k1($,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 b1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function Gz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function Kz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=k1(X.attrs,"v-for"),U=k1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
2051
+ `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var RY,MY;var Y6=k(()=>{B1();O0();RY={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},MY={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,s.EVALUATION_ERROR)}},hasEndTag:!0}});async function NY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(w$.exact[$])for(let X of w$.exact[$])await Promise.resolve(X(Z,$));if(w$.exact[Y])for(let X of w$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of w$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var w$;var TY=k(()=>{w$={patterns:[],exact:{}}});function IY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>IY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function EY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=U,j=!1;while((_=z.exec(U))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 A=Function(...F,`return (${L})`)(...O);if(H==="class"){let M=IY(A);if(M){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${M}"`);else B=B.replace(_[0],` class="${M}"`)}else B=B.replace(_[0],"");j=!0;continue}if(qz.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let M=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${M}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${B}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:_}=q[W];Y=Y.slice(0,U)+_+Y.slice(z)}return Y}var qz;var DY=k(()=>{qz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function e1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&Wz.has(X[1]),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function zz($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function G1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=zz($,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 kY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function k5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function k1($,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 b1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function _z($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function Bz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=k1(X.attrs,"v-for"),U=k1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
2047
2052
  `,H=`${j}${B}
2048
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function qz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=G1(Z,X),K=k1(X.attrs,"v-if"),q=b1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=e1(Z,W+L);if(!F){U=!1;break}let O=k5(F.attrs,"v-else-if"),V=IY(F.attrs,"v-else");if(O!==null){let w=G1(Z,F),A=k1(F.attrs,"v-else-if"),M=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:M,parsedTag:F}),W=w.outerEnd}else if(V){let w=G1(Z,F),A=k1(F.attrs,"v-else"),M=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:M,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
2053
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function jz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=G1(Z,X),K=k1(X.attrs,"v-if"),q=b1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=e1(Z,W+L);if(!F){U=!1;break}let O=k5(F.attrs,"v-else-if"),V=kY(F.attrs,"v-else");if(O!==null){let w=G1(Z,F),A=k1(F.attrs,"v-else-if"),M=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:M,parsedTag:F}),W=w.outerEnd}else if(V){let w=G1(Z,F),A=k1(F.attrs,"v-else"),M=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:M,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
2049
2054
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
2050
2055
  ${H.element}`);else z.push(`@else
2051
2056
  ${H.element}`);z.push("@endif");let _=z.join(`
2052
- `),B=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function Wz($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Uz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],_=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${_}" @update:${U}="${_} = $event"`,K=Q.match(G)}if(J){let U=G1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),_=b1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length;continue}let q=k5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(Jz.has(X.tag)){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length}}return Z}function zz($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function _z($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Bz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=G1(Z,X),G=k1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function jz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=G1(Z,X),G=k1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function Hz($){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 Oz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;if(!IY(X.attrs,"v-once")){Y=X.end;continue}let Q=k1(X.attrs,"v-once"),J=G1(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
2057
+ `),B=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function Hz($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Oz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],_=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${_}" @update:${U}="${_} = $event"`,K=Q.match(G)}if(J){let U=G1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),_=b1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length;continue}let q=k5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(Uz.has(X.tag)){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=G1(Z,X),_=Z.slice(z.outerStart,z.outerEnd),B=b1(_,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length}}return Z}function Lz($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Fz($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Vz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=G1(Z,X),G=k1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function wz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;let Q=k5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=G1(Z,X),G=k1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function Az($){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 Rz($){let Z=$,Y=0;while(Y<Z.length){let X=e1(Z,Y);if(!X)break;if(!kY(X.attrs,"v-once")){Y=X.end;continue}let Q=k1(X.attrs,"v-once"),J=G1(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
2053
2058
  ${b1(G,{...X,start:0,end:X.end-X.start},Q)}
2054
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function Lz($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fz($){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 EY($){if(!Gz($))return $;let Z=$;return Z=Kz(Z),Z=qz(Z),Z=Oz(Z),Z=zz(Z),Z=_z(Z),Z=Uz(Z),Z=Wz(Z),Z=Fz(Z),Z=Bz(Z),Z=jz(Z),Z=Hz(Z),Z=Lz(Z),Z}var Xz,Jz;var DY=k(()=>{Xz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Jz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function T4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function kY($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${T4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let _=U.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Y0(V,Z)}catch{B[O]=V}else B[O]=V}let L=X.componentsDir||"components",F=await t1(z,B,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let _=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${T4(_)} -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}}return J=await Vz(J,Z,Y,X,Q),J}async function Vz($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${T4(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let _=X.componentsDir||"components",B=await t1(z,{},"",_,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}catch(z){let _=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${T4(_)} -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}}return J}var bY=k(()=>{w0();O0()});function SY($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function yY($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=X6($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let _=z[1],B=`${Z}_${_}`;W.set(_,B)}}for(let U of K){let z=PY(U,Z,X,Q,W,G);q.push(z)}return q.join(`
2059
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function Mz($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Nz($){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 bY($){if(!_z($))return $;let Z=$;return Z=Bz(Z),Z=jz(Z),Z=Rz(Z),Z=Lz(Z),Z=Fz(Z),Z=Oz(Z),Z=Hz(Z),Z=Nz(Z),Z=Vz(Z),Z=wz(Z),Z=Az(Z),Z=Mz(Z),Z}var Wz,Uz;var SY=k(()=>{Wz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Uz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function T4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function yY($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${T4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let _=U.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Y0(V,Z)}catch{B[O]=V}else B[O]=V}let L=X.componentsDir||"components",F=await t1(z,B,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let _=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${T4(_)} -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}}return J=await Tz(J,Z,Y,X,Q),J}async function Tz($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${T4(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let _=X.componentsDir||"components",B=await t1(z,{},"",_,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}catch(z){let _=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${T4(_)} -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length)}}return J}var PY=k(()=>{w0();O0()});function CY($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function vY($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=X6($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let _=z[1],B=`${Z}_${_}`;W.set(_,B)}}for(let U of K){let z=xY(U,Z,X,Q,W,G);q.push(z)}return q.join(`
2055
2060
 
2056
2061
  `)}function X6($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,_]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:_.trim()});else if(U==="media"||U==="supports"||U==="container"){let B=X6(_);Z.push({selector:`@${U} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
2057
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:_.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function PY($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=X6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>PY(_,Z,Y,X,Q,J)).join(`
2062
+ `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:_.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function xY($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=X6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>xY(_,Z,Y,X,Q,J)).join(`
2058
2063
  `);return`${G} {
2059
2064
  ${z}
2060
- }`}return`${G} { ${K} }`}let q=wz(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function wz($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=Az(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function Az($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function vY($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function I4($,Z){if(!Rz.test($))return{html:$,hasScoped:!1};let Y=SY(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${J6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=Mz(W,X),z=q.replace(new RegExp(J6,"gi"),"").trim(),_=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${_}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=Tz(Q,X),{html:Q,hasScoped:!0}}function Mz($,Z){return yY($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function Tz($,Z){let Y=X1($,(Q,J)=>{let G=w1(Q,J);return G>J?G:_5(Q,J)},(Q,J)=>Nz(J)),X=Iz(Y.output,Z);return CY.lastIndex=0,X.replace(CY,(Q,J)=>Y.tokens[Number(J)])}function Iz($,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,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var J6,Rz,Nz=($)=>`\x00stx-scope-mask-${$}\x00`,CY;var Q6=k(()=>{l1();J6=String.raw`(?<![\w-])scoped(?![\w-])`,Rz=new RegExp(`<style\\s+[^>]*${J6}`,"i");CY=/\u0000stx-scope-mask-(\d+)\u0000/g});function xY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
2061
- ${$.slice(Z)}`}function Ez($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.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 X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function Dz($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
2065
+ }`}return`${G} { ${K} }`}let q=Iz(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function Iz($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=Ez(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function Ez($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function gY($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function I4($,Z){if(!Dz.test($))return{html:$,hasScoped:!1};let Y=CY(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${J6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=kz(W,X),z=q.replace(new RegExp(J6,"gi"),"").trim(),_=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${_}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=Sz(Q,X),{html:Q,hasScoped:!0}}function kz($,Z){return vY($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function Sz($,Z){let Y=X1($,(Q,J)=>{let G=w1(Q,J);return G>J?G:_5(Q,J)},(Q,J)=>bz(J)),X=yz(Y.output,Z);return fY.lastIndex=0,X.replace(fY,(Q,J)=>Y.tokens[Number(J)])}function yz($,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,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var J6,Dz,bz=($)=>`\x00stx-scope-mask-${$}\x00`,fY;var Q6=k(()=>{l1();J6=String.raw`(?<![\w-])scoped(?![\w-])`,Dz=new RegExp(`<style\\s+[^>]*${J6}`,"i");fY=/\u0000stx-scope-mask-(\d+)\u0000/g});function xz($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass??"dark",Q=$.attribute??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Pz.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto \u2014 got ${JSON.stringify(Y)}`);if(typeof X!=="string"||!vz.test(X))throw Error(`colorMode.darkClass must be a single CSS class name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&(typeof Q!=="string"||!Cz.test(Q)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Q)}`);return{storageKey:Z,initialMode:Y,darkClass:X,attribute:Q}}function fz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function G6($={}){let Z=xz($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${fz(Z)};var p=c.initialMode;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"||v==="auto")p=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)}else 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,preference:p,mode:m}}catch(e){}}());`}</script>`}function hY($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length,Q=$.slice(X),J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(Q);if(J)X+=J[0].length;let G=G6(Z);return`${$.slice(0,X)}
2066
+ ${G}${$.slice(X)}`}var Pz,Cz,vz;var K6=k(()=>{Pz=new Set(["light","dark","auto"]),Cz=/^[a-z][\w:-]*$/i,vz=/^[\w-]+$/});function dY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${uY}
2067
+ ${$.slice(Z)}`}function gz($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.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 X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function hz($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
2062
2068
  `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
2063
2069
  `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([T])=>T!=="content").map(([T,I])=>`${T}="${I}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
2064
- `),F=Object.entries(U).map(([R,N])=>` ${R}="${N}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=Ez($),A=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...w.map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),M=[V,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2070
+ `),F=Object.entries(U).map(([R,N])=>` ${R}="${N}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=gz($),A=[j,Y.colorMode?` ${G6(Y.colorMode)}`:"",` <title>${z}</title>`,` ${uY}`,H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...w.map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),M=[V,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2065
2071
  <html lang="${Q}">
2066
2072
  <head>
2067
2073
  ${A.join(`
@@ -2071,9 +2077,9 @@ ${A.join(`
2071
2077
  ${M.join(`
2072
2078
  `)}
2073
2079
  </body>
2074
- </html>`}function G6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function fY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,_])=>`${z}="${_}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
2080
+ </html>`}function q6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function mY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,_])=>`${z}="${_}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
2075
2081
  `)}
2076
- ${$.slice(Y)}`}function gY($,Z={},Y={}){if(G6($))return $;return Dz($,Z,Y)}function k4($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(m0)X.add(m0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),A$)X.forEach((K)=>D4.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function b4($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,A$)X.forEach((G)=>D4.add(G));else X.forEach((G)=>G())},J=()=>{if(m0)X.add(m0);if(Y){let G=m0;m0=Q,E4.push(Q);try{Z=$()}finally{E4.pop(),m0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function S4($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=m0;m0=Q,E4.push(Q);try{Y=$()}finally{E4.pop(),m0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function K6($){if(A$){$();return}A$=!0;try{$()}finally{A$=!1,D4.forEach((Z)=>Z()),D4.clear()}}function q6($){kz.push($)}function W6($){bz.push($)}function y4($){return typeof $==="function"&&$._isSignal===!0}function P4($){return typeof $==="function"&&$._isDerived===!0}function U6($){if(y4($)||P4($))return $();return $}function C4($){let Z=m0;m0=null;try{return $()}finally{m0=Z}}function Sz($,Z){let Y=typeof $==="function"?$:()=>$,X=k4([]),Q=b4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return S4(()=>{if(Y(),!J){J=!0;return}if(C4(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((_)=>_!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var m0=null,E4,A$=!1,D4,kz,bz;var z6=k(()=>{E4=[],D4=new Set,kz=[],bz=[]});var uY={};t(uY,{useOptimistic:()=>Sz,untrack:()=>U6,state:()=>k4,peek:()=>C4,onMount:()=>q6,onDestroy:()=>W6,isSignal:()=>y4,isDerived:()=>P4,generateSignalsRuntimeDev:()=>v4,generateSignalsRuntime:()=>hY,effect:()=>S4,derived:()=>b4,default:()=>Pz,batch:()=>K6});function hY(){try{let $=yz(v4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return v4()}}function yz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function v4(){return`
2082
+ ${$.slice(Y)}`}function lY($,Z={},Y={}){if(q6($))return $;return hz($,Z,Y)}var uY="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";var pY=k(()=>{K6()});function k4($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(m0)X.add(m0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),A$)X.forEach((K)=>D4.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function b4($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,A$)X.forEach((G)=>D4.add(G));else X.forEach((G)=>G())},J=()=>{if(m0)X.add(m0);if(Y){let G=m0;m0=Q,E4.push(Q);try{Z=$()}finally{E4.pop(),m0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function S4($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=m0;m0=Q,E4.push(Q);try{Y=$()}finally{E4.pop(),m0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function W6($){if(A$){$();return}A$=!0;try{$()}finally{A$=!1,D4.forEach((Z)=>Z()),D4.clear()}}function U6($){uz.push($)}function z6($){dz.push($)}function y4($){return typeof $==="function"&&$._isSignal===!0}function P4($){return typeof $==="function"&&$._isDerived===!0}function _6($){if(y4($)||P4($))return $();return $}function C4($){let Z=m0;m0=null;try{return $()}finally{m0=Z}}function mz($,Z){let Y=typeof $==="function"?$:()=>$,X=k4([]),Q=b4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return S4(()=>{if(Y(),!J){J=!0;return}if(C4(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((_)=>_!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var m0=null,E4,A$=!1,D4,uz,dz;var B6=k(()=>{E4=[],D4=new Set,uz=[],dz=[]});var iY={};t(iY,{useOptimistic:()=>mz,untrack:()=>_6,state:()=>k4,peek:()=>C4,onMount:()=>U6,onDestroy:()=>z6,isSignal:()=>y4,isDerived:()=>P4,generateSignalsRuntimeDev:()=>v4,generateSignalsRuntime:()=>cY,effect:()=>S4,derived:()=>b4,default:()=>pz,batch:()=>W6});function cY(){try{let $=lz(v4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return v4()}}function lz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function v4(){return`
2077
2083
  // STX Signals Runtime (Development Build)
2078
2084
  console.log('[stx] signals runtime loading');
2079
2085
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6427,10 +6433,18 @@ else if (timer === null) {
6427
6433
 
6428
6434
  function useColorMode(options) {
6429
6435
  options = options || {};
6430
- var storageKey = options.storageKey || 'stx-color-mode';
6431
- var initialMode = options.initialMode || 'auto';
6432
- var darkClass = options.darkClass || 'dark';
6433
- var attribute = options.attribute || null;
6436
+ // The pre-paint boot script (stacksjs/stx#1794) publishes the app's
6437
+ // configured options here. Reading them makes a bare useColorMode() agree
6438
+ // with whatever already landed on <html> before first paint \u2014 without this
6439
+ // the composable would fall back to its own defaults, read a different
6440
+ // storage key, and undo the theme on hydration, reintroducing the very
6441
+ // flash the boot script exists to prevent.
6442
+ var boot = null;
6443
+ try { boot = window.__STX_COLOR_MODE__ || null; } catch (e) {}
6444
+ var storageKey = options.storageKey || (boot && boot.storageKey) || 'stx-color-mode';
6445
+ var initialMode = options.initialMode || (boot && boot.initialMode) || 'auto';
6446
+ var darkClass = options.darkClass || (boot && boot.darkClass) || 'dark';
6447
+ var attribute = options.attribute || (boot && boot.attribute) || null;
6434
6448
  var disableTransitions = options.disableTransitions !== false;
6435
6449
  var preference = initialMode;
6436
6450
  var resolved = 'light';
@@ -6596,15 +6610,60 @@ catch (e) {}
6596
6610
  var watch = $watch;
6597
6611
  var watchEffect = function(fn) { return effect(fn); };
6598
6612
 
6613
+ // Storage access is guarded end to end (stacksjs/stx#1793). Every one of
6614
+ // these can throw, and each throw took down the whole client script for the
6615
+ // page rather than just the composable:
6616
+ //
6617
+ // getItem - SecurityError in a sandboxed iframe or with storage disabled
6618
+ // parse - any non-JSON value already sitting at the key
6619
+ // setItem - QuotaExceededError, Safari private mode
6620
+ //
6621
+ // The parse fallback is deliberately LENIENT: a value that isn't JSON is
6622
+ // returned as the raw string rather than discarded for defaultValue. A key
6623
+ // that previously held a bare 'list' keeps reading back 'list' and is
6624
+ // rewritten as JSON on the next set, so migrating an existing key onto this
6625
+ // composable no longer needs the key to be renamed. This also matches
6626
+ // composables/use-storage.ts, whose default serializer already returns the
6627
+ // raw string on parse failure \u2014 the two implementations have to agree.
6628
+ function stxParseStored(raw, fallback, key, label) {
6629
+ if (raw === null || raw === undefined) return fallback;
6630
+ try { return JSON.parse(raw); }
6631
+ catch (e) {
6632
+ console.warn('[stx] ' + label + ': "' + key + '" holds a value that is not JSON (' + String(raw).slice(0, 64) + '); using it as a raw string. Write it with the same composable to store it as JSON.');
6633
+ return raw;
6634
+ }
6635
+ }
6636
+ function stxStorageRead(store, key, fallback, label) {
6637
+ var raw;
6638
+ try { raw = store.getItem(key); }
6639
+ catch (e) {
6640
+ console.warn('[stx] ' + label + ': cannot read "' + key + '" (' + (e && e.message ? e.message : e) + '); using the default.');
6641
+ return fallback;
6642
+ }
6643
+ return stxParseStored(raw, fallback, key, label);
6644
+ }
6645
+ function stxStorageWrite(store, key, value, label) {
6646
+ try { store.setItem(key, JSON.stringify(value)); }
6647
+ catch (e) {
6648
+ console.warn('[stx] ' + label + ': cannot persist "' + key + '" (' + (e && e.message ? e.message : e) + '); the value stays in memory only.');
6649
+ }
6650
+ }
6651
+
6599
6652
  function useLocalStorage(key, defaultValue) {
6600
- var stored = localStorage.getItem(key);
6601
- var initial = stored !== null ? JSON.parse(stored) : defaultValue;
6602
- var s = state(initial);
6653
+ var s = state(stxStorageRead(localStorage, key, defaultValue, 'useLocalStorage'));
6603
6654
  effect(function() {
6604
- localStorage.setItem(key, JSON.stringify(s()));
6655
+ stxStorageWrite(localStorage, key, s(), 'useLocalStorage');
6605
6656
  });
6606
6657
  var handler = function(e) {
6607
- if (e.key === key) s.set(e.newValue !== null ? JSON.parse(e.newValue) : defaultValue);
6658
+ // Fires from ANOTHER tab at an arbitrary later time, so an unguarded
6659
+ // parse here throws inside a window listener with a stack pointing at
6660
+ // the runtime rather than at the consumer.
6661
+ // storageArea is also matched so a sessionStorage write to the same key
6662
+ // name can't clobber this signal \u2014 useSessionStorage already filtered,
6663
+ // this side didn't. Synthetic events (tests) leave storageArea null and
6664
+ // are still accepted; real browsers always populate it.
6665
+ if (e.key === key && (!e.storageArea || e.storageArea === localStorage))
6666
+ s.set(stxParseStored(e.newValue, defaultValue, key, 'useLocalStorage'));
6608
6667
  };
6609
6668
  window.addEventListener('storage', handler);
6610
6669
  onDestroy(function() { window.removeEventListener('storage', handler); });
@@ -6618,15 +6677,13 @@ catch (e) {}
6618
6677
  // event (filtered to sessionStorage's storageArea \u2014 localStorage events
6619
6678
  // share the same listener but fire from a different area).
6620
6679
  function useSessionStorage(key, defaultValue) {
6621
- var stored = sessionStorage.getItem(key);
6622
- var initial = stored !== null ? JSON.parse(stored) : defaultValue;
6623
- var s = state(initial);
6680
+ var s = state(stxStorageRead(sessionStorage, key, defaultValue, 'useSessionStorage'));
6624
6681
  effect(function() {
6625
- sessionStorage.setItem(key, JSON.stringify(s()));
6682
+ stxStorageWrite(sessionStorage, key, s(), 'useSessionStorage');
6626
6683
  });
6627
6684
  var handler = function(e) {
6628
- if (e.key === key && e.storageArea === sessionStorage)
6629
- s.set(e.newValue !== null ? JSON.parse(e.newValue) : defaultValue);
6685
+ if (e.key === key && (!e.storageArea || e.storageArea === sessionStorage))
6686
+ s.set(stxParseStored(e.newValue, defaultValue, key, 'useSessionStorage'));
6630
6687
  };
6631
6688
  window.addEventListener('storage', handler);
6632
6689
  onDestroy(function() { window.removeEventListener('storage', handler); });
@@ -8632,25 +8689,25 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8632
8689
  }
8633
8690
  }
8634
8691
  })();
8635
- `}var Pz;var dY=k(()=>{z6();z6();Pz={state:k4,derived:b4,effect:S4,batch:K6,onMount:q6,onDestroy:W6,isSignal:y4,isDerived:P4,untrack:U6,peek:C4,generateSignalsRuntime:hY,generateSignalsRuntimeDev:v4}});var _6={};t(_6,{templateCache:()=>mY,readFileCached:()=>Cz,invalidateFileCacheByDir:()=>xz,invalidateFileCache:()=>vz,hashFilePath:()=>R$,getCachedSignalsRuntime:()=>hz,getCachedRouterScript:()=>uz,clearDevCaches:()=>dz,checkCache:()=>mz,cacheTemplate:()=>lz,__setSignalsGeneratorsForTest:()=>gz});import S1 from"fs";import b5 from"path";async function Cz($){let Y;for(let X=0;X<3;X++)try{let J=(await S1.promises.stat($)).mtime.getTime(),G=$5.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await S1.promises.stat($)).mtime.getTime();if(W!==J)continue;return $5.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw $5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function vz($){$5.delete($)}function xz($){for(let Z of $5.keys())if(Z.startsWith($))$5.delete(Z)}function gz($){lY=$}async function hz($=!1){let Z=lY??await Promise.resolve().then(() => (dY(),uY));if($)return Z.generateSignalsRuntimeDev();if(x4===null)x4=Z.generateSignalsRuntime();return x4}async function uz(){if(f4===null){let{getRouterScript:$}=await import("stx-router");f4=$()}return f4}function dz(){$5.clear(),cY(),x4=null,fz=null,f4=null}function pY($){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 mz($,Z){try{if(!Z.cachePath)return null;let Y=b5.resolve(Z.cachePath),X=b5.join(Y,`${R$($)}.html`),Q=b5.join(Y,`${R$($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==pY(Z))return null;if((await S1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await S1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function lz($,Z,Y,X){try{if(!X.cachePath)return;let Q=b5.resolve(X.cachePath);await S1.promises.mkdir(Q,{recursive:!0});let J=b5.join(Q,`${R$($)}.html`),G=b5.join(Q,`${R$($)}.meta.json`),K=await S1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:pY(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),mY.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function R$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,pz)}var mY,$5,x4=null,fz=null,lY=null,f4=null,pz=16;var B6=k(()=>{w0();mY=new Map,$5=new Map});async function iY($,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>
8692
+ `}var pz;var nY=k(()=>{B6();B6();pz={state:k4,derived:b4,effect:S4,batch:W6,onMount:U6,onDestroy:z6,isSignal:y4,isDerived:P4,untrack:_6,peek:C4,generateSignalsRuntime:cY,generateSignalsRuntimeDev:v4}});var j6={};t(j6,{templateCache:()=>sY,readFileCached:()=>cz,invalidateFileCacheByDir:()=>nz,invalidateFileCache:()=>iz,hashFilePath:()=>R$,getCachedSignalsRuntime:()=>oz,getCachedRouterScript:()=>az,clearDevCaches:()=>tz,checkCache:()=>ez,cacheTemplate:()=>$_,__setSignalsGeneratorsForTest:()=>rz});import S1 from"fs";import b5 from"path";async function cz($){let Y;for(let X=0;X<3;X++)try{let J=(await S1.promises.stat($)).mtime.getTime(),G=$5.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await S1.promises.stat($)).mtime.getTime();if(W!==J)continue;return $5.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw $5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function iz($){$5.delete($)}function nz($){for(let Z of $5.keys())if(Z.startsWith($))$5.delete(Z)}function rz($){rY=$}async function oz($=!1){let Z=rY??await Promise.resolve().then(() => (nY(),iY));if($)return Z.generateSignalsRuntimeDev();if(x4===null)x4=Z.generateSignalsRuntime();return x4}async function az(){if(f4===null){let{getRouterScript:$}=await import("stx-router");f4=$()}return f4}function tz(){$5.clear(),aY(),x4=null,sz=null,f4=null}function oY($){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 ez($,Z){try{if(!Z.cachePath)return null;let Y=b5.resolve(Z.cachePath),X=b5.join(Y,`${R$($)}.html`),Q=b5.join(Y,`${R$($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==oY(Z))return null;if((await S1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await S1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function $_($,Z,Y,X){try{if(!X.cachePath)return;let Q=b5.resolve(X.cachePath);await S1.promises.mkdir(Q,{recursive:!0});let J=b5.join(Q,`${R$($)}.html`),G=b5.join(Q,`${R$($)}.meta.json`),K=await S1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:oY(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),sY.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function R$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Z_)}var sY,$5,x4=null,sz=null,rY=null,f4=null,Z_=16;var H6=k(()=>{w0();sY=new Map,$5=new Map});async function tY($,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>
8636
8693
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8637
8694
  `+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
8638
8695
  `+$}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>
8639
8696
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8640
8697
  `+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8641
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (B6(),_6)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8698
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (H6(),j6)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8642
8699
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
8643
8700
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8644
8701
  `+Q+$.slice(K+1)}return Q+`
8645
- `+$}async function j6($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8646
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (B6(),_6)),J=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 Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8647
- </body>`+$.slice(G+7)}var d4={};t(d4,{scanScriptTags:()=>eY,rewriteStxImportSpecifiers:()=>XX,processSignals:()=>V6,processScriptSetup:()=>ZX,preEvalLiteralReactiveIfs:()=>L6,parseLoopExpression:()=>$X,hasSignalsSyntax:()=>u4,findMarkupIndexOutsideScripts:()=>h4,extractExports:()=>YX,convertSignalLoopsToAttributes:()=>F6,convertSignalDirectivesToAttributes:()=>O6});function eY($,Z={}){let Y=[];for(let X of C7($,w1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function $X($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=sY(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=sY(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function sY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function u4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function iz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function nz($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function sz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function rY($,Z,Y){if(!$)return!1;let X=sz($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let _=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(oY.has(_))continue;if(Z.has(_))Q=!0;else if(Y&&_ in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let _=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(oY.has(_)||Y&&_ in Y)continue;G=!0}return(Q||G)&&!J}function g4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(tY);if(J&&oz(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function oz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function O6($,Z){let Y=nz($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,_=U;while(_<J.length&&z>0){if(J[_]==="(")z++;else if(J[_]===")")z--;_++}if(z!==0)continue;let B=J.substring(U,_-1).trim(),j=_,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),w;if(iz(V)){let A=W$(J.substring(W,L));if(A.length===0)continue;let M=A[0].branches.filter((T)=>T.type!=="else");if(!(M.length>0&&M.every((T)=>rY(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=X(T.content);if(T.type==="elseif")return g4(I,"@else-if",T.condition??"");if(T.type==="else")return g4(I,"@else");return g4(I,"@if",T.condition??"")}).join(`
8648
- `)}else{if(!rY(B,Y,Z))continue;w=g4(X(V),"@if",B)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:_}=q[W];J=J.substring(0,U)+_+J.substring(z)}return J}return X($)}function rz($){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 Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function az($,Z,Y,X){if(H6.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===Q){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let _=$.indexOf(">",q);if(_===-1)return-1;if(z[1].toLowerCase()===Q){let B=$.slice(q,_+1);if(!(/\/\s*>$/.test(B)||H6.has(Q)))K++}q=_+1}return-1}function ez($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)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 Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return tz.test(J)}function L6($){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,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([_,B])=>z>=_&&z<B),J=/<([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=J.exec($))!==null){if(Q(K.index))continue;let[z,_,B,j,H,L,F]=K,O=rz(H);if(O===void 0)continue;let V=K.index,w=V+z.length,R=!!F||/\/\s*>$/.test(z)||H6.has(_.toLowerCase())?w:az($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&ez($,R)){J.lastIndex=w;continue}if(O===!0){let T=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:T});continue}G.push({start:V,end:R,replacement:""}),J.lastIndex=R}if(G.length===0)return $;G.sort((z,_)=>z.start-_.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:_,end:B,replacement:j}=q[z];U=U.substring(0,_)+j+U.substring(B)}return U}function F6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),_=U,B=$X(z);if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M))continue;if(Z){let R=M.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")z=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(tY),A;if(w){let[,M,R,N]=w;A=`<${M}${R} @for="${z}">${N}</${M}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function $_($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let _=$[z];if(_==="\\"){z+=2;continue}if(_===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8702
+ `+$}async function O6($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8703
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (H6(),j6)),J=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 Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8704
+ </body>`+$.slice(G+7)}var d4={};t(d4,{scanScriptTags:()=>QX,rewriteStxImportSpecifiers:()=>WX,processSignals:()=>A6,processScriptSetup:()=>KX,preEvalLiteralReactiveIfs:()=>V6,parseLoopExpression:()=>GX,hasSignalsSyntax:()=>u4,findMarkupIndexOutsideScripts:()=>h4,extractExports:()=>qX,convertSignalLoopsToAttributes:()=>w6,convertSignalDirectivesToAttributes:()=>F6});function QX($,Z={}){let Y=[];for(let X of C7($,w1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function GX($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=$X(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=$X(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function $X($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function u4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function X_($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function J_($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function Q_($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function YX($,Z,Y){if(!$)return!1;let X=Q_($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let _=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(ZX.has(_))continue;if(Z.has(_))Q=!0;else if(Y&&_ in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let _=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(ZX.has(_)||Y&&_ in Y)continue;G=!0}return(Q||G)&&!J}function g4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(JX);if(J&&G_(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function G_($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function F6($,Z){let Y=J_($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,_=U;while(_<J.length&&z>0){if(J[_]==="(")z++;else if(J[_]===")")z--;_++}if(z!==0)continue;let B=J.substring(U,_-1).trim(),j=_,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),w;if(X_(V)){let A=W$(J.substring(W,L));if(A.length===0)continue;let M=A[0].branches.filter((T)=>T.type!=="else");if(!(M.length>0&&M.every((T)=>YX(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=X(T.content);if(T.type==="elseif")return g4(I,"@else-if",T.condition??"");if(T.type==="else")return g4(I,"@else");return g4(I,"@if",T.condition??"")}).join(`
8705
+ `)}else{if(!YX(B,Y,Z))continue;w=g4(X(V),"@if",B)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:_}=q[W];J=J.substring(0,U)+_+J.substring(z)}return J}return X($)}function K_($){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 Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function q_($,Z,Y,X){if(L6.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===Q){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let _=$.indexOf(">",q);if(_===-1)return-1;if(z[1].toLowerCase()===Q){let B=$.slice(q,_+1);if(!(/\/\s*>$/.test(B)||L6.has(Q)))K++}q=_+1}return-1}function U_($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)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 Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return W_.test(J)}function V6($){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,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([_,B])=>z>=_&&z<B),J=/<([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=J.exec($))!==null){if(Q(K.index))continue;let[z,_,B,j,H,L,F]=K,O=K_(H);if(O===void 0)continue;let V=K.index,w=V+z.length,R=!!F||/\/\s*>$/.test(z)||L6.has(_.toLowerCase())?w:q_($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&U_($,R)){J.lastIndex=w;continue}if(O===!0){let T=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:T});continue}G.push({start:V,end:R,replacement:""}),J.lastIndex=R}if(G.length===0)return $;G.sort((z,_)=>z.start-_.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:_,end:B,replacement:j}=q[z];U=U.substring(0,_)+j+U.substring(B)}return U}function w6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),_=U,B=GX(z);if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M))continue;if(Z){let R=M.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")z=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(JX),A;if(w){let[,M,R,N]=w;A=`<${M}${R} @for="${z}">${N}</${M}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function z_($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let _=$[z];if(_==="\\"){z+=2;continue}if(_===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8649
8706
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,_=0;while(z<J){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
8650
- `)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){_++,z++;continue}if(B===")"||B==="]"||B==="}"){_--,z++;continue}if(B===";"&&_===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(X+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function ZX($,Z,Y){let X=eY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\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*\(/,J=[];for(let L of X){let F=L.body;if(d1(L.attrs))F=m1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${cz++}`,{hasUserImports:K,bundleClientScript:q}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5))),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=U5(F).code,K(F))F=await q(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)=>XX(w));let O=a0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8707
+ `)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){_++,z++;continue}if(B===")"||B==="]"||B==="}"){_--,z++;continue}if(B===";"&&_===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(X+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function KX($,Z,Y){let X=QX($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\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*\(/,J=[];for(let L of X){let F=L.body;if(d1(L.attrs))F=m1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Y_++}`,{hasUserImports:K,bundleClientScript:q}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5))),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=U5(F).code,K(F))F=await q(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)=>WX(w));let O=a0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8651
8708
  ${O}`)}let U=W.join(`
8652
8709
 
8653
- `);U=$_(U);let z=YX(U),_=z.split(",").map((L)=>L.trim()).filter(Boolean),B=f$(U,Y),j=`
8710
+ `);U=z_(U);let z=qX(U),_=z.split(",").map((L)=>L.trim()).filter(Boolean),B=f$(U,Y),j=`
8654
8711
  <script data-stx-scoped>
8655
8712
  function ${G}() {
8656
8713
  ${j5("const",_)}
@@ -8659,28 +8716,28 @@ ${B}${U}
8659
8716
  }
8660
8717
  window.__stx_latestSetup=${G};
8661
8718
  if(window.stx)window.stx._latestSetup=${G};
8662
- </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${nY})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${nY})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:j}}function YX($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8719
+ </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${eY})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${eY})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:j}}function qX($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8663
8720
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},_=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8664
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))B();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function V6($,Z,Y,X){if(!u4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await ZX(Q,Y,X);if(Q=J,Q=await iY(Q,Z),G){let U=h4(Q,/<\/head>/i),z=U===-1?h4(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8721
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(_())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))B();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function A6($,Z,Y,X){if(!u4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await KX(Q,Y,X);if(Q=J,Q=await tY(Q,Z),G){let U=h4(Q,/<\/head>/i),z=U===-1?h4(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8665
8722
  ${Q.slice(U)}`;else if(z!==-1){let _=/<body[^>]*>/i.exec(Q.slice(z))[0],B=z+_.length;Q=`${Q.slice(0,B)}
8666
8723
  ${G}${Q.slice(B)}`}else Q=`${Q}
8667
- ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=h4(Q,U);if(z!==-1){let _=Q.slice(0,z),B=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=_+B}}return Q}function h4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function XX($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return aY;return`var ${Z.join(", ")}; ${aY}`}var cz=0,nY=`(?:"[^"]*"|'[^']*'|[^>"'])*`,tY,oY,H6,tz,aY="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var M$=k(()=>{z5();Y4();Q$();w0();l1();n5();tY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;oY=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"]);H6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);tz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import S5 from"path";function JX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function QX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=S5.join(Q,$);if(await Bun.file(G).exists())return G;Q=S5.dirname(Q)}X=S5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=S5.resolve(Z,$);else X=S5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function GX($,Z,Y){let X=$,Q=S5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,_]=G;if(JX(z))continue;let B=await QX(z,Q,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:c0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8724
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=h4(Q,U);if(z!==-1){let _=Q.slice(0,z),B=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=_+B}}return Q}function h4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function WX($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return XX;return`var ${Z.join(", ")}; ${XX}`}var Y_=0,eY=`(?:"[^"]*"|'[^']*'|[^>"'])*`,JX,ZX,L6,W_,XX="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var M$=k(()=>{z5();Y4();Q$();w0();l1();n5();JX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;ZX=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"]);L6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);W_=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import S5 from"path";function UX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function zX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=S5.join(Q,$);if(await Bun.file(G).exists())return G;Q=S5.dirname(Q)}X=S5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=S5.resolve(Z,$);else X=S5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function _X($,Z,Y){let X=$,Q=S5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,_]=G;if(UX(z))continue;let B=await zX(z,Q,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:c0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8668
8725
  // Source: ${z}
8669
8726
  ${j}
8670
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,_]=q,B=U+_;if(JX(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let H=await QX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8727
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,_]=q,B=U+_;if(UX(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let H=await zX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8671
8728
  /* Source: ${z} */
8672
8729
  ${L}
8673
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var KX=k(()=>{x1()});function w6($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),_=Y.substring(J,q+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(K0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let M=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+M+Y.substring(q+1),X.lastIndex=J+M.length}catch(V){Z1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+_.length}}return Y}function A6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function qX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),_=z.indexOf("@endmemo");if(_===-1)continue;let B=z.slice(0,_),j=U+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),M;if(A){let[R,N,T="",I]=A,D=`<${N}${T} data-stx-memo="${W}"${I}>`;M=B.slice(0,L)+D+w.slice(R.length)+B.slice(L+w.length)}else M=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;Q.push({start:J,end:j,replacement:M}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function R6($){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 WX($){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"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let _=$.slice(U+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function UX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Z_.test(z))continue;let _=$[U-1]==="/",B=_?U-1:U;Y+=`${$.slice(X,B)} x-cloak${_?" ":""}`,X=B}return Y+=$.slice(X),Y}var Z_;var M6=k(()=>{B1();O0();Z_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function N6($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Y_){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
8730
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var BX=k(()=>{x1()});function R6($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),_=Y.substring(J,q+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(K0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let M=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+M+Y.substring(q+1),X.lastIndex=J+M.length}catch(V){Z1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+_.length}}return Y}function M6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),_=z.indexOf("@endmemo");if(_===-1)continue;let B=z.slice(0,_),j=U+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),M;if(A){let[R,N,T="",I]=A,D=`<${N}${T} data-stx-memo="${W}"${I}>`;M=B.slice(0,L)+D+w.slice(R.length)+B.slice(L+w.length)}else M=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;Q.push({start:J,end:j,replacement:M}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function N6($){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 HX($){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"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let _=$.slice(U+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function OX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!__.test(z))continue;let _=$[U-1]==="/",B=_?U-1:U;Y+=`${$.slice(X,B)} x-cloak${_?" ":""}`,X=B}return Y+=$.slice(X),Y}var __;var T6=k(()=>{B1();O0();__=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function I6($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of B_){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
8674
8731
  `),z=[];U.forEach((B,j)=>{if(G.lastIndex=0,G.test(B))z.push(j+1)});let _=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${_}
8675
8732
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8676
8733
  ${J.join(`
8677
8734
  `)}
8678
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Y_;var T6=k(()=>{Y_=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var zX={};t(zX,{getStoreScript:()=>X_,clearStoreCache:()=>J_});import m4 from"path";async function X_($){let Z;if($)Z=m4.resolve($);else{let U=await P5();Z=m4.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=m4.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return y5.set(Z,""),null}if(Q.length===0)return y5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()});for(let U of G)try{let z=await Bun.file(U).text(),_=m4.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${_}
8735
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var B_;var E6=k(()=>{B_=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var LX={};t(LX,{getStoreScript:()=>j_,clearStoreCache:()=>H_});import m4 from"path";async function j_($){let Z;if($)Z=m4.resolve($);else{let U=await P5();Z=m4.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=m4.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return y5.set(Z,""),null}if(Q.length===0)return y5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()});for(let U of G)try{let z=await Bun.file(U).text(),_=m4.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${_}
8679
8736
  ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return y5.set(Z,""),null;let W=`;(function(){
8680
8737
  ${K.join(`
8681
8738
 
8682
8739
  `)}
8683
- })();`;return y5.set(Z,W),W}function J_(){y5.clear()}var y5;var _X=k(()=>{c1();x1();y5=new Map});var jX={};t(jX,{getComposableScript:()=>q_,clearComposableCache:()=>W_});import N$ from"path";function BX($){let Z=N$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function G_($){if($)return N$.resolve($);let Z=`<default>:${process.cwd()}`,Y=I6.get(Z);if(Y!==void 0)return Y;let X=await K_();return I6.set(Z,X),X}async function K_(){let $=await P5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return N$.resolve(Z,Y);for(let X of Q_){let Q=N$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!BX(G))return Q}catch{}}return null}async function q_($){let Z=await G_($);if(!Z)return null;let Y=C5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let B=new Bun.Glob("**/*.ts");for await(let j of B.scan({cwd:Z,absolute:!0})){if(BX(j))continue;X.push(j)}}catch{return C5.set(Z,""),null}if(X.length===0)return C5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),J=[],G=new Set,K=new Set;for(let B of X)try{let j=await Bun.file(B).text(),H=N$.basename(B,".ts");for(let L of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(j).exports)if(L!=="default")G.add(L)}catch{}j=a0(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=Q.transformSync(j),J.push(`// Composable: ${H}
8740
+ })();`;return y5.set(Z,W),W}function H_(){y5.clear()}var y5;var FX=k(()=>{c1();x1();y5=new Map});var wX={};t(wX,{getComposableScript:()=>V_,clearComposableCache:()=>w_});import N$ from"path";function VX($){let Z=N$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function L_($){if($)return N$.resolve($);let Z=`<default>:${process.cwd()}`,Y=D6.get(Z);if(Y!==void 0)return Y;let X=await F_();return D6.set(Z,X),X}async function F_(){let $=await P5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return N$.resolve(Z,Y);for(let X of O_){let Q=N$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!VX(G))return Q}catch{}}return null}async function V_($){let Z=await L_($);if(!Z)return null;let Y=C5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let B=new Bun.Glob("**/*.ts");for await(let j of B.scan({cwd:Z,absolute:!0})){if(VX(j))continue;X.push(j)}}catch{return C5.set(Z,""),null}if(X.length===0)return C5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),J=[],G=new Set,K=new Set;for(let B of X)try{let j=await Bun.file(B).text(),H=N$.basename(B,".ts");for(let L of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(j).exports)if(L!=="default")G.add(L)}catch{}j=a0(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=Q.transformSync(j),J.push(`// Composable: ${H}
8684
8741
  ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${B}:`,j)}if(J.length===0||G.size===0)return C5.set(Z,""),null;let q=[...G].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
8685
8742
  `),W=JSON.stringify([...G]),U=J.join(`
8686
8743
 
@@ -8705,7 +8762,7 @@ ${q}
8705
8762
  }
8706
8763
  window[__n] = __c[__n];
8707
8764
  }
8708
- })();`;return C5.set(Z,_),_}function W_(){C5.clear(),I6.clear()}var C5,I6,Q_;var HX=k(()=>{c1();x1();Q$();C5=new Map,I6=new Map,Q_=["composables","functions"]});var LX={};t(LX,{processDeferDirectives:()=>j_});function U_(){return`stx-defer-${++OX}`}function z_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function __($,Z,Y){let{trigger:X,value:Q}=z_(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function B_($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
8765
+ })();`;return C5.set(Z,_),_}function w_(){C5.clear(),D6.clear()}var C5,D6,O_;var AX=k(()=>{c1();x1();Q$();C5=new Map,D6=new Map,O_=["composables","functions"]});var MX={};t(MX,{processDeferDirectives:()=>T_});function A_(){return`stx-defer-${++RX}`}function R_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function M_($,Z,Y){let{trigger:X,value:Q}=R_(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function N_($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
8709
8766
  const observer = new IntersectionObserver((entries) => {
8710
8767
  if (entries[0].isIntersecting) {
8711
8768
  observer.disconnect();
@@ -8778,7 +8835,7 @@ else {
8778
8835
  ${Q}
8779
8836
  })();
8780
8837
  </script>
8781
- `}function j_($,Z,Y){OX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=U_(),q=__(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",_=`<div data-defer-content style="display: none;">${q.content}</div>`,B=B_(K,q);return`
8838
+ `}function T_($,Z,Y){RX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=A_(),q=M_(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",_=`<div data-defer-content style="display: none;">${q.content}</div>`,B=N_(K,q);return`
8782
8839
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
8783
8840
  ${W}
8784
8841
  ${U}
@@ -8786,7 +8843,7 @@ else {
8786
8843
  ${z}
8787
8844
  </div>
8788
8845
  ${B}
8789
- `})}var OX=0;var VX={};t(VX,{processTeleportDirectives:()=>F_,ensureTeleportTargets:()=>V_});function H_(){return`stx-teleport-${++FX}`}function O_($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function L_($,Z){return`
8846
+ `})}var RX=0;var TX={};t(TX,{processTeleportDirectives:()=>k_,ensureTeleportTargets:()=>b_});function I_(){return`stx-teleport-${++NX}`}function E_($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function D_($,Z){return`
8790
8847
  <script>
8791
8848
  (function() {
8792
8849
  const source = document.getElementById('${$}');
@@ -8832,12 +8889,12 @@ else {
8832
8889
  });
8833
8890
  })();
8834
8891
  </script>
8835
- `}function F_($,Z,Y){FX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=H_(),{target:q,disabled:W}=O_(J),U=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=L_(K,q);return`
8892
+ `}function k_($,Z,Y){NX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=I_(),{target:q,disabled:W}=E_(J),U=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=D_(K,q);return`
8836
8893
  <div id="${K}" class="stx-teleport-source" style="display: none;">
8837
8894
  <template>${U}</template>
8838
8895
  </div>
8839
8896
  ${z}
8840
- `})}function V_(){return`
8897
+ `})}function b_(){return`
8841
8898
  <script>
8842
8899
  (function() {
8843
8900
  // Common teleport targets
@@ -8854,7 +8911,7 @@ else {
8854
8911
  });
8855
8912
  })();
8856
8913
  </script>
8857
- `}var FX=0;var MX={};t(MX,{processTransitionDirectives:()=>M_,processTransitionAttributes:()=>E_,performLeave:()=>R_,performEnter:()=>A_,generateTransitionRuntime:()=>I_,generateTransitionCSS:()=>T_});function wX($,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 w_($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function AX($,Z){return new Promise((Y)=>{let X=Z??w_($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function RX($){$.offsetHeight}async function A_($,Z={}){let Y=Z.name||"stx",X=wX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),RX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await AX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function R_($,Z={}){let Y=Z.name||"stx",X=wX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),RX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await AX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function M_($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=N_(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8914
+ `}var NX=0;var kX={};t(kX,{processTransitionDirectives:()=>C_,processTransitionAttributes:()=>g_,performLeave:()=>P_,performEnter:()=>y_,generateTransitionRuntime:()=>f_,generateTransitionCSS:()=>x_});function IX($,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 S_($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function EX($,Z){return new Promise((Y)=>{let X=Z??S_($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function DX($){$.offsetHeight}async function y_($,Z={}){let Y=Z.name||"stx",X=IX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),DX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await EX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function P_($,Z={}){let Y=Z.name||"stx",X=IX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),DX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await EX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function C_($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=v_(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8858
8915
  <div
8859
8916
  class="stx-transition-wrapper"
8860
8917
  data-transition="${q}"
@@ -8896,7 +8953,7 @@ else {
8896
8953
  });
8897
8954
  })();
8898
8955
  </script>
8899
- `})}function N_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function T_(){return`
8956
+ `})}function v_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function x_(){return`
8900
8957
  /* STX Transition Presets */
8901
8958
 
8902
8959
  /* Fade */
@@ -9083,7 +9140,7 @@ else {
9083
9140
  opacity: 1;
9084
9141
  max-height: 1000px;
9085
9142
  }
9086
- `}function I_(){return`
9143
+ `}function f_(){return`
9087
9144
  // STX Transition Runtime
9088
9145
  (function() {
9089
9146
  if (typeof window === 'undefined') return;
@@ -9172,7 +9229,7 @@ else {
9172
9229
 
9173
9230
  console.log('[stx] Transition runtime initialized');
9174
9231
  })();
9175
- `}function E_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var TX={};t(TX,{withErrorBoundary:()=>NX,processErrorBoundaryDirectives:()=>b_,generateErrorBoundaryRuntime:()=>v_,generateErrorBoundaryCSS:()=>C_,createErrorBoundary:()=>P_});function k_(){return`eb-${++D_}-${Date.now().toString(36)}`}function b_($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=k_(),W=S_(J||"");return y_(q,G.trim(),K.trim(),W)})}function S_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function y_($,Z,Y,X){let Q=X.logErrors!==!1;return`
9232
+ `}function g_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var SX={};t(SX,{withErrorBoundary:()=>bX,processErrorBoundaryDirectives:()=>d_,generateErrorBoundaryRuntime:()=>i_,generateErrorBoundaryCSS:()=>c_,createErrorBoundary:()=>p_});function u_(){return`eb-${++h_}-${Date.now().toString(36)}`}function d_($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=u_(),W=m_(J||"");return l_(q,G.trim(),K.trim(),W)})}function m_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function l_($,Z,Y,X){let Q=X.logErrors!==!1;return`
9176
9233
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
9177
9234
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
9178
9235
  ${Z}
@@ -9292,7 +9349,7 @@ else {
9292
9349
  };
9293
9350
  })();
9294
9351
  </script>
9295
- `}async function NX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function P_($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>NX(X,$,Y)}function C_(){return`
9352
+ `}async function bX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function p_($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>bX(X,$,Y)}function c_(){return`
9296
9353
  /* STX Error Boundary Styles */
9297
9354
  .stx-error-boundary {
9298
9355
  position: relative;
@@ -9336,7 +9393,7 @@ else {
9336
9393
  color: #fecaca;
9337
9394
  }
9338
9395
  }
9339
- `}function v_(){return`
9396
+ `}function i_(){return`
9340
9397
  // STX Error Boundary Runtime
9341
9398
  (function() {
9342
9399
  if (typeof window === 'undefined') return;
@@ -9401,7 +9458,7 @@ else {
9401
9458
 
9402
9459
  console.log('[stx] Error boundary runtime initialized');
9403
9460
  })();
9404
- `}var D_=0;var IX={};t(IX,{renderSSRSuspense:()=>m_,processSuspenseDirectives:()=>g_,generateSuspenseRuntime:()=>p_,generateSuspenseCSS:()=>l_,createSSRSuspense:()=>d_});function f_(){return`suspense-${++x_}-${Date.now().toString(36)}`}function g_($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=f_(),W=h_(J||"");return u_(q,G.trim(),K.trim(),W)})}function h_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function u_($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
9461
+ `}var h_=0;var yX={};t(yX,{renderSSRSuspense:()=>e_,processSuspenseDirectives:()=>r_,generateSuspenseRuntime:()=>ZB,generateSuspenseCSS:()=>$B,createSSRSuspense:()=>t_});function s_(){return`suspense-${++n_}-${Date.now().toString(36)}`}function r_($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=s_(),W=o_(J||"");return a_(q,G.trim(),K.trim(),W)})}function o_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function a_($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
9405
9462
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
9406
9463
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
9407
9464
  ${Y}
@@ -9591,7 +9648,7 @@ else {
9591
9648
  }, 0);
9592
9649
  })();
9593
9650
  </script>
9594
- `}function d_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function m_($){let Z=$.map((X)=>`
9651
+ `}function t_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function e_($){let Z=$.map((X)=>`
9595
9652
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
9596
9653
  ${X.fallback}
9597
9654
  </div>
@@ -9616,7 +9673,7 @@ else {
9616
9673
  }
9617
9674
  })();
9618
9675
  </script>
9619
- `}}return{initial:Z,streaming:Y()}}function l_(){return`
9676
+ `}}return{initial:Z,streaming:Y()}}function $B(){return`
9620
9677
  /* STX Suspense Styles */
9621
9678
  .stx-suspense {
9622
9679
  position: relative;
@@ -9672,7 +9729,7 @@ else {
9672
9729
  background-size: 200% 100%;
9673
9730
  }
9674
9731
  }
9675
- `}function p_(){return`
9732
+ `}function ZB(){return`
9676
9733
  // STX Suspense Runtime
9677
9734
  (function() {
9678
9735
  if (typeof window === 'undefined') return;
@@ -9739,7 +9796,7 @@ else {
9739
9796
 
9740
9797
  console.log('[stx] Suspense runtime initialized');
9741
9798
  })();
9742
- `}var x_=0;var bX={};t(bX,{processAsyncDirectives:()=>i_,isAsyncComponent:()=>s_,generateAsyncComponentRuntime:()=>r_,generateAsyncComponentCSS:()=>o_,defineAsyncComponent:()=>n_});function EX(){return`async-${++c_}-${Date.now().toString(36)}`}function i_($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=EX(),z=DX(K);return kX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=EX(),U=DX(K);return kX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function DX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||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=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function kX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
9799
+ `}var n_=0;var xX={};t(xX,{processAsyncDirectives:()=>XB,isAsyncComponent:()=>QB,generateAsyncComponentRuntime:()=>KB,generateAsyncComponentCSS:()=>GB,defineAsyncComponent:()=>JB});function PX(){return`async-${++YB}-${Date.now().toString(36)}`}function XB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=PX(),z=CX(K);return vX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=PX(),U=CX(K);return vX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function CX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||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=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function vX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
9743
9800
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
9744
9801
  <div class="stx-async-loading" data-async-loading="${$}">
9745
9802
  ${Y}
@@ -9966,7 +10023,7 @@ catch (error) {
9966
10023
  loadComponent();
9967
10024
  })();
9968
10025
  </script>
9969
- `}function n_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function s_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function o_(){return`
10026
+ `}function JB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function QB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function GB(){return`
9970
10027
  /* STX Async Component Styles */
9971
10028
  .stx-async-component {
9972
10029
  position: relative;
@@ -10040,7 +10097,7 @@ catch (error) {
10040
10097
  background-size: 200% 100%;
10041
10098
  }
10042
10099
  }
10043
- `}function r_(){return`
10100
+ `}function KB(){return`
10044
10101
  // STX Async Component Runtime
10045
10102
  (function() {
10046
10103
  if (typeof window === 'undefined') return;
@@ -10094,7 +10151,7 @@ catch (error) {
10094
10151
 
10095
10152
  console.log('[stx] Async component runtime initialized');
10096
10153
  })();
10097
- `}var c_=0;var yX={};t(yX,{shouldCacheComponent:()=>YB,processKeepAliveDirectives:()=>t_,onDeactivated:()=>GB,onActivated:()=>QB,generateKeepAliveRuntime:()=>JB,generateKeepAliveCSS:()=>XB,createKeepAliveCache:()=>ZB});function SX(){return`keep-alive-${++a_}-${Date.now().toString(36)}`}function t_($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=SX(),q=e_(J||"");return $B(K,G.trim(),q)})}function e_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function $B($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10154
+ `}var YB=0;var gX={};t(gX,{shouldCacheComponent:()=>BB,processKeepAliveDirectives:()=>WB,onDeactivated:()=>LB,onActivated:()=>OB,generateKeepAliveRuntime:()=>HB,generateKeepAliveCSS:()=>jB,createKeepAliveCache:()=>_B});function fX(){return`keep-alive-${++qB}-${Date.now().toString(36)}`}function WB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=fX(),q=UB(J||"");return zB(K,G.trim(),q)})}function UB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function zB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10098
10155
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10099
10156
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10100
10157
  ${Z}
@@ -10381,7 +10438,7 @@ else {
10381
10438
  });
10382
10439
  })();
10383
10440
  </script>
10384
- `}function ZB($={}){return{id:$.id||SX(),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 YB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function XB(){return`
10441
+ `}function _B($={}){return{id:$.id||fX(),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 BB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function jB(){return`
10385
10442
  /* STX Keep-Alive Styles */
10386
10443
  .stx-keep-alive {
10387
10444
  position: relative;
@@ -10406,7 +10463,7 @@ else {
10406
10463
  .stx-keep-alive-content > [data-activated] {
10407
10464
  opacity: 1;
10408
10465
  }
10409
- `}function JB(){return`
10466
+ `}function HB(){return`
10410
10467
  // STX Keep-Alive Runtime
10411
10468
  (function() {
10412
10469
  if (typeof window === 'undefined') return;
@@ -10442,7 +10499,7 @@ else {
10442
10499
 
10443
10500
  console.log('[stx] Keep-alive runtime initialized');
10444
10501
  })();
10445
- `}function QB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function GB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var a_=0;var fX={};t(fX,{useVirtualList:()=>CX,processVirtualListDirectives:()=>D6,processVirtualGridDirectives:()=>xX,processInfiniteListDirectives:()=>vX,generateVirtualListCSS:()=>PX,default:()=>KB,createVirtualList:()=>E6});function E6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function _(){if(G)return B();let M=Math.max(0,Math.floor(U/Y)-Q),R=Math.ceil(X/Y),N=Math.min(W.length-1,M+R+Q*2);return{startIndex:M,endIndex:N}}function B(){let M=0,R=0,N=W.length-1;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(M+I>U){R=Math.max(0,T-Q);break}M+=I}M=0;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(M+=I,M>U+X){N=Math.min(W.length-1,T+Q);break}}return{startIndex:R,endIndex:N}}function j(){if(G){let M=0;for(let R=0;R<W.length;R++)M+=z.get(R)||K;return M}return W.length*Y}function H(M){if(G){let R=0;for(let N=0;N<M;N++)R+=z.get(N)||K;return R}return M*Y}function L(){let{startIndex:M,endIndex:R}=_();return{startIndex:M,endIndex:R,scrollTop:U,totalHeight:j(),visibleItems:W.slice(M,R+1),itemHeights:new Map(z)}}function F(M,R="auto"){let N=H(M);O(N,R)}function O(M,R="auto"){U=Math.max(0,Math.min(M,j()-X))}function V(){_()}function w(M){W=[...M],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function D6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(U.containerHeight/U.itemHeight),B=U.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,M)=>{if(typeof V==="object"&&V!==null)return String(V[M]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
10502
+ `}function OB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function LB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var qB=0;var lX={};t(lX,{useVirtualList:()=>uX,processVirtualListDirectives:()=>b6,processVirtualGridDirectives:()=>mX,processInfiniteListDirectives:()=>dX,generateVirtualListCSS:()=>hX,default:()=>FB,createVirtualList:()=>k6});function k6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function _(){if(G)return B();let M=Math.max(0,Math.floor(U/Y)-Q),R=Math.ceil(X/Y),N=Math.min(W.length-1,M+R+Q*2);return{startIndex:M,endIndex:N}}function B(){let M=0,R=0,N=W.length-1;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(M+I>U){R=Math.max(0,T-Q);break}M+=I}M=0;for(let T=0;T<W.length;T++){let I=z.get(T)||K;if(M+=I,M>U+X){N=Math.min(W.length-1,T+Q);break}}return{startIndex:R,endIndex:N}}function j(){if(G){let M=0;for(let R=0;R<W.length;R++)M+=z.get(R)||K;return M}return W.length*Y}function H(M){if(G){let R=0;for(let N=0;N<M;N++)R+=z.get(N)||K;return R}return M*Y}function L(){let{startIndex:M,endIndex:R}=_();return{startIndex:M,endIndex:R,scrollTop:U,totalHeight:j(),visibleItems:W.slice(M,R+1),itemHeights:new Map(z)}}function F(M,R="auto"){let N=H(M);O(N,R)}function O(M,R="auto"){U=Math.max(0,Math.min(M,j()-X))}function V(){_()}function w(M){W=[...M],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function b6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(U.containerHeight/U.itemHeight),B=U.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,M)=>{if(typeof V==="object"&&V!==null)return String(V[M]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
10446
10503
  <div class="virtual-item ${U.itemClass||""}"
10447
10504
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
10448
10505
  data-index="${O}">
@@ -10519,7 +10576,7 @@ else {
10519
10576
  };
10520
10577
  })();
10521
10578
  </script>
10522
- `})}function PX(){return`
10579
+ `})}function hX(){return`
10523
10580
  .virtual-list-container {
10524
10581
  position: relative;
10525
10582
  overflow-y: auto;
@@ -10567,7 +10624,7 @@ else {
10567
10624
  0% { background-position: 200% 0; }
10568
10625
  100% { background-position: -200% 0; }
10569
10626
  }
10570
- `}function CX($,Z){let Y=null,X=()=>{if(!Y)Y=E6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function vX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=D6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
10627
+ `}function uX($,Z){let Y=null,X=()=>{if(!Y)Y=k6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function dX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=b6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
10571
10628
  // Infinite scroll detection
10572
10629
  container.addEventListener('scroll', function() {
10573
10630
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -10585,7 +10642,7 @@ else {
10585
10642
  ${q}
10586
10643
  </div>
10587
10644
  </div>
10588
- `})}function xX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" 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)}`,_=Math.ceil(W.length/U.columns),B=_*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let A=V*U.columns+w;if(A>=W.length)break;let M=W[A],R=w*(100/U.columns),N=V*(U.rowHeight+(U.gap||0)),T=K.replace(/\{\{\s*item\s*\}\}/g,typeof M==="object"?JSON.stringify(M):String(M)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof M==="object"&&M!==null)return String(M[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
10645
+ `})}function mX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" 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)}`,_=Math.ceil(W.length/U.columns),B=_*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let A=V*U.columns+w;if(A>=W.length)break;let M=W[A],R=w*(100/U.columns),N=V*(U.rowHeight+(U.gap||0)),T=K.replace(/\{\{\s*item\s*\}\}/g,typeof M==="object"?JSON.stringify(M):String(M)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof M==="object"&&M!==null)return String(M[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
10589
10646
  <div class="virtual-grid-item"
10590
10647
  style="position: absolute; top: ${N}px; left: ${R}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
10591
10648
  data-index="${A}">
@@ -10655,7 +10712,7 @@ else {
10655
10712
  });
10656
10713
  })();
10657
10714
  </script>
10658
- `})}var KB;var gX=k(()=>{KB={createVirtualList:E6,processVirtualListDirectives:D6,processInfiniteListDirectives:vX,processVirtualGridDirectives:xX,generateVirtualListCSS:PX,useVirtualList:CX}});function hX(){return`<script data-stx-hydration-runtime>
10715
+ `})}var FB;var pX=k(()=>{FB={createVirtualList:k6,processVirtualListDirectives:b6,processInfiniteListDirectives:dX,processVirtualGridDirectives:mX,generateVirtualListCSS:hX,useVirtualList:uX}});function cX(){return`<script data-stx-hydration-runtime>
10659
10716
  (function() {
10660
10717
  'use strict';
10661
10718
 
@@ -10815,7 +10872,7 @@ else {
10815
10872
  stxIslands.initIslands();
10816
10873
  }
10817
10874
  })();
10818
- </script>`}function uX($){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 dX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var tX={};t(tX,{processStaticDirectives:()=>rX,processPartialHydrationDirectives:()=>lX,onHydrated:()=>oX,isHydrated:()=>sX,hydrateIsland:()=>cX,hydrateByStrategy:()=>iX,hydrateAll:()=>nX,generatePartialHydrationCSS:()=>pX,generateIslandManifest:()=>aX,default:()=>HB,createIslandRegistry:()=>mX});function mX(){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 qB($){return`
10875
+ </script>`}function iX($){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 nX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var JJ={};t(JJ,{processStaticDirectives:()=>YJ,processPartialHydrationDirectives:()=>rX,onHydrated:()=>ZJ,isHydrated:()=>$J,hydrateIsland:()=>aX,hydrateByStrategy:()=>tX,hydrateAll:()=>eX,generatePartialHydrationCSS:()=>oX,generateIslandManifest:()=>XJ,default:()=>IB,createIslandRegistry:()=>sX});function sX(){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 VB($){return`
10819
10876
  <script data-hydrate="${$}">
10820
10877
  (function() {
10821
10878
  const island = document.querySelector('[data-island="${$}"]');
@@ -10826,7 +10883,7 @@ else {
10826
10883
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
10827
10884
  })();
10828
10885
  </script>
10829
- `}function WB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
10886
+ `}function wB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
10830
10887
  <script data-hydrate="${$}">
10831
10888
  (function() {
10832
10889
  const island = document.querySelector('[data-island="${$}"]');
@@ -10862,7 +10919,7 @@ else {
10862
10919
  }
10863
10920
  })();
10864
10921
  </script>
10865
- `}function UB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
10922
+ `}function AB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
10866
10923
  <script data-hydrate="${$}">
10867
10924
  (function() {
10868
10925
  const island = document.querySelector('[data-island="${$}"]');
@@ -10895,7 +10952,7 @@ else {
10895
10952
  }
10896
10953
  })();
10897
10954
  </script>
10898
- `}function zB($,Z){let Y=Z.media||"(min-width: 768px)";return`
10955
+ `}function RB($,Z){let Y=Z.media||"(min-width: 768px)";return`
10899
10956
  <script data-hydrate="${$}">
10900
10957
  (function() {
10901
10958
  const island = document.querySelector('[data-island="${$}"]');
@@ -10924,7 +10981,7 @@ else {
10924
10981
  }
10925
10982
  })();
10926
10983
  </script>
10927
- `}function _B($){return`
10984
+ `}function MB($){return`
10928
10985
  <script data-hydrate="${$}">
10929
10986
  (function() {
10930
10987
  const island = document.querySelector('[data-island="${$}"]');
@@ -10946,7 +11003,7 @@ else {
10946
11003
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
10947
11004
  })();
10948
11005
  </script>
10949
- `}function BB($,Z){let Y=Z.event||"stx:activate";return`
11006
+ `}function NB($,Z){let Y=Z.event||"stx:activate";return`
10950
11007
  <script data-hydrate="${$}">
10951
11008
  (function() {
10952
11009
  const island = document.querySelector('[data-island="${$}"]');
@@ -10967,9 +11024,9 @@ else {
10967
11024
  });
10968
11025
  })();
10969
11026
  </script>
10970
- `}function lX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=v5(X,"load",Z),X=v5(X,"idle",Z),X=v5(X,"visible",Z),X=v5(X,"media",Z),X=jB(X),X=v5(X,"hover",Z),X=v5(X,"event",Z),Q=J&&X!==$,Q)X+=`
10971
- `+hX();return X}function v5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=uX(G.trim()),U=dX(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(W)z.push(`data-component="${W}"`);let B=Object.keys(U).length>0?`
10972
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=qB(q);break;case"idle":j=WB(q,K);break;case"visible":j=UB(q,K);break;case"media":j=zB(q,K);break;case"hover":j=_B(q);break;case"event":j=BB(q,K);break}return`
11027
+ `}function rX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=v5(X,"load",Z),X=v5(X,"idle",Z),X=v5(X,"visible",Z),X=v5(X,"media",Z),X=TB(X),X=v5(X,"hover",Z),X=v5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11028
+ `+cX();return X}function v5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=iX(G.trim()),U=nX(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(W)z.push(`data-component="${W}"`);let B=Object.keys(U).length>0?`
11029
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=VB(q);break;case"idle":j=wB(q,K);break;case"visible":j=AB(q,K);break;case"media":j=RB(q,K);break;case"hover":j=MB(q);break;case"event":j=NB(q,K);break}return`
10973
11030
  <div data-island="${q}"
10974
11031
  data-strategy="${Z}"
10975
11032
  ${z.join(`
@@ -10979,7 +11036,7 @@ else {
10979
11036
  ${G.trim()}${B}
10980
11037
  </div>
10981
11038
  ${j}
10982
- `})}function jB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11039
+ `})}function TB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10983
11040
  <div data-island="${Q}"
10984
11041
  data-strategy="only"
10985
11042
  class="stx-island stx-client-only">
@@ -10998,7 +11055,7 @@ else {
10998
11055
  }
10999
11056
  })();
11000
11057
  </script>
11001
- `})}function pX(){return`
11058
+ `})}function oX(){return`
11002
11059
  /* Island base styles */
11003
11060
  .stx-island {
11004
11061
  display: contents;
@@ -11039,11 +11096,11 @@ else {
11039
11096
  .stx-island.hydrated {
11040
11097
  opacity: 1;
11041
11098
  }
11042
- `}function cX($){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 iX($){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 nX(){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 sX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function oX($){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 rX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function aX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11099
+ `}function aX($){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 tX($){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 eX(){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 $J($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function ZJ($){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 YJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function XJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11043
11100
  <script type="application/json" id="stx-island-manifest">
11044
11101
  ${JSON.stringify(Z)}
11045
11102
  </script>
11046
- `}var HB;var eX=k(()=>{HB={processPartialHydrationDirectives:lX,processStaticDirectives:rX,generatePartialHydrationCSS:pX,generateIslandManifest:aX,createIslandRegistry:mX,hydrateIsland:cX,hydrateByStrategy:iX,hydrateAll:nX,isHydrated:sX,onHydrated:oX}});var UJ={};t(UJ,{watchMultiple:()=>JJ,watchEffect:()=>QJ,watch:()=>XJ,unref:()=>$J,toRefs:()=>ZJ,throttledComputed:()=>WJ,stxWatchMultiple:()=>JJ,stxWatchEffect:()=>QJ,stxWatch:()=>XJ,stxUnref:()=>$J,stxToRefs:()=>ZJ,stxThrottledComputed:()=>WJ,stxShallowRef:()=>YJ,stxRef:()=>x5,stxIsRef:()=>y1,stxDebouncedComputed:()=>qJ,stxComputed:()=>I$,shallowRef:()=>YJ,ref:()=>x5,processWatchDirectives:()=>KJ,processComputedDirectives:()=>GJ,isRef:()=>y1,default:()=>OB,debouncedComputed:()=>qJ,computed:()=>I$});function x5($){let Z=$,Y=new Set,X={get value(){if(K1){let Q=T$.get(X);if(!Q)Q=new Set,T$.set(X,Q);Q.add(K1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=T$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function y1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function $J($){return y1($)?$.value:$}function ZJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=x5($[Y]);return Z}function YJ($){return x5($)}function I$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let _=z.value;q.forEach((B)=>B(_))}};function U(){K.clear();let _=K1;K1=W,l4.push(W);try{return Y()}finally{l4.pop(),K1=_}}let z={get value(){if(K1){let _=T$.get(z);if(!_)_=new Set,T$.set(z,_);_.add(K1)}if(G){let _=U();if(!Q(J,_))J=_;G=!1}return J},set value(_){if(X)X(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function XJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(y1($))return Q?Z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?Z5(j):j,G)B()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(y1($))_=$.subscribe(()=>z());else _=I$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let B=()=>{if(q=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function JJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>y1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((_)=>y1(_)?_.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(y1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function QJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=K1;K1=G,l4.push(G);try{X=$()}finally{l4.pop(),K1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function GJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function KJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11103
+ `}var IB;var QJ=k(()=>{IB={processPartialHydrationDirectives:rX,processStaticDirectives:YJ,generatePartialHydrationCSS:oX,generateIslandManifest:XJ,createIslandRegistry:sX,hydrateIsland:aX,hydrateByStrategy:tX,hydrateAll:eX,isHydrated:$J,onHydrated:ZJ}});var OJ={};t(OJ,{watchMultiple:()=>UJ,watchEffect:()=>zJ,watch:()=>WJ,unref:()=>GJ,toRefs:()=>KJ,throttledComputed:()=>HJ,stxWatchMultiple:()=>UJ,stxWatchEffect:()=>zJ,stxWatch:()=>WJ,stxUnref:()=>GJ,stxToRefs:()=>KJ,stxThrottledComputed:()=>HJ,stxShallowRef:()=>qJ,stxRef:()=>x5,stxIsRef:()=>y1,stxDebouncedComputed:()=>jJ,stxComputed:()=>I$,shallowRef:()=>qJ,ref:()=>x5,processWatchDirectives:()=>BJ,processComputedDirectives:()=>_J,isRef:()=>y1,default:()=>EB,debouncedComputed:()=>jJ,computed:()=>I$});function x5($){let Z=$,Y=new Set,X={get value(){if(K1){let Q=T$.get(X);if(!Q)Q=new Set,T$.set(X,Q);Q.add(K1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=T$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function y1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function GJ($){return y1($)?$.value:$}function KJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=x5($[Y]);return Z}function qJ($){return x5($)}function I$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let _=z.value;q.forEach((B)=>B(_))}};function U(){K.clear();let _=K1;K1=W,l4.push(W);try{return Y()}finally{l4.pop(),K1=_}}let z={get value(){if(K1){let _=T$.get(z);if(!_)_=new Set,T$.set(z,_);_.add(K1)}if(G){let _=U();if(!Q(J,_))J=_;G=!1}return J},set value(_){if(X)X(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function WJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(y1($))return Q?Z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?Z5(j):j,G)B()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(y1($))_=$.subscribe(()=>z());else _=I$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let B=()=>{if(q=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function UJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>y1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((_)=>y1(_)?_.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(y1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function zJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=K1;K1=G,l4.push(G);try{X=$()}finally{l4.pop(),K1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function _J($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function BJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11047
11104
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11048
11105
  (function() {
11049
11106
  // Watch implementation for ${J}
@@ -11055,9 +11112,9 @@ else {
11055
11112
  }
11056
11113
  })();
11057
11114
  </script>
11058
- `})}function Z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Z5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(Z5(Q),Z5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Z5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Z5($[Y]);return Z}function qJ($,Z=100){let Y=x5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return I$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function WJ($,Z=100){let Y=x5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return I$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,l4,T$,OB;var zJ=k(()=>{l4=[],T$=new WeakMap;OB={ref:x5,computed:I$,watch:XJ,watchMultiple:JJ,watchEffect:QJ,isRef:y1,unref:$J,toRefs:ZJ,shallowRef:YJ,debouncedComputed:qJ,throttledComputed:WJ,processComputedDirectives:GJ,processWatchDirectives:KJ}});var HJ={};t(HJ,{v:()=>LB,processHasErrorsDirective:()=>jJ,processFormValidationDirectives:()=>VB,processErrorsDirective:()=>BJ,processErrorDirective:()=>_J,defineForm:()=>FB,Validator:()=>f5});class f5{rules=[];defaultValue="";addRule($){let Z=new f5;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:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}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:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||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($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}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 f5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new f5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function FB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function B(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function _J($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11059
- `)}catch{return""}})}function BJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
11060
- `)}catch{return""}})}function jJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function VB($,Z,Y){let X=$;return X=_J(X,Z,Y),X=BJ(X,Z,Y),X=jJ(X,Z,Y),X}var LB;var OJ=k(()=>{LB=new f5});var VJ={};t(VJ,{processXElementDirectives:()=>wB,hasXElementDirectives:()=>FJ,generateXElementRuntime:()=>LJ});function LJ(){return`<script data-stx-scoped data-stx-x-element-runtime>
11115
+ `})}function Z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Z5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(Z5(Q),Z5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Z5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Z5($[Y]);return Z}function jJ($,Z=100){let Y=x5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return I$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function HJ($,Z=100){let Y=x5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return I$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,l4,T$,EB;var LJ=k(()=>{l4=[],T$=new WeakMap;EB={ref:x5,computed:I$,watch:WJ,watchMultiple:UJ,watchEffect:zJ,isRef:y1,unref:GJ,toRefs:KJ,shallowRef:qJ,debouncedComputed:jJ,throttledComputed:HJ,processComputedDirectives:_J,processWatchDirectives:BJ}});var AJ={};t(AJ,{v:()=>DB,processHasErrorsDirective:()=>wJ,processFormValidationDirectives:()=>bB,processErrorsDirective:()=>VJ,processErrorDirective:()=>FJ,defineForm:()=>kB,Validator:()=>f5});class f5{rules=[];defaultValue="";addRule($){let Z=new f5;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:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}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:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||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($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}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 f5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new f5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function kB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function B(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function FJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11116
+ `)}catch{return""}})}function VJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
11117
+ `)}catch{return""}})}function wJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function bB($,Z,Y){let X=$;return X=FJ(X,Z,Y),X=VJ(X,Z,Y),X=wJ(X,Z,Y),X}var DB;var RJ=k(()=>{DB=new f5});var TJ={};t(TJ,{processXElementDirectives:()=>SB,hasXElementDirectives:()=>NJ,generateXElementRuntime:()=>MJ});function MJ(){return`<script data-stx-scoped data-stx-x-element-runtime>
11061
11118
  (function() {
11062
11119
  'use strict';
11063
11120
 
@@ -11341,16 +11398,16 @@ else {
11341
11398
  // Expose for manual initialization
11342
11399
  window.XElement = XElement;
11343
11400
  })();
11344
- </script>`}function FJ($){return/\bx-data(?:\s|=)/.test($)}function wB($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!FJ(X))return X;let Q=Y[0]?.trim()||LJ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
11401
+ </script>`}function NJ($){return/\bx-data(?:\s|=)/.test($)}function SB($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!NJ(X))return X;let Q=Y[0]?.trim()||MJ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
11345
11402
  `+X.slice(J);return X+`
11346
- `+Q}var wJ={};t(wJ,{rewriteImagesWithSiblings:()=>MB});import O1 from"path";async function MB($,Z){let Y=Z.formats??RB;if(!Z.publicDir)return $;let X=IB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],_=z.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(EB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:_[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let _=await NB(z.src,Z.publicDir,Y);return{match:z,sources:_}}));for(let{match:z,sources:_}of q){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${DB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function NB($,Z,Y){if(!TB($))return[];let X=O1.extname($).toLowerCase();if(!AB.has(X))return[];if(!$.startsWith("/"))return[];let Q=O1.join(Z,$.slice(1)),J=O1.dirname(Q),G=O1.basename(Q,X),K=O1.resolve(J),q=O1.resolve(Z);if(!K.startsWith(q))return[];let W=O1.posix.dirname($),U=Y.map(async(_)=>{let B=O1.join(J,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:O1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(U)).filter((_)=>_!==null)}function TB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function IB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function EB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function DB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var AB,RB;var AJ=k(()=>{AB=new Set([".jpg",".jpeg",".png",".gif"]),RB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var RJ=()=>{};function k6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var MJ=k(()=>{RJ()});var NJ={};t(NJ,{injectPwaTags:()=>kB,generateThemeColorMeta:()=>yB,generateSwRegistrationScript:()=>bB,generatePwaTags:()=>p4,generateManifestLink:()=>SB});function p4($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=k6($),J=`
11403
+ `+Q}var IJ={};t(IJ,{rewriteImagesWithSiblings:()=>CB});import O1 from"path";async function CB($,Z){let Y=Z.formats??PB;if(!Z.publicDir)return $;let X=fB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],_=z.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(gB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:_[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let _=await vB(z.src,Z.publicDir,Y);return{match:z,sources:_}}));for(let{match:z,sources:_}of q){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${hB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function vB($,Z,Y){if(!xB($))return[];let X=O1.extname($).toLowerCase();if(!yB.has(X))return[];if(!$.startsWith("/"))return[];let Q=O1.join(Z,$.slice(1)),J=O1.dirname(Q),G=O1.basename(Q,X),K=O1.resolve(J),q=O1.resolve(Z);if(!K.startsWith(q))return[];let W=O1.posix.dirname($),U=Y.map(async(_)=>{let B=O1.join(J,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:O1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(U)).filter((_)=>_!==null)}function xB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function fB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function gB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function hB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var yB,PB;var EJ=k(()=>{yB=new Set([".jpg",".jpeg",".png",".gif"]),PB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var DJ=()=>{};function S6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var kJ=k(()=>{DJ()});var bJ={};t(bJ,{injectPwaTags:()=>uB,generateThemeColorMeta:()=>lB,generateSwRegistrationScript:()=>dB,generatePwaTags:()=>p4,generateManifestLink:()=>mB});function p4($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=S6($),J=`
11347
11404
  <!-- stx PWA Meta Tags -->
11348
11405
  <link rel="manifest" href="/manifest.json">
11349
- <meta name="theme-color" content="${b6(Y?.themeColor||"#000000")}">
11406
+ <meta name="theme-color" content="${y6(Y?.themeColor||"#000000")}">
11350
11407
  <meta name="mobile-web-app-capable" content="yes">
11351
11408
  <meta name="apple-mobile-web-app-capable" content="yes">
11352
11409
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
11353
- <meta name="apple-mobile-web-app-title" content="${b6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
11410
+ <meta name="apple-mobile-web-app-title" content="${y6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
11354
11411
  <link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
11355
11412
  <link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
11356
11413
  <link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
@@ -11387,12 +11444,12 @@ if ('serviceWorker' in navigator) {
11387
11444
  });
11388
11445
  }
11389
11446
  </script>
11390
- <!-- End stx PWA -->`,J}function kB($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=p4(Z);return $.slice(0,Q)+J+`
11447
+ <!-- End stx PWA -->`,J}function uB($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=p4(Z);return $.slice(0,Q)+J+`
11391
11448
  `+$.slice(Q)}return $+p4(Z)}let X=p4(Z);return $.replace("</head>",`${X}
11392
- </head>`)}function bB($){if(!$.pwa?.enabled)return"";return`<script>
11449
+ </head>`)}function dB($){if(!$.pwa?.enabled)return"";return`<script>
11393
11450
  if ('serviceWorker' in navigator) {
11394
11451
  window.addEventListener('load', function() {
11395
- navigator.serviceWorker.register('/${k6($)}')
11452
+ navigator.serviceWorker.register('/${S6($)}')
11396
11453
  .then(function(registration) {
11397
11454
  console.log('[PWA] Service Worker registered:', registration.scope);
11398
11455
  })
@@ -11401,42 +11458,42 @@ if ('serviceWorker' in navigator) {
11401
11458
  });
11402
11459
  });
11403
11460
  }
11404
- </script>`}function SB(){return'<link rel="manifest" href="/manifest.json">'}function yB($){return`<meta name="theme-color" content="${b6($)}">`}function b6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var TJ=k(()=>{MJ()});import f0 from"path";import{deriveLayoutGroup as PB}from"stx-router/layout-metadata";function IJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function CB($,Z){let Y=$.length,X=Z,Q=!0,J=[],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(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11461
+ </script>`}function mB(){return'<link rel="manifest" href="/manifest.json">'}function lB($){return`<meta name="theme-color" content="${y6($)}">`}function y6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var SJ=k(()=>{kJ()});import f0 from"path";import{deriveLayoutGroup as pB}from"stx-router/layout-metadata";function yJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cB($,Z){let Y=$.length,X=Z,Q=!0,J=[],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(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11405
11462
  `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
11406
11463
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
11407
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function c4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function EJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function vB($){let Z=c4($,"data-stx-runtime");if(!Z)return $;let Y=EJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=EJ(Q);if(J===-1)return X+`
11464
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function c4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function PJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function iB($){let Z=c4($,"data-stx-runtime");if(!Z)return $;let Y=PJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=PJ(Q);if(J===-1)return X+`
11408
11465
  `+Q;return Q.slice(0,J)+X+`
11409
- `+Q.slice(J)}async function L0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(J)F8(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!K$()&&!o$())&&Y&&Y.endsWith(".stx"))L3($,Y);try{return await d8.timeAsync("template-processing",async()=>{let G=await xB($,Z,Y,X,Q);if(J)G=R6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??X3(),U=(Z.__stx_head_raw||"").trim(),z,_=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)z=_[1].trim(),U=U.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11410
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=G6(G);if(G=gY(G,H),L)G=fY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=PB(V);G=G.replace("<head>",`<head>
11411
- <meta name="stx-layout" content="${IJ(V)}">
11412
- <meta name="stx-layout-group" content="${IJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=xY(G),G=vB(G);if(J)try{let{getStoreScript:K}=await e("stx/store-loader",()=>Promise.resolve().then(() => (_X(),zX))),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=c4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
11413
- `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (HX(),jX))),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=c4(G,"data-stx-stores")||c4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
11414
- `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await d7(G,void 0,X.buildMode==="serve");if(J)G=vY(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof e$)throw G;let K=G instanceof Error?G.message:String(G),q=new i1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(q,{filePath:Y,context:Z}),a7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return o7.createFallbackContent("Template Processing",q)}}async function xB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!f0.isAbsolute(X.partialsDir)?f0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!f0.isAbsolute(X.componentsDir)?f0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!f0.isAbsolute(X.layoutsDir)?f0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await hB(Y,Z),gB(Z,K),q=await V5(()=>UY(q,Z,Y,K),q,(O)=>{Z1.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=X1(q,Z$,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=EY(q),q=await GX(q,Y,Q);let B={};q=e3(q,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=f0.dirname(Y),M=K.layoutsDir?f0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let N=f0.join(A,"_layout.stx");if(await c(N)){w=N;break}let T=f0.dirname(A);if(T===A||T.length<M.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let R=f0.isAbsolute(K.layoutsDir)?K.layoutsDir:f0.resolve(process.cwd(),K.layoutsDir),N=f0.join(R,`${K.defaultLayout}.stx`);if(await c(N))H=N}if(H&&!V)q=`@section('content')
11466
+ `+Q.slice(J)}async function L0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(J)A8(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!K$()&&!r$())&&Y&&Y.endsWith(".stx"))L3($,Y);try{return await p8.timeAsync("template-processing",async()=>{let G=await nB($,Z,Y,X,Q);if(J)G=N6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??X3(),U=(Z.__stx_head_raw||"").trim(),z,_=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)z=_[1].trim(),U=U.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11467
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=q6(G);if(G=lY(G,H,{...X.app?.colorMode&&{colorMode:X.app.colorMode}}),L)G=mY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=pB(V);G=G.replace("<head>",`<head>
11468
+ <meta name="stx-layout" content="${yJ(V)}">
11469
+ <meta name="stx-layout-group" content="${yJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J){G=dY(G);let K=X.app?.colorMode;if(K)G=hY(G,K);G=iB(G)}if(J)try{let{getStoreScript:K}=await e("stx/store-loader",()=>Promise.resolve().then(() => (FX(),LX))),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=c4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
11470
+ `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (AX(),wX))),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=c4(G,"data-stx-stores")||c4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
11471
+ `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await d7(G,void 0,X.buildMode==="serve");if(J)G=gY(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof e$)throw G;let K=G instanceof Error?G.message:String(G),q=new i1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(q,{filePath:Y,context:Z}),a7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return r7.createFallbackContent("Template Processing",q)}}async function nB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!f0.isAbsolute(X.partialsDir)?f0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!f0.isAbsolute(X.componentsDir)?f0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!f0.isAbsolute(X.layoutsDir)?f0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await oB(Y,Z),rB(Z,K),q=await V5(()=>BY(q,Z,Y,K),q,(O)=>{Z1.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=X1(q,Z$,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=bY(q),q=await _X(q,Y,Q);let B={};q=e3(q,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=f0.dirname(Y),M=K.layoutsDir?f0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let N=f0.join(A,"_layout.stx");if(await c(N)){w=N;break}let T=f0.dirname(A);if(T===A||T.length<M.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let R=f0.isAbsolute(K.layoutsDir)?K.layoutsDir:f0.resolve(process.cwd(),K.layoutsDir),N=f0.join(R,`${K.defaultLayout}.stx`);if(await c(N))H=N}if(H&&!V)q=`@section('content')
11415
11472
  ${q.trim()}
11416
11473
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Y0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",Y5);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=$6(q,B),H){let O=[],V=A1(q),w=X1(V.output,_5,(A,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,M,R)=>{let N=M==="SCRIPT"?V.scripts[Number(R)]:w.tokens[Number(R)];if(N)O.push(N);return""}),O.length>0){let A=O.join(`
11417
11474
  `);j.content=j.content?`${j.content}
11418
- ${A}`:A,Z.__sections=j}}if(H)try{let O;if(f0.isAbsolute(H))O=H,Q.add(H);else O=await V5(()=>S6(H,Y,G,Q),null,()=>{throw new i1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let N=`Layout not found: ${H} (referenced from ${Y})`;if(Z1.log(Error(N),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new i1(N,Y);return q}let V=await V5(()=>Bun.file(O).text(),"",()=>{throw new i1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let N={},T=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,y,S)=>{return N[y]=S.trim(),""});for(let[E,y]of Object.entries(N))if(j[E]&&j[E].includes(Y5)){let S=j[E].indexOf(Y5);j[E]=j[E].slice(0,S)+y+j[E].slice(S+Y5.length)}else if(!j[E])j[E]=y;let I={...Z,__sections:j},D=`@layout('${w[1]}')${T}`;return await L0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=e3(A,B),R={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,T,I)=>{return R[T]=I.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,T,I)=>{if(j[T]){let D=j[T];if(D.includes(Y5)){let E=R[T]||"",y=D.indexOf(Y5);D=D.slice(0,y)+E+D.slice(y+Y5.length)}return D}return I||""}),M=fB(M,j),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),M=$6(M,B),Z.__originalFilePath=Y,q=await DJ(M,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11419
- ${q}`,z(q)}catch(O){return Z1.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await DJ(q,Z,Y,G,Q))}function fB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function gB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function hB($,Z){await V5(()=>AY($,Z),void 0,(Y)=>{Z1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function uB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (D5(),A4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));Z1.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function dB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await e("stx/expressions",()=>Promise.resolve().then(() => (J1(),f8)));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return Z1.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function DJ($,Z,Y,X,Q){let J=$,G=X;if(await uB(J,Z,Y),J=await dB(J,Z,Y),J=await JY(J,Z,Y),J=await QY(J,Z,Y),J=await hZ(J,Z,Y,G),B5(J))J=O6(J,Z),J=F6(J,Z);J=L6(J);let{processStreamDirectives:K}=await e("stx/streaming",()=>Promise.resolve().then(() => (O3(),H3)));J=K(J,Z),J=o3(J,Z,Y,G),J=await w4(J,Z,Y,G,Q),J=await kY(J,Z,Y,G,Q),J=s9(J,Z,Y,G);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => LX));J=q(J,Z,Y);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => VX));J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => MX));J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:_}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => TX));J=_(J,Z,Y);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => IX));J=B(J,Z,Y);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => bX));J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await e("stx/keep-alive",()=>Promise.resolve().then(() => yX));J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (gX(),fX)));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (eX(),tX)));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:A,processWatchDirectives:M}=await e("stx/computed",()=>Promise.resolve().then(() => (zJ(),UJ)));J=A(J,Z,Y),J=M(J,Z,Y);let{processFormValidationDirectives:R}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (OJ(),HJ)));J=R(J,Z,Y);let{processHeadDirective:N,processTitleDirective:T,processMetaDirective:I,resetHead:D}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),Q3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=N(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11420
- `;if(J=T(J,Z),J=I(J,Z),J=BY(J),J=e7(J,Z),J=fZ(J),J=qY(J),J=await t3(J,Z,Y,G,Q),J=await w4(J,Z,Y,G,Q),Z.__stxProcessingDepth===1)J=w8(J,Z);if(J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=R6(J),J=s1(J,Z,Y),J=$3(J,Z),J=Z3(J,Z),J=q4(J,Z),J=oZ(J,Z),J=rZ(J,Z),J=await OZ(J,Z,Y,G),J=await kJ(J,Z,Y),J=await Z2(J,Z,Y,G),J=d9(J,Z,Y,G),J=HY(J,Z,Y,G),J=OY(J,Z,Y),J=LY(J,Z,Y,G),J=CZ(J,Z,Y,G),J=w6(J,Z),J=A6(J),J=qX(J),!G.skipEventDirectives)J=WZ(J,Z,Y);if(J=jZ(J,Z,Y),G.debug){let n=/\bx-data\s*=/.test(J),J0=u4($);if(n&&J0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11475
+ ${A}`:A,Z.__sections=j}}if(H)try{let O;if(f0.isAbsolute(H))O=H,Q.add(H);else O=await V5(()=>P6(H,Y,G,Q),null,()=>{throw new i1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let N=`Layout not found: ${H} (referenced from ${Y})`;if(Z1.log(Error(N),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new i1(N,Y);return q}let V=await V5(()=>Bun.file(O).text(),"",()=>{throw new i1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let N={},T=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,y,S)=>{return N[y]=S.trim(),""});for(let[E,y]of Object.entries(N))if(j[E]&&j[E].includes(Y5)){let S=j[E].indexOf(Y5);j[E]=j[E].slice(0,S)+y+j[E].slice(S+Y5.length)}else if(!j[E])j[E]=y;let I={...Z,__sections:j},D=`@layout('${w[1]}')${T}`;return await L0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=e3(A,B),R={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,T,I)=>{return R[T]=I.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,T,I)=>{if(j[T]){let D=j[T];if(D.includes(Y5)){let E=R[T]||"",y=D.indexOf(Y5);D=D.slice(0,y)+E+D.slice(y+Y5.length)}return D}return I||""}),M=sB(M,j),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),M=$6(M,B),Z.__originalFilePath=Y,q=await CJ(M,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11476
+ ${q}`,z(q)}catch(O){return Z1.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await CJ(q,Z,Y,G,Q))}function sB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function rB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function oB($,Z){await V5(()=>NY($,Z),void 0,(Y)=>{Z1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function aB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (D5(),A4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));Z1.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function tB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await e("stx/expressions",()=>Promise.resolve().then(() => (J1(),u8)));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return Z1.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function CJ($,Z,Y,X,Q){let J=$,G=X;if(await aB(J,Z,Y),J=await tB(J,Z,Y),J=await KY(J,Z,Y),J=await qY(J,Z,Y),J=await mZ(J,Z,Y,G),B5(J))J=F6(J,Z),J=w6(J,Z);J=V6(J);let{processStreamDirectives:K}=await e("stx/streaming",()=>Promise.resolve().then(() => (O3(),H3)));J=K(J,Z),J=r3(J,Z,Y,G),J=await w4(J,Z,Y,G,Q),J=await yY(J,Z,Y,G,Q),J=o9(J,Z,Y,G);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => MX));J=q(J,Z,Y);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => TX));J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => kX));J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:_}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => SX));J=_(J,Z,Y);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => yX));J=B(J,Z,Y);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => xX));J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await e("stx/keep-alive",()=>Promise.resolve().then(() => gX));J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (pX(),lX)));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (QJ(),JJ)));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:A,processWatchDirectives:M}=await e("stx/computed",()=>Promise.resolve().then(() => (LJ(),OJ)));J=A(J,Z,Y),J=M(J,Z,Y);let{processFormValidationDirectives:R}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (RJ(),AJ)));J=R(J,Z,Y);let{processHeadDirective:N,processTitleDirective:T,processMetaDirective:I,resetHead:D}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),Q3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=N(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11477
+ `;if(J=T(J,Z),J=I(J,Z),J=OY(J),J=e7(J,Z),J=uZ(J),J=zY(J),J=await t3(J,Z,Y,G,Q),J=await w4(J,Z,Y,G,Q),Z.__stxProcessingDepth===1)J=M8(J,Z);if(J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=N6(J),J=s1(J,Z,Y),J=$3(J,Z),J=Z3(J,Z),J=q4(J,Z),J=tZ(J,Z),J=eZ(J,Z),J=await VZ(J,Z,Y,G),J=await vJ(J,Z,Y),J=await J2(J,Z,Y,G),J=l9(J,Z,Y,G),J=FY(J,Z,Y,G),J=VY(J,Z,Y),J=wY(J,Z,Y,G),J=fZ(J,Z,Y,G),J=R6(J,Z),J=M6(J),J=jX(J),!G.skipEventDirectives)J=_Z(J,Z,Y);if(J=LZ(J,Z,Y),G.debug){let n=/\bx-data\s*=/.test(J),J0=u4($);if(n&&J0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11421
11478
  Both work on the same page, but they manage separate scopes.
11422
- Prefer signals (state/derived/effect) for new components.`)}J=NY(J,Z),J=await R1(J,Z,Y),J=WX(J),J=UX(J),J=$Z(J);let{processXElementDirectives:y}=await e("stx/x-element",()=>Promise.resolve().then(() => VJ));J=y(J);let S=Z.__originalFilePath||Y,b=h1(Z);if(J=await V6(J,G,S,b),J=pZ(J,Z),J=await zY(J,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:J0}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (AJ(),wJ)));J=await J0(J,{publicDir:n})}if(G.seo?.enabled)J=FY(J,Z,G);let v=(n,J0,B0=!0)=>{if(!J0)return n;let M0=J0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(M0&&C){if(B0)n=n.replace(C[0],M0[0]);if(J0=J0.replace(M0[0],"").trim(),!J0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${J0}
11479
+ Prefer signals (state/derived/effect) for new components.`)}J=EY(J,Z),J=await R1(J,Z,Y),J=HX(J),J=OX(J),J=XZ(J);let{processXElementDirectives:y}=await e("stx/x-element",()=>Promise.resolve().then(() => TJ));J=y(J);let S=Z.__originalFilePath||Y,b=h1(Z);if(J=await A6(J,G,S,b),J=nZ(J,Z),J=await jY(J,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:J0}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (EJ(),IJ)));J=await J0(J,{publicDir:n})}if(G.seo?.enabled)J=AY(J,Z,G);let v=(n,J0,B0=!0)=>{if(!J0)return n;let M0=J0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(M0&&C){if(B0)n=n.replace(C[0],M0[0]);if(J0=J0.replace(M0[0],"").trim(),!J0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${J0}
11423
11480
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
11424
11481
  ${J0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
11425
11482
  <head>
11426
11483
  ${J0}
11427
- </head>`);return n},{renderHead:h,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),Q3))),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let n=h(r);if(n)J=v(J,n)}if(E.headContent)J=v(J,E.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=yZ(J,G.csp,Z);if(G.analytics?.enabled)J=YZ(J,G);if(G.heatmap?.enabled)J=e9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (TJ(),NJ)));J=n(J,G)}let I0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),E0=/\bSTX\.\w+/.test(J),l0=/window\.STX\s*=/.test(J);if(I0&&E0&&!l0){let J0=`<script data-stx-scoped>
11428
- ${r8()}
11484
+ </head>`);return n},{renderHead:h,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),Q3))),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let n=h(r);if(n)J=v(J,n)}if(E.headContent)J=v(J,E.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=vZ(J,G.csp,Z);if(G.analytics?.enabled)J=QZ(J,G);if(G.heatmap?.enabled)J=Z8(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (SJ(),bJ)));J=n(J,G)}let I0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),E0=/\bSTX\.\w+/.test(J),l0=/window\.STX\s*=/.test(J);if(I0&&E0&&!l0){let J0=`<script data-stx-scoped>
11485
+ ${e8()}
11429
11486
  </script>`;if(J.includes("</head>")){let B0=J.indexOf("</head>"),C=J.slice(0,B0).indexOf("<script");if(C!==-1){let P=J.slice(0,C),x=J.slice(C);J=P+J0+`
11430
11487
  `+x}else J=J.replace("</head>",`${J0}
11431
11488
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
11432
11489
  ${J0}`);else J=J0+`
11433
- `+J}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4))),J0=[];for(let B0 of n(J)){if(!/\bserver\b/i.test(B0.attrs))continue;let M0=B0.start+B0.fullMatch.indexOf(">")+1,C=CB(J,M0);if(C===-1)continue;let P=C+9;while(P<J.length&&/\s/.test(J[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:M0,end:C}=J0[B0];J=J.substring(0,M0)+J.substring(C)}}let Q0=I4(J,Y);if(Q0.hasScoped)J=Q0.html;let G0=Z.__stx_event_bindings||[],D0=!1,o0=[],L1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:Q5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4)));for(let n of Q5(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))o0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of o0){D0=!0;let M0=B0;N6(B0,Y,X.strict);let C=await u1(B0,{eventBindings:G0,attrs:J0,hasColonDirectives:L1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(n,()=>C)}if(D0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=PZ(J,Z.cspNonce);return J}var Y5="<!--PARENT_CONTENT_PLACEHOLDER-->";var z4=k(()=>{m7();l1();I7();a8();ZZ();XZ();k7();E7();UZ();z5();HZ();LZ();X4();vZ();gZ();dZ();cZ();B1();U$();J1();aZ();Y2();XY();KY();r3();y6();_Y();L5();jY();Y6();w0();RY();TY();DY();bY();Q6();M$();i3();KX();M6();T6();O0();F3();y7();n5();M6();T6()});var bJ=()=>{};var P6={};t(P6,{renderSlot:()=>yJ,processSlots:()=>CJ,parseSlots:()=>SJ,parseSlotElement:()=>iB,extractSlotContent:()=>oB,applySlots:()=>rB});function mB($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function pB($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function cB($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let _=$.indexOf("-->",J+4);Q=_===-1?$.length:_+3;continue}let G=pB($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let _=Y.lastIndexOf(U);if(_!==-1)Y.splice(_);Q=G;continue}if(U==="template"&&Y.length===0){let _=K.match(X);if(_){let B=mB($,G);if(B!==-1){let j=_[1]||_[2]||_[3];Z.push({start:J,end:B,slotName:j,content:$.slice(G,B-11).trim(),propsBinding:_[4]||void 0}),Q=B;continue}}}if(!/\/\s*>$/.test(K)&&!lB.has(U)){if(Y.push(U),U==="script"||U==="style"){let _=$.toLowerCase().indexOf(`</${U}>`,G);if(_!==-1){Q=_;continue}}}Q=G}return Z}function SJ($){let Z={default:"",named:new Map},Y=$,X=cB($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,_,B]=G,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(j+H).trim(),F=`<${W}${L?" "+L:""}>${B}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+j).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function iB($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function yJ($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((_)=>_.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=nB(Q,G)}return Q}function nB($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=PJ(Q,Z);return t0(String(J??""))}catch{return`{{ ${X} }}`}})}function PJ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function CJ($,Z,Y){let X=$;X=await sB(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",_=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=PJ(F,Y)}return await yJ(U,B,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function sB($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function oB($){let Z=SJ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function rB($,Z,Y,X){return await CJ($,{default:Z,named:Y},X)}var lB;var C6=k(()=>{J1();O0();lB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import aB from"fs";import g from"path";function eB($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function vJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $j($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function d1($){return!$j($)}function m1($){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,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Zj($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
11434
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function Yj($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function Xj($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Jj($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of Yj(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=Xj(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let _=W.slice(U+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[z]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function F4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Q._rootComponentsDir),B(g.join(g.dirname(X),"components")),B(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(U)B(g.resolve(U,"resources/views/components")),B(g.resolve(U,"resources/components")),B(g.resolve(U,"src/components")),B(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(g.resolve(g.dirname(X),`${J}.stx`));for(let L of _){let F=g.isAbsolute(L)?L:g.resolve(z,L);for(let O of W)if(await c(g.join(F,O)))return!0}return!1}function Qj($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Gj($){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 Kj($){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 X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function t1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (D5(),A4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&Qj(_)?_:"";try{let j=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let P=[L,L.toLowerCase(),j(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],l=Q.__originalFilePath,d=[];if(l){let W0=g.join(g.dirname(l),"components");d.push(W0)}if(X)d.push(X);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!d.includes(z0))d.push(z0);let V0=g.join(g.dirname(J),"components");if(!d.includes(V0))d.push(V0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let q1=G._pluginComponentDirs;if(Array.isArray(q1)){for(let W0 of q1)if(typeof W0==="string"&&!d.includes(W0))d.push(W0)}let p0=typeof G.root==="string"?g.resolve(G.root):void 0,P0=p0??g.dirname(J),r0=[];if(p0)r0.push(g.resolve(p0,"resources/views/components")),r0.push(g.resolve(p0,"resources/components")),r0.push(g.resolve(p0,"src/components")),r0.push(g.resolve(p0,"components"));r0.push(g.resolve(import.meta.dir,"components"));for(let W0 of r0)if(!d.includes(W0))d.push(W0);let v1=[...new Set(d.map((W0)=>{if(!W0)return W0;return g.isAbsolute(W0)?W0:g.resolve(P0,W0)}))];d.length=0,d.push(...v1);let F1=`${L}\x00${J}\x00${v1.join("\x00")}`,G5=n4.get(F1);if(G5)if(await c(G5))F=G5;else n4.delete(F1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=g.resolve(g.dirname(J),`${L}.stx`),V.push(F);else if(!F)for(let W0 of d){if(!W0)continue;for(let i of x){let g0=g.join(W0,i);if(V.push(g0),await c(g0)){F=g0;break}}if(F)break;if(!F)try{let i=await import("fs");if(!i.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let d5=8,K5=[{path:W0,depth:0}];while(K5.length>0&&!F){let W1=K5.pop();if(W1.depth>=d5)continue;let b$;try{b$=i.readdirSync(W1.path,{withFileTypes:!0})}catch{continue}for(let S$ of b$){if(!S$.isDirectory())continue;if(S$.name==="node_modules"||S$.name.startsWith("."))continue;let F9=g.join(W1.path,S$.name);for(let sQ of x){let A7=g.join(F9,sQ);if(V.push(A7),await c(A7)){F=A7;break}}if(F)break;K5.push({path:F9,depth:W1.depth+1})}}}catch{}if(F)break}if(F)n4.set(F1,F)}if(!F||!await c(F)){let P=V.length>0?`
11490
+ `+J}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4))),J0=[];for(let B0 of n(J)){if(!/\bserver\b/i.test(B0.attrs))continue;let M0=B0.start+B0.fullMatch.indexOf(">")+1,C=cB(J,M0);if(C===-1)continue;let P=C+9;while(P<J.length&&/\s/.test(J[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:M0,end:C}=J0[B0];J=J.substring(0,M0)+J.substring(C)}}let Q0=I4(J,Y);if(Q0.hasScoped)J=Q0.html;let G0=Z.__stx_event_bindings||[],D0=!1,r0=[],L1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:Q5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4)));for(let n of Q5(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))r0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of r0){D0=!0;let M0=B0;I6(B0,Y,X.strict);let C=await u1(B0,{eventBindings:G0,attrs:J0,hasColonDirectives:L1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(n,()=>C)}if(D0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=xZ(J,Z.cspNonce);return J}var Y5="<!--PARENT_CONTENT_PLACEHOLDER-->";var z4=k(()=>{m7();l1();I7();$Z();JZ();GZ();k7();E7();BZ();z5();FZ();wZ();X4();gZ();dZ();pZ();sZ();B1();U$();J1();$2();Q2();GY();UY();o3();C6();HY();L5();LY();Y6();w0();TY();DY();SY();PY();Q6();K6();pY();M$();i3();BX();T6();E6();O0();F3();y7();n5();T6();E6()});var xJ=()=>{};var v6={};t(v6,{renderSlot:()=>gJ,processSlots:()=>uJ,parseSlots:()=>fJ,parseSlotElement:()=>Xj,extractSlotContent:()=>Gj,applySlots:()=>Kj});function eB($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function Zj($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function Yj($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let _=$.indexOf("-->",J+4);Q=_===-1?$.length:_+3;continue}let G=Zj($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let _=Y.lastIndexOf(U);if(_!==-1)Y.splice(_);Q=G;continue}if(U==="template"&&Y.length===0){let _=K.match(X);if(_){let B=eB($,G);if(B!==-1){let j=_[1]||_[2]||_[3];Z.push({start:J,end:B,slotName:j,content:$.slice(G,B-11).trim(),propsBinding:_[4]||void 0}),Q=B;continue}}}if(!/\/\s*>$/.test(K)&&!$j.has(U)){if(Y.push(U),U==="script"||U==="style"){let _=$.toLowerCase().indexOf(`</${U}>`,G);if(_!==-1){Q=_;continue}}}Q=G}return Z}function fJ($){let Z={default:"",named:new Map},Y=$,X=Yj($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,_,B]=G,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(j+H).trim(),F=`<${W}${L?" "+L:""}>${B}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+j).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function Xj($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function gJ($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((_)=>_.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=Jj(Q,G)}return Q}function Jj($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=hJ(Q,Z);return t0(String(J??""))}catch{return`{{ ${X} }}`}})}function hJ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function uJ($,Z,Y){let X=$;X=await Qj(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",_=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=hJ(F,Y)}return await gJ(U,B,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function Qj($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function Gj($){let Z=fJ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Kj($,Z,Y,X){return await uJ($,{default:Z,named:Y},X)}var $j;var x6=k(()=>{J1();O0();$j=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import qj from"fs";import g from"path";function Uj($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function dJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zj($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function d1($){return!zj($)}function m1($){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,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function _j($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
11491
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function Bj($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function jj($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Hj($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of Bj(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=jj(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let _=W.slice(U+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[z]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function F4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Q._rootComponentsDir),B(g.join(g.dirname(X),"components")),B(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(U)B(g.resolve(U,"resources/views/components")),B(g.resolve(U,"resources/components")),B(g.resolve(U,"src/components")),B(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(g.resolve(g.dirname(X),`${J}.stx`));for(let L of _){let F=g.isAbsolute(L)?L:g.resolve(z,L);for(let O of W)if(await c(g.join(F,O)))return!0}return!1}function Oj($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Lj($){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 Fj($){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 X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function t1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (D5(),A4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&Oj(_)?_:"";try{let j=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let P=[L,L.toLowerCase(),j(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],l=Q.__originalFilePath,d=[];if(l){let W0=g.join(g.dirname(l),"components");d.push(W0)}if(X)d.push(X);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!d.includes(z0))d.push(z0);let V0=g.join(g.dirname(J),"components");if(!d.includes(V0))d.push(V0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let q1=G._pluginComponentDirs;if(Array.isArray(q1)){for(let W0 of q1)if(typeof W0==="string"&&!d.includes(W0))d.push(W0)}let p0=typeof G.root==="string"?g.resolve(G.root):void 0,P0=p0??g.dirname(J),o0=[];if(p0)o0.push(g.resolve(p0,"resources/views/components")),o0.push(g.resolve(p0,"resources/components")),o0.push(g.resolve(p0,"src/components")),o0.push(g.resolve(p0,"components"));o0.push(g.resolve(import.meta.dir,"components"));for(let W0 of o0)if(!d.includes(W0))d.push(W0);let v1=[...new Set(d.map((W0)=>{if(!W0)return W0;return g.isAbsolute(W0)?W0:g.resolve(P0,W0)}))];d.length=0,d.push(...v1);let F1=`${L}\x00${J}\x00${v1.join("\x00")}`,G5=n4.get(F1);if(G5)if(await c(G5))F=G5;else n4.delete(F1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=g.resolve(g.dirname(J),`${L}.stx`),V.push(F);else if(!F)for(let W0 of d){if(!W0)continue;for(let i of x){let g0=g.join(W0,i);if(V.push(g0),await c(g0)){F=g0;break}}if(F)break;if(!F)try{let i=await import("fs");if(!i.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let d5=8,K5=[{path:W0,depth:0}];while(K5.length>0&&!F){let W1=K5.pop();if(W1.depth>=d5)continue;let b$;try{b$=i.readdirSync(W1.path,{withFileTypes:!0})}catch{continue}for(let S$ of b$){if(!S$.isDirectory())continue;if(S$.name==="node_modules"||S$.name.startsWith("."))continue;let w9=g.join(W1.path,S$.name);for(let $G of x){let A7=g.join(w9,$G);if(V.push(A7),await c(A7)){F=A7;break}}if(F)break;K5.push({path:w9,depth:W1.depth+1})}}}catch{}if(F)break}if(F)n4.set(F1,F)}if(!F||!await c(F)){let P=V.length>0?`
11435
11492
  Searched paths:
11436
11493
  ${V.map((x)=>` - ${x}`).join(`
11437
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(F);let w;if(i4.has(F))w=i4.get(F);else try{w=await Bun.file(F).text(),i4.set(F,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents",g$]),M={};for(let[P,x]of Object.entries(Q))if(!P.startsWith("__")||A.has(P))M[P]=x;let{extractSlotContent:R}=await e("stx/slots",()=>Promise.resolve().then(() => (C6(),P6))),N=R(Y),T={};if(N.defaultSlot?.trim())T.default=N.defaultSlot;for(let[P,x]of N.namedSlots)T[P]=x.content;let I={...M,...Z,props:Z,slot:Y,$slots:T,__processedComponents:z,__sections:{},...Gj(Y)&&{__stx_force_signals:!0}};Jj(w,I);let D=w,E=A5(D);if(E)D=E.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&S.every((P)=>/\bserver\b/.test(P[1]||"")),h=null,f=null;if(v){let P=eB({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){h=`${F}\x00${P}`;let x=v6.get(h);if(x){for(let l of x.dependencies)q.add(l);return x.output}f=new Set(q)}}for(let P of S){let x=P[1]||"",l=P[2]||"",d=x.includes("server");if(d1(x)&&l.trim())l=m1(l);if(d&&l)try{await W(l,I,F)}catch(V0){}if(!d){let V0=l.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),q1=V0.includes("{{")&&V0.includes("}}"),p0=V0.includes("{!!")&&V0.includes("!!}");if(q1||p0)V0=m$(V0,I);let P0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${P0}>${V0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",I0=m?m[2]:"",E0="",l0=r&&/\bscoped\b/i.test(r);if(m)E0=`<style${r}>${I0}</style>`;let Q0=D;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Q0=Q0.replace(P,(l,d)=>{let z0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)x.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)E0=`${E0}${x.join(`
11438
- `)}`}if(Y&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:G0}=await e("stx/slots",()=>Promise.resolve().then(() => (C6(),P6))),{defaultSlot:D0,namedSlots:o0}=N;Q0=await G0(Q0,D0,o0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let l=v7(x);I[P]=l}}let L1=b.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Q5=Kj(b);if(Q5.length>0)I.__stx_client_signal_names=Q5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:L1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let J0=await L0(Q0,I,F,n,q),B0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let P of J0.matchAll(/\{\{([\s\S]*?)\}\}/g))B0.add(P[1].trim());if(B0.size>0)Q.__stx_preserved_client_expressions=[...B0];let M0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++tB}_${Math.random().toString(36).slice(2,8)}`,C=J0;if(L1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${vJ(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${vJ(B)}"`:"";C=`<div data-stx-scope="${M0}"${P}${x}>${J0}</div>`;let l=await Promise.all(b.map(async(d)=>{let z0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return d;let[,V0,q1]=z0,p0=v$(q1,{filePath:F,projectRoot:process.cwd()}),P0=p0.code,r0=x$(p0.styles);P0=U5(P0).code;let{hasUserImports:v1,bundleClientScript:F1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5)));if(v1(P0))P0=await F1(P0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:G5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4)));P0=P0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(W1,b$)=>G5(b$));let W0=a0(P0),i=Zj(W0),g0=`function(__scopeId) {
11439
- ${j5("const",[...g8,...i],W0)}
11494
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(F);let w;if(i4.has(F))w=i4.get(F);else try{w=await Bun.file(F).text(),i4.set(F,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents",g$]),M={};for(let[P,x]of Object.entries(Q))if(!P.startsWith("__")||A.has(P))M[P]=x;let{extractSlotContent:R}=await e("stx/slots",()=>Promise.resolve().then(() => (x6(),v6))),N=R(Y),T={};if(N.defaultSlot?.trim())T.default=N.defaultSlot;for(let[P,x]of N.namedSlots)T[P]=x.content;let I={...M,...Z,props:Z,slot:Y,$slots:T,__processedComponents:z,__sections:{},...Lj(Y)&&{__stx_force_signals:!0}};Hj(w,I);let D=w,E=A5(D);if(E)D=E.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&S.every((P)=>/\bserver\b/.test(P[1]||"")),h=null,f=null;if(v){let P=Uj({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){h=`${F}\x00${P}`;let x=f6.get(h);if(x){for(let l of x.dependencies)q.add(l);return x.output}f=new Set(q)}}for(let P of S){let x=P[1]||"",l=P[2]||"",d=x.includes("server");if(d1(x)&&l.trim())l=m1(l);if(d&&l)try{await W(l,I,F)}catch(V0){}if(!d){let V0=l.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),q1=V0.includes("{{")&&V0.includes("}}"),p0=V0.includes("{!!")&&V0.includes("!!}");if(q1||p0)V0=m$(V0,I);let P0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${P0}>${V0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",I0=m?m[2]:"",E0="",l0=r&&/\bscoped\b/i.test(r);if(m)E0=`<style${r}>${I0}</style>`;let Q0=D;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Q0=Q0.replace(P,(l,d)=>{let z0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)x.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)E0=`${E0}${x.join(`
11495
+ `)}`}if(Y&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:G0}=await e("stx/slots",()=>Promise.resolve().then(() => (x6(),v6))),{defaultSlot:D0,namedSlots:r0}=N;Q0=await G0(Q0,D0,r0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let l=v7(x);I[P]=l}}let L1=b.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Q5=Fj(b);if(Q5.length>0)I.__stx_client_signal_names=Q5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:L1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let J0=await L0(Q0,I,F,n,q),B0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let P of J0.matchAll(/\{\{([\s\S]*?)\}\}/g))B0.add(P[1].trim());if(B0.size>0)Q.__stx_preserved_client_expressions=[...B0];let M0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++Wj}_${Math.random().toString(36).slice(2,8)}`,C=J0;if(L1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${dJ(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${dJ(B)}"`:"";C=`<div data-stx-scope="${M0}"${P}${x}>${J0}</div>`;let l=await Promise.all(b.map(async(d)=>{let z0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return d;let[,V0,q1]=z0,p0=v$(q1,{filePath:F,projectRoot:process.cwd()}),P0=p0.code,o0=x$(p0.styles);P0=U5(P0).code;let{hasUserImports:v1,bundleClientScript:F1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (e5(),t5)));if(v1(P0))P0=await F1(P0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:G5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (M$(),d4)));P0=P0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(W1,b$)=>G5(b$));let W0=a0(P0),i=_j(W0),g0=`function(__scopeId) {
11496
+ ${j5("const",[...d8,...i],W0)}
11440
11497
  const __scope = window.stx._scopes = window.stx._scopes || {};
11441
11498
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
11442
11499
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -11463,15 +11520,15 @@ catch (e) {}
11463
11520
  finally {
11464
11521
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
11465
11522
  }
11466
- }`,d5=B?null:V8(Q,g0),K5=d5?`window.__stxComponentFactories[${JSON.stringify(d5)}](${JSON.stringify(M0)});`:`(${g0})(${JSON.stringify(M0)});`;if(B)return`${r0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${V0}>${K5}</script>`;return`${r0}<script data-stx-scoped${V0}>${K5}</script>`}));if(C=C+`
11523
+ }`,d5=B?null:R8(Q,g0),K5=d5?`window.__stxComponentFactories[${JSON.stringify(d5)}](${JSON.stringify(M0)});`:`(${g0})(${JSON.stringify(M0)});`;if(B)return`${o0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${V0}>${K5}</script>`;return`${o0}<script data-stx-scoped${V0}>${K5}</script>`}));if(C=C+`
11467
11524
  `+l.join(`
11468
11525
  `),E0)C+=`
11469
11526
  `+E0}else{if(E0)C+=`
11470
11527
  `+E0;if(b.length>0){let P=I.__stx_event_bindings||[],x=h1(I),l=await Promise.all(b.map(async(d)=>{let z0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!z0)return d;return await u1(z0[1],{eventBindings:P,templateContent:C,filePath:F,projectRoot:process.cwd(),serverData:x})}));C+=`
11471
11528
  `+l.join(`
11472
- `),I.__stx_event_bindings=[]}}if(l0){let P=I4(C,F);if(P.hasScoped)C=P.html}if(h&&f)v6.set(h,{output:C,dependencies:[...q].filter((P)=>!f.has(P))});return C}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function x6($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function S6($,Z,Y,X){let Q=await qj($,Z,Y,X);if(Q===null)return null;let J=x6(Q,process.cwd());if(J)return J;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 q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(x6(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function qj($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let _=g.join(J,$),B=x6(_,J);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await c(B)&&X)X.add(B);return B}let G=g.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await c(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(X)X.add(B);return B}}let K="",q=g.resolve(Q),W=process.cwd();for(let _=0;_<10;_++){let B=g.join(q,"layouts"),j=!1;try{j=aB.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=B;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,B=g.join(K,_);if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(X)X.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let _=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=g.join(_,B);if(await c(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=g.join(Y.partialsDir||Q,"layouts",_[1]);if(await c(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(X)X.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await c(K)){let _=g.join(K,$);if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let _=`${z}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(X)X.add(_);return _}}if(Q.includes("temp")){let _=g.join(g.dirname(Q),"layouts",$);if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}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 xJ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
11529
+ `),I.__stx_event_bindings=[]}}if(l0){let P=I4(C,F);if(P.hasScoped)C=P.html}if(h&&f)f6.set(h,{output:C,dependencies:[...q].filter((P)=>!f.has(P))});return C}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function g6($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function P6($,Z,Y,X){let Q=await Vj($,Z,Y,X);if(Q===null)return null;let J=g6(Q,process.cwd());if(J)return J;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 q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(g6(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function Vj($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let _=g.join(J,$),B=g6(_,J);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await c(B)&&X)X.add(B);return B}let G=g.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await c(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(X)X.add(B);return B}}let K="",q=g.resolve(Q),W=process.cwd();for(let _=0;_<10;_++){let B=g.join(q,"layouts"),j=!1;try{j=qj.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=B;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,B=g.join(K,_);if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(X)X.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let _=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=g.join(_,B);if(await c(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=g.join(Y.partialsDir||Q,"layouts",_[1]);if(await c(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(X)X.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await c(K)){let _=g.join(K,$);if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let _=`${z}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(X)X.add(_);return _}}if(Q.includes("temp")){let _=g.join(g.dirname(Q),"layouts",$);if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}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 mJ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
11473
11530
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,_)=>{let B=W+_+1;return`${B===X?"> ":" "}${B}: ${z}`}).join(`
11474
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return xJ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function U0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=xJ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
11531
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return mJ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function U0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=mJ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
11475
11532
  `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
11476
11533
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
11477
11534
  `;if(U+=`
@@ -11484,8 +11541,8 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
11484
11541
  `,K)U+=`
11485
11542
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
11486
11543
  ${Z0.dim}${K}${Z0.reset}
11487
- `;return U}function cY(){i4.clear(),n4.clear(),v6.clear()}var i4,n4,v6,tB=0,Z0;var w0=k(()=>{z5();y7();J1();Q$();L5();z4();x1();Q6();W4();n5();bJ();D5();i4=new p1(500),n4=new p1(1000),v6=new p1(2000);Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function kJ($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,_=U,B=-1;while(z>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
11488
- `||O==="\r"||O===" "||O===void 0)z++;_=L+9}else{if(z--,z===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(U,B),H=$.slice(K,B+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=B+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let _={gfm:z.gfm??!0,breaks:z.breaks??!1},B=i5(W.trim(),_);X=X.split(K).join(B)}catch(z){let _=z instanceof Error?z.message:String(z),B=U0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,U,K);X=X.split(K).join(B)}return X}async function fJ($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),i5($.trim(),Q)}var y6=k(()=>{w0()});function zj($){if(Wj.set($.name,$),$.client)Uj.set($.name,$.client)}function s4($){return zj($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=_j(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function _j($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var Wj,Uj;var f6=k(()=>{Wj=new Map,Uj=new Map});function g6($,Z=g5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${D$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function gJ($,Z,Y=Bj,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${D$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function h6($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function D$($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function u6($){return jj[$]||"application/octet-stream"}var g5,Bj,E$,jj;var d6=k(()=>{g5=[320,480,640,768,1024,1280,1536,1920,2560],Bj=[1,1.5,2,3],E$=["avif","webp","jpeg"],jj={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Oj(){try{return await import("ts-images")}catch{return null}}async function Lj($,Z={}){let Y={...Hj,...Z},X=await Oj();if(X)try{return await Fj($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return Vj($,Y)}async function Fj($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function Vj($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function hJ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
11544
+ `;return U}function aY(){i4.clear(),n4.clear(),f6.clear()}var i4,n4,f6,Wj=0,Z0;var w0=k(()=>{z5();y7();J1();Q$();L5();z4();x1();Q6();W4();n5();xJ();D5();i4=new p1(500),n4=new p1(1000),f6=new p1(2000);Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function vJ($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,_=U,B=-1;while(z>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
11545
+ `||O==="\r"||O===" "||O===void 0)z++;_=L+9}else{if(z--,z===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(U,B),H=$.slice(K,B+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=B+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let _={gfm:z.gfm??!0,breaks:z.breaks??!1},B=i5(W.trim(),_);X=X.split(K).join(B)}catch(z){let _=z instanceof Error?z.message:String(z),B=U0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,U,K);X=X.split(K).join(B)}return X}async function lJ($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),i5($.trim(),Q)}var C6=k(()=>{w0()});function Rj($){if(wj.set($.name,$),$.client)Aj.set($.name,$.client)}function s4($){return Rj($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=Mj(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function Mj($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var wj,Aj;var h6=k(()=>{wj=new Map,Aj=new Map});function u6($,Z=g5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${D$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function pJ($,Z,Y=Nj,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${D$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function d6($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function D$($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function m6($){return Tj[$]||"application/octet-stream"}var g5,Nj,E$,Tj;var l6=k(()=>{g5=[320,480,640,768,1024,1280,1536,1920,2560],Nj=[1,1.5,2,3],E$=["avif","webp","jpeg"],Tj={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Ej(){try{return await import("ts-images")}catch{return null}}async function Dj($,Z={}){let Y={...Ij,...Z},X=await Ej();if(X)try{return await kj($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return bj($,Y)}async function kj($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{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 bj($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function cJ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
11489
11546
  #${$} {
11490
11547
  --stx-img-transition-duration: ${X}ms;
11491
11548
  --stx-img-transition-easing: ${Q};
@@ -11502,7 +11559,7 @@ ${Z0.dim}${K}${Z0.reset}
11502
11559
  #${$}.stx-img-loaded img {
11503
11560
  opacity: 1;
11504
11561
  }
11505
- `.trim()}async function uJ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(m6.has(Y))return m6.get(Y);let X=await Lj($,Z);return m6.set(Y,X),X}var Hj,l6,m6;var dJ=k(()=>{Hj={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},l6=`
11562
+ `.trim()}async function iJ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(p6.has(Y))return p6.get(Y);let X=await Dj($,Z);return p6.set(Y,X),X}var Ij,c6,p6;var nJ=k(()=>{Ij={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},c6=`
11506
11563
  .stx-img-placeholder {
11507
11564
  position: relative;
11508
11565
  overflow: hidden;
@@ -11531,8 +11588,8 @@ ${Z0.dim}${K}${Z0.reset}
11531
11588
  filter: blur(0);
11532
11589
  transform: scale(1);
11533
11590
  }
11534
- `.trim();m6=new Map});import{createHash as lJ}from"crypto";import{readFile as wj,stat as pJ}from"fs/promises";async function S0($){try{let Z=await wj($);return lJ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function mJ($){return lJ("sha256").update($).digest("hex").slice(0,16)}function o4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${mJ($)}-${mJ(Y)}`}async function p6($){try{return(await pJ($)).mtimeMs}catch{return 0}}async function T0($){try{return await pJ($),!0}catch{return!1}}var X5=()=>{};import{mkdir as Aj,readFile as Rj,writeFile as Mj,readdir as SM,rm as Nj,stat as yM}from"fs/promises";import{join as iJ,dirname as Tj}from"path";async function Ij($){try{await Aj($,{recursive:!0})}catch{}}function nJ($,Z,Y){return iJ($,Y,`${Z}.json`)}async function cJ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await p6(Z)!==$.srcMtime)return!1;return!0}async function r4($,Z,Y,X=c6){if(!X.enabled)return null;let Q=o4($,Z),J=h5.get(Q);if(J){if(await cJ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;h5.delete(Q)}let G=nJ(X.directory,Q,Y);if(await T0(G))try{let K=await Rj(G,"utf-8"),q=JSON.parse(K);if(await cJ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),h5.set(Q,q),q.data}catch{}return null}async function a4($,Z,Y,X,Q=c6){if(!Q.enabled)return;let J=o4($,Z),G=await S0($),K=await p6($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:o4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};h5.set(J,q);let W=nJ(Q.directory,J,X);try{await Ij(Tj(W)),await Mj(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function t4($,Z=c6){if($==="all")h5.clear();else h5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=iJ(Z.directory,X);try{await Nj(Q,{recursive:!0,force:!0})}catch{}}}var h5,c6;var i6=k(()=>{X5();h5=new Map,c6={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class $7{config;constructor($={}){this.config={...Ej,...$}}async get($,Z){return r4($,Z,"image",this.config)}async set($,Z,Y){return a4($,Z,Y,"image",this.config)}async clear(){return t4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function n6($){if(!e4)e4=new $7($);else if($)e4.updateConfig($);return e4}async function Z7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n6(X).get($,Z)}async function Y7($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return n6(Q).set($,Z,Y)}async function sJ(){return n6().clear()}var Ej,e4=null;var s6=k(()=>{i6();Ej={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Dj,basename as kj,extname as bj,join as Sj}from"path";import{mkdir as yj}from"fs/promises";async function o6(){try{return await import("ts-images")}catch{return null}}function oJ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function Pj($,Z){let Y=Z?oJ(Z):oJ("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function rJ($,Z,Y){let X=await o6();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await Z7($,Z,Y);if(Q)return Q;try{let J=Dj($);if(!await T0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=Pj(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await yj(K,{recursive:!0});let W=await S0(J),U=kj($,bj($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await r6(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=Sj(K,L);try{let O=await X.optimizeImage({input:B||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await Y7($,Z,_,Y),_}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function aJ($,Z,Y,X){let Q=await o6();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function r6($,Z,Y){let X=Y||await o6();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var tJ=k(()=>{X5();s6()});import{resolve as Cj,basename as vj,extname as xj,join as fj}from"path";import{mkdir as gj}from"fs/promises";async function hj(){try{return await import("ts-images")}catch{return null}}async function eJ($,Z,Y){let X=await hj();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Cj($);if(!await T0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||uj,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await gj(K,{recursive:!0});let W=await S0(Q),U=vj($,xj($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=fj(K,F),V=`${q}/${F}`;try{let w=z[j]?.quality||80;if(await T0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await X.generateThumbHash(Q);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||dj(J),_}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function dj($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function $Q($,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 uj;var ZQ=k(()=>{X5();uj=[320,480,640,768,1024,1280,1536,1920]});var YQ={};t(YQ,{setCachedImageResult:()=>Y7,processImage:()=>rJ,optimizeImage:()=>aJ,getCachedImageResult:()=>Z7,generateSrcset:()=>$Q,generateResponsiveVariants:()=>eJ,clearImageCache:()=>sJ,applyTransformations:()=>r6,ImageProcessorCache:()=>$7});var XQ=k(()=>{tJ();ZQ();s6()});async function mj(){try{return await Promise.resolve().then(() => (XQ(),YQ))}catch($){if(!JQ)console.warn("[stx-media] Image processor not available, some features disabled:",$),JQ=!0;return null}}async function X7($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return ij(X,Y)}if(Y.processedResult?.processed)return $9($,Y.processedResult,Z);if(Y.responsiveVariants)return qQ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=g5,dpr:U,formats:z=E$,quality:_=a6,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":Q7,decoding:V=J7,fetchpriority:w,objectFit:A,objectPosition:M,crossorigin:R,referrerpolicy:N}=$,T=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return cj($);let b,v,h=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await uJ(Q,{strategy:j,...H}),v=hJ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=pj($,h,b,Z);else m=await lj($,h,b,Z);let r;if(F){let l0=z.includes("webp")?"webp":z[0],Q0=g6(Q,W,{...B,q:_},l0),G0=typeof q==="object"?h6(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Q0}" imagesizes="${G0}" />`}let I0=[];if(!QQ&&j!=="none")I0.push(l6),QQ=!0;if(v)I0.push(v);let E0=L?KQ(h):void 0;return{html:m,preloadLink:r,css:I0.length>0?I0.join(`
11535
- `):void 0,script:E0}}async function lj($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=g5,formats:U=E$,quality:z=a6,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":Q7,decoding:L=J7,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,M=$.class,R=$.style,N=$.data||{},T=typeof q==="object"?h6(q):q||"100vw",I=[];for(let y of U){let S=g6(Q,W,{..._,q:z},y),b=u6(y);if(B&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${T}" />`)}let D=t6({src:D$(Q,{..._,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:GQ(M,Y),style:e6(R,O,V,Y),lazy:B&&!j,data:N}),E;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
11591
+ `.trim();p6=new Map});import{createHash as rJ}from"crypto";import{readFile as Sj,stat as oJ}from"fs/promises";async function S0($){try{let Z=await Sj($);return rJ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function sJ($){return rJ("sha256").update($).digest("hex").slice(0,16)}function r4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${sJ($)}-${sJ(Y)}`}async function i6($){try{return(await oJ($)).mtimeMs}catch{return 0}}async function T0($){try{return await oJ($),!0}catch{return!1}}var X5=()=>{};import{mkdir as yj,readFile as Pj,writeFile as Cj,readdir as cM,rm as vj,stat as iM}from"fs/promises";import{join as tJ,dirname as xj}from"path";async function fj($){try{await yj($,{recursive:!0})}catch{}}function eJ($,Z,Y){return tJ($,Y,`${Z}.json`)}async function aJ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await i6(Z)!==$.srcMtime)return!1;return!0}async function o4($,Z,Y,X=n6){if(!X.enabled)return null;let Q=r4($,Z),J=h5.get(Q);if(J){if(await aJ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;h5.delete(Q)}let G=eJ(X.directory,Q,Y);if(await T0(G))try{let K=await Pj(G,"utf-8"),q=JSON.parse(K);if(await aJ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),h5.set(Q,q),q.data}catch{}return null}async function a4($,Z,Y,X,Q=n6){if(!Q.enabled)return;let J=r4($,Z),G=await S0($),K=await i6($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:r4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};h5.set(J,q);let W=eJ(Q.directory,J,X);try{await fj(xj(W)),await Cj(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function t4($,Z=n6){if($==="all")h5.clear();else h5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=tJ(Z.directory,X);try{await vj(Q,{recursive:!0,force:!0})}catch{}}}var h5,n6;var s6=k(()=>{X5();h5=new Map,n6={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class $7{config;constructor($={}){this.config={...gj,...$}}async get($,Z){return o4($,Z,"image",this.config)}async set($,Z,Y){return a4($,Z,Y,"image",this.config)}async clear(){return t4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function r6($){if(!e4)e4=new $7($);else if($)e4.updateConfig($);return e4}async function Z7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return r6(X).get($,Z)}async function Y7($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return r6(Q).set($,Z,Y)}async function $Q(){return r6().clear()}var gj,e4=null;var o6=k(()=>{s6();gj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as hj,basename as uj,extname as dj,join as mj}from"path";import{mkdir as lj}from"fs/promises";async function a6(){try{return await import("ts-images")}catch{return null}}function ZQ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function pj($,Z){let Y=Z?ZQ(Z):ZQ("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function YQ($,Z,Y){let X=await a6();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await Z7($,Z,Y);if(Q)return Q;try{let J=hj($);if(!await T0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=pj(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await lj(K,{recursive:!0});let W=await S0(J),U=uj($,dj($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await t6(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=mj(K,L);try{let O=await X.optimizeImage({input:B||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await Y7($,Z,_,Y),_}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function XQ($,Z,Y,X){let Q=await a6();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function t6($,Z,Y){let X=Y||await a6();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var JQ=k(()=>{X5();o6()});import{resolve as cj,basename as ij,extname as nj,join as sj}from"path";import{mkdir as rj}from"fs/promises";async function oj(){try{return await import("ts-images")}catch{return null}}async function QQ($,Z,Y){let X=await oj();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=cj($);if(!await T0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||aj,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await rj(K,{recursive:!0});let W=await S0(Q),U=ij($,nj($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=sj(K,F),V=`${q}/${F}`;try{let w=z[j]?.quality||80;if(await T0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await X.generateThumbHash(Q);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||tj(J),_}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function tj($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function GQ($,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 aj;var KQ=k(()=>{X5();aj=[320,480,640,768,1024,1280,1536,1920]});var qQ={};t(qQ,{setCachedImageResult:()=>Y7,processImage:()=>YQ,optimizeImage:()=>XQ,getCachedImageResult:()=>Z7,generateSrcset:()=>GQ,generateResponsiveVariants:()=>QQ,clearImageCache:()=>$Q,applyTransformations:()=>t6,ImageProcessorCache:()=>$7});var WQ=k(()=>{JQ();KQ();o6()});async function ej(){try{return await Promise.resolve().then(() => (WQ(),qQ))}catch($){if(!UQ)console.warn("[stx-media] Image processor not available, some features disabled:",$),UQ=!0;return null}}async function X7($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return XH(X,Y)}if(Y.processedResult?.processed)return Y9($,Y.processedResult,Z);if(Y.responsiveVariants)return jQ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=g5,dpr:U,formats:z=E$,quality:_=e6,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":Q7,decoding:V=J7,fetchpriority:w,objectFit:A,objectPosition:M,crossorigin:R,referrerpolicy:N}=$,T=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return YH($);let b,v,h=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await iJ(Q,{strategy:j,...H}),v=cJ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=ZH($,h,b,Z);else m=await $H($,h,b,Z);let r;if(F){let l0=z.includes("webp")?"webp":z[0],Q0=u6(Q,W,{...B,q:_},l0),G0=typeof q==="object"?d6(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Q0}" imagesizes="${G0}" />`}let I0=[];if(!zQ&&j!=="none")I0.push(c6),zQ=!0;if(v)I0.push(v);let E0=L?BQ(h):void 0;return{html:m,preloadLink:r,css:I0.length>0?I0.join(`
11592
+ `):void 0,script:E0}}async function $H($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=g5,formats:U=E$,quality:z=e6,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":Q7,decoding:L=J7,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,M=$.class,R=$.style,N=$.data||{},T=typeof q==="object"?d6(q):q||"100vw",I=[];for(let y of U){let S=u6(Q,W,{..._,q:z},y),b=m6(y);if(B&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${T}" />`)}let D=$9({src:D$(Q,{..._,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:_Q(M,Y),style:Z9(R,O,V,Y),lazy:B&&!j,data:N}),E;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
11536
11593
  <picture>
11537
11594
  ${I.join(`
11538
11595
  `)}
@@ -11542,9 +11599,9 @@ ${I.join(`
11542
11599
  ${I.join(`
11543
11600
  `)}
11544
11601
  <img ${D} />
11545
- </picture>`;return E}function pj($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=a6,params:U={},lazy:z=!0,priority:_=!1,loading:B=_?"eager":Q7,decoding:j=J7,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,M=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),N=gJ(Q,R,q,{...U,q:W}),T=t6({src:D$(Q,{...U,w:R,q:W}),alt:J,width:G,height:K,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:GQ(w,Y),style:e6(A,L,F,Y),lazy:z&&!_,data:M}),I=z&&!_?`data-srcset="${N}"`:`srcset="${N}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
11602
+ </picture>`;return E}function ZH($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=e6,params:U={},lazy:z=!0,priority:_=!1,loading:B=_?"eager":Q7,decoding:j=J7,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,M=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),N=pJ(Q,R,q,{...U,q:W}),T=$9({src:D$(Q,{...U,w:R,q:W}),alt:J,width:G,height:K,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:_Q(w,Y),style:Z9(A,L,F,Y),lazy:z&&!_,data:M}),I=z&&!_?`data-srcset="${N}"`:`srcset="${N}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
11546
11603
  <img ${T} ${I} />
11547
- </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function cj($){let{src:Z,alt:Y,width:X,height:Q,loading:J=Q7,decoding:G=J7,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${t6({src:Z,alt:Y,width:X,height:Q,loading:_?"eager":J,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:B,style:e6(j,q,W),id:H,data:L})} />`}}function t6($){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,X]of Object.entries($.data))Z.push(`data-${Y}="${Y1(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function GQ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function e6($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function Y1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function KQ($){return`
11604
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function YH($){let{src:Z,alt:Y,width:X,height:Q,loading:J=Q7,decoding:G=J7,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${$9({src:Z,alt:Y,width:X,height:Q,loading:_?"eager":J,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:B,style:Z9(j,q,W),id:H,data:L})} />`}}function $9($){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,X]of Object.entries($.data))Z.push(`data-${Y}="${Y1(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function _Q($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function Z9($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function Y1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BQ($){return`
11548
11605
  (function() {
11549
11606
  const container = document.getElementById('${$}');
11550
11607
  if (!container) return;
@@ -11581,7 +11638,7 @@ ${I.join(`
11581
11638
 
11582
11639
  observer.observe(container);
11583
11640
  })();
11584
- `.trim()}async function ij($,Z){let Y=await mj();if(!Y)return X7({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return qQ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return $9($,J,Z)}return X7({...$,process:!1},Z)}async function $9($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],M=["avif","webp","jpeg","png"];for(let v of M){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=u6(v);if(G&&!K)A.push(` <source type="${m}" data-srcset="${f}" />`);else A.push(` <source type="${m}" srcset="${f}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${Y1(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${Y1(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${Y1(X)}"`);let N=Q||Z.originalWidth,T=J||Z.originalHeight;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(U)R.push(`crossorigin="${U}"`);if(z)R.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(_)D.push(_);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[v,h]of Object.entries(H))R.push(`data-${v}="${Y1(h)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${v}">
11641
+ `.trim()}async function XH($,Z){let Y=await ej();if(!Y)return X7({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return jQ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return Y9($,J,Z)}return X7({...$,process:!1},Z)}async function Y9($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],M=["avif","webp","jpeg","png"];for(let v of M){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=m6(v);if(G&&!K)A.push(` <source type="${m}" data-srcset="${f}" />`);else A.push(` <source type="${m}" srcset="${f}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${Y1(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${Y1(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${Y1(X)}"`);let N=Q||Z.originalWidth,T=J||Z.originalHeight;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(U)R.push(`crossorigin="${U}"`);if(z)R.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(_)D.push(_);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[v,h]of Object.entries(H))R.push(`data-${v}="${Y1(h)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${v}">
11585
11642
  <picture>
11586
11643
  ${A.join(`
11587
11644
  `)}
@@ -11591,12 +11648,12 @@ ${A.join(`
11591
11648
  ${A.join(`
11592
11649
  `)}
11593
11650
  <img ${R.join(" ")} />
11594
- </picture>`;let y=[];if(Z.placeholder)y.push(l6);let S=G?KQ(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:b,css:y.length>0?y.join(`
11595
- `):void 0,script:S}}async function qQ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return $9($,X,Y)}var JQ=!1,a6=80,J7="async",Q7="lazy",QQ=!1;var WQ=k(()=>{d6();dJ()});function nj(){return s4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=sj($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||g5,formats:G.formats||E$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await X7(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
11651
+ </picture>`;let y=[];if(Z.placeholder)y.push(c6);let S=G?BQ(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:b,css:y.length>0?y.join(`
11652
+ `):void 0,script:S}}async function jQ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return Y9($,X,Y)}var UQ=!1,e6=80,J7="async",Q7="lazy",zQ=!1;var HQ=k(()=>{l6();nJ()});function JH(){return s4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=QH($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||g5,formats:G.formats||E$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await X7(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
11596
11653
  `+U;if(W.css)U+=`
11597
11654
  <style>${W.css}</style>`;if(W.script)U+=`
11598
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function sj($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=oj(X),J=Z9(Q[0],Y)||"",G=Z9(Q[1],Y)||"",K={};if(Q[2]){let q=Z9(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function oj($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function Z9($,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 X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var UQ;var zQ=k(()=>{f6();WQ();d6();UQ=nj()});class K7{config;constructor($={}){this.config={...rj,...$}}async get($,Z){return r4($,Z,"video",this.config)}async set($,Z,Y){return a4($,Z,Y,"video",this.config)}async clear(){return t4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function Y9($){if(!G7)G7=new K7($);else if($)G7.updateConfig($);return G7}async function q7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Y9(X).get($,Z)}async function W7($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Y9(Q).set($,Z,Y)}async function _Q(){return Y9().clear()}var rj,G7=null;var X9=k(()=>{i6();rj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as J9,basename as Q9,extname as G9,join as U7}from"path";import{mkdir as K9}from"fs/promises";async function q9(){try{return await import("ts-videos")}catch{return null}}async function z7($,Z,Y,X){let Q=await q9();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=J9($);if(!await T0(J))return null;await K9(Y,{recursive:!0});let G=await S0(J),K=Q9($,G9($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=U7(Y,U),_=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(_&&_.length>0){let B=_[0];return{path:z,url:`${X}/${U}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function _7($,Z,Y,X){let Q=await q9();if(!Q)return[];try{let J=J9($);if(!await T0(J))return[];await K9(Y,{recursive:!0});let G=await S0(J),K=Q9($,G9($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,_=Z.count||10,B=Z.interval||z/_,j=[];for(let L=0;L<_&&L*B<z;L++)j.push(L*B);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||U7(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function BQ($,Z,Y,X){let Q=await q9();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=J9($);if(!await T0(J))return null;await K9(Y,{recursive:!0});let G=await S0(J),K=Q9($,G9($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/_),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=U7(Y,O),w=[];for(let M=0;M<L;M++)w.push(M*_);let A=await Q.extractThumbnails(J,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:U7(Y,".temp")});if(!A||A.length===0)return null;try{let M=await import("ts-images"),R=z*B,N=F*j,T=await M.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var W9=k(()=>{X5()});import{resolve as HQ,basename as OQ,extname as LQ,join as J5}from"path";import{mkdir as B7,writeFile as FQ}from"fs/promises";async function VQ(){try{return await import("ts-videos")}catch{return null}}async function j7($,Z,Y,X,Q){let J=await VQ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=HQ($);if(!await T0(G))return null;let K=await S0(G),q=OQ($,LQ($)),W=J5(Y,`${q}-${K}-hls`);await B7(W,{recursive:!0});let U=Z.length>0?Z:wQ,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=J5(W,V.label);await B7(w,{recursive:!0});let A=`${V.label}.m3u8`,M=J5(w,A);try{let R=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:M}),L+=R.segmentCount||Math.ceil(j/z)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=J5(W,"master.m3u8"),O=aj(H,X,q,K);return await FQ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function aj($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
11599
- `)}async function H7($,Z,Y,X,Q){let J=await VQ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=HQ($);if(!await T0(G))return null;let K=await S0(G),q=OQ($,LQ($)),W=J5(Y,`${q}-${K}-dash`);await B7(W,{recursive:!0});let U=Z.length>0?Z:wQ,z=Q?.segmentDuration||4,_=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let M=J5(W,A.label);await B7(M,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:M,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=J5(W,"manifest.mpd"),V=tj(L,F,H,z,_);await FQ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function tj($,Z,Y,X,Q){let J=jQ(Y),G=jQ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
11655
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function QH($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=GH(X),J=X9(Q[0],Y)||"",G=X9(Q[1],Y)||"",K={};if(Q[2]){let q=X9(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function GH($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function X9($,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 X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var OQ;var LQ=k(()=>{h6();HQ();l6();OQ=JH()});class K7{config;constructor($={}){this.config={...KH,...$}}async get($,Z){return o4($,Z,"video",this.config)}async set($,Z,Y){return a4($,Z,Y,"video",this.config)}async clear(){return t4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function J9($){if(!G7)G7=new K7($);else if($)G7.updateConfig($);return G7}async function q7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J9(X).get($,Z)}async function W7($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return J9(Q).set($,Z,Y)}async function FQ(){return J9().clear()}var KH,G7=null;var Q9=k(()=>{s6();KH={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as G9,basename as K9,extname as q9,join as U7}from"path";import{mkdir as W9}from"fs/promises";async function U9(){try{return await import("ts-videos")}catch{return null}}async function z7($,Z,Y,X){let Q=await U9();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=G9($);if(!await T0(J))return null;await W9(Y,{recursive:!0});let G=await S0(J),K=K9($,q9($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=U7(Y,U),_=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(_&&_.length>0){let B=_[0];return{path:z,url:`${X}/${U}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function _7($,Z,Y,X){let Q=await U9();if(!Q)return[];try{let J=G9($);if(!await T0(J))return[];await W9(Y,{recursive:!0});let G=await S0(J),K=K9($,q9($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,_=Z.count||10,B=Z.interval||z/_,j=[];for(let L=0;L<_&&L*B<z;L++)j.push(L*B);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||U7(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function VQ($,Z,Y,X){let Q=await U9();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=G9($);if(!await T0(J))return null;await W9(Y,{recursive:!0});let G=await S0(J),K=K9($,q9($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/_),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=U7(Y,O),w=[];for(let M=0;M<L;M++)w.push(M*_);let A=await Q.extractThumbnails(J,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:U7(Y,".temp")});if(!A||A.length===0)return null;try{let M=await import("ts-images"),R=z*B,N=F*j,T=await M.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var z9=k(()=>{X5()});import{resolve as AQ,basename as RQ,extname as MQ,join as J5}from"path";import{mkdir as B7,writeFile as NQ}from"fs/promises";async function TQ(){try{return await import("ts-videos")}catch{return null}}async function j7($,Z,Y,X,Q){let J=await TQ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=AQ($);if(!await T0(G))return null;let K=await S0(G),q=RQ($,MQ($)),W=J5(Y,`${q}-${K}-hls`);await B7(W,{recursive:!0});let U=Z.length>0?Z:IQ,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=J5(W,V.label);await B7(w,{recursive:!0});let A=`${V.label}.m3u8`,M=J5(w,A);try{let R=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:M}),L+=R.segmentCount||Math.ceil(j/z)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=J5(W,"master.m3u8"),O=qH(H,X,q,K);return await NQ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function qH($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
11656
+ `)}async function H7($,Z,Y,X,Q){let J=await TQ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=AQ($);if(!await T0(G))return null;let K=await S0(G),q=RQ($,MQ($)),W=J5(Y,`${q}-${K}-dash`);await B7(W,{recursive:!0});let U=Z.length>0?Z:IQ,z=Q?.segmentDuration||4,_=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let M=J5(W,A.label);await B7(M,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:M,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=J5(W,"manifest.mpd"),V=WH(L,F,H,z,_);await NQ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function WH($,Z,Y,X,Q){let J=wQ(Y),G=wQ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
11600
11657
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
11601
11658
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11602
11659
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -11622,7 +11679,7 @@ ${A.join(`
11622
11679
  </Representation>
11623
11680
  `}K+=` </AdaptationSet>
11624
11681
  `}return K+=` </Period>
11625
- </MPD>`,K}function jQ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var wQ;var U9=k(()=>{X5();wQ=[{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 AQ,basename as ej,extname as $H,join as ZH}from"path";import{mkdir as YH}from"fs/promises";async function RQ(){try{return await import("ts-videos")}catch{return null}}function XH($){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 JH($){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 z9($){let Z=await RQ();if(!Z)return null;try{let Y=AQ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function MQ($,Z,Y,X){let Q=await RQ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await q7($,Z,Y);if(J)return J;try{let G=AQ($);if(!await T0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await YH(K,{recursive:!0});let W=await S0(G),U=ej($,$H($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await z9(G)||void 0;let _={};if(Z.quality)_.bitrate=XH(Z.quality);if(Z.platform)Object.assign(_,JH(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let B=`${U}-${W}.mp4`,j=ZH(K,B);try{let H=await QH(G,j,_,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await z7(G,B,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let B=await _7(G,Y.thumbnails,K,q);if(B.length>0)z.thumbnails=B}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await j7(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await H7(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await W7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function QH($,Z,Y,X,Q){try{let G=await new X.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)=>{Q?.(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(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var NQ=k(()=>{X5();X9();W9();U9()});var TQ={};t(TQ,{setCachedVideoResult:()=>W7,processVideo:()=>MQ,getCachedVideoResult:()=>q7,generateThumbnails:()=>_7,generateSpriteSheet:()=>BQ,generatePoster:()=>z7,generateHLSManifest:()=>j7,generateDASHManifest:()=>H7,clearVideoCache:()=>_Q,analyzeVideo:()=>z9,VideoProcessorCache:()=>K7});var IQ=k(()=>{NQ();W9();U9();X9()});async function DQ(){try{return await Promise.resolve().then(() => (IQ(),TQ))}catch($){if(!EQ)console.warn("[stx-media] Video processor not available, some features disabled:",$),EQ=!0;return null}}async function O7($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return zH(X,Y)}if(Y.processedResult?.processed)return yQ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await _H(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=kQ,autoplay:U=!1,muted:z=!1,loop:_=!1,preload:B=bQ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:M=!1}=$,R=Q||K,N=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return qH($,Z);if(F&&F!=="video")return KH(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:SQ(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(M)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${F0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${F0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(N)E.push(`class="${F0(N)}"`);if(T)E.push(`style="${F0(T)}"`);let y=D.map((v)=>{return` <source ${H?`data-src="${F0(v.src)}"`:`src="${F0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
11682
+ </MPD>`,K}function wQ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var IQ;var _9=k(()=>{X5();IQ=[{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 EQ,basename as UH,extname as zH,join as _H}from"path";import{mkdir as BH}from"fs/promises";async function DQ(){try{return await import("ts-videos")}catch{return null}}function jH($){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 HH($){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 B9($){let Z=await DQ();if(!Z)return null;try{let Y=EQ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function kQ($,Z,Y,X){let Q=await DQ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await q7($,Z,Y);if(J)return J;try{let G=EQ($);if(!await T0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await BH(K,{recursive:!0});let W=await S0(G),U=UH($,zH($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await B9(G)||void 0;let _={};if(Z.quality)_.bitrate=jH(Z.quality);if(Z.platform)Object.assign(_,HH(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let B=`${U}-${W}.mp4`,j=_H(K,B);try{let H=await OH(G,j,_,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await z7(G,B,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let B=await _7(G,Y.thumbnails,K,q);if(B.length>0)z.thumbnails=B}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await j7(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await H7(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await W7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function OH($,Z,Y,X,Q){try{let G=await new X.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)=>{Q?.(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(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var bQ=k(()=>{X5();Q9();z9();_9()});var SQ={};t(SQ,{setCachedVideoResult:()=>W7,processVideo:()=>kQ,getCachedVideoResult:()=>q7,generateThumbnails:()=>_7,generateSpriteSheet:()=>VQ,generatePoster:()=>z7,generateHLSManifest:()=>j7,generateDASHManifest:()=>H7,clearVideoCache:()=>FQ,analyzeVideo:()=>B9,VideoProcessorCache:()=>K7});var yQ=k(()=>{bQ();z9();_9();Q9()});async function CQ(){try{return await Promise.resolve().then(() => (yQ(),SQ))}catch($){if(!PQ)console.warn("[stx-media] Video processor not available, some features disabled:",$),PQ=!0;return null}}async function O7($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return RH(X,Y)}if(Y.processedResult?.processed)return gQ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await MH(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=vQ,autoplay:U=!1,muted:z=!1,loop:_=!1,preload:B=xQ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:M=!1}=$,R=Q||K,N=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return VH($,Z);if(F&&F!=="video")return FH(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:fQ(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(M)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${F0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${F0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(N)E.push(`class="${F0(N)}"`);if(T)E.push(`style="${F0(T)}"`);let y=D.map((v)=>{return` <source ${H?`data-src="${F0(v.src)}"`:`src="${F0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
11626
11683
  `),S=`<video ${E.join(" ")}>
11627
11684
  ${y}
11628
11685
  Your browser does not support the video tag.
@@ -11661,9 +11718,9 @@ ${y}
11661
11718
 
11662
11719
  observer.observe(video);
11663
11720
  })();
11664
- `.trim();return{html:S,script:b}}function KH($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=WH($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=UH($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${F0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${F0(J)}"`);if(G)U.push(`style="${F0(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;">
11721
+ `.trim();return{html:S,script:b}}function FH($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=wH($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=AH($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${F0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${F0(J)}"`);if(G)U.push(`style="${F0(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;">
11665
11722
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
11666
- </div>`}}function qH($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
11723
+ </div>`}}function VH($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
11667
11724
  <div
11668
11725
  id="${L}"
11669
11726
  class="ts-video-player${j?" "+F0(j):""}"
@@ -11700,7 +11757,7 @@ ${y}
11700
11757
 
11701
11758
  // Load ts-video-player from CDN
11702
11759
  var script = document.createElement('script');
11703
- script.src = '${GH}';
11760
+ script.src = '${LH}';
11704
11761
  script.onload = initPlayer;
11705
11762
  script.onerror = function() {
11706
11763
  console.error('[stx] Failed to load ts-video-player');
@@ -11830,7 +11887,7 @@ else {
11830
11887
  .ts-video-player__play-button svg {
11831
11888
  margin-left: 4px;
11832
11889
  }
11833
- `.trim();return{html:V,script:w,css:A}}function SQ($){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 WH($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function UH($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function zH($,Z){let Y=await DQ();if(!Y)return O7({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return yQ($,Q,Z);return O7({...$,process:!1},Z)}async function _H($,Z){let Y=await DQ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function yQ($,Z,Y){let{controls:X=kQ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=bQ,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=SQ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,M=[`id="${F}"`];if(X)M.push("controls");if(Q)M.push("autoplay");if(J)M.push("muted");if(G)M.push("loop");if(q)M.push("playsinline");if(B)M.push("disablepictureinpicture");if(j)M.push("disableremoteplayback");if(_)M.push(`crossorigin="${_}"`);if(W){if(M.push(`data-preload="${K}"`),M.push('preload="none"'),A)M.push(`data-poster="${F0(A)}"`);M.push("data-stx-lazy")}else if(M.push(`preload="${K}"`),A)M.push(`poster="${F0(A)}"`);let R=U||Z.metadata?.width,N=z||Z.metadata?.height;if(R)M.push(`width="${R}"`);if(N)M.push(`height="${N}"`);if(H)M.push(`class="${F0(H)}"`);if(L)M.push(`style="${F0(L)}"`);let I=` <source ${W?`data-src="${F0(O)}"`:`src="${F0(O)}"`} type="${V}" />`,D=`<video ${M.join(" ")}>
11890
+ `.trim();return{html:V,script:w,css:A}}function fQ($){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 wH($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function AH($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function RH($,Z){let Y=await CQ();if(!Y)return O7({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return gQ($,Q,Z);return O7({...$,process:!1},Z)}async function MH($,Z){let Y=await CQ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function gQ($,Z,Y){let{controls:X=vQ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=xQ,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=fQ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,M=[`id="${F}"`];if(X)M.push("controls");if(Q)M.push("autoplay");if(J)M.push("muted");if(G)M.push("loop");if(q)M.push("playsinline");if(B)M.push("disablepictureinpicture");if(j)M.push("disableremoteplayback");if(_)M.push(`crossorigin="${_}"`);if(W){if(M.push(`data-preload="${K}"`),M.push('preload="none"'),A)M.push(`data-poster="${F0(A)}"`);M.push("data-stx-lazy")}else if(M.push(`preload="${K}"`),A)M.push(`poster="${F0(A)}"`);let R=U||Z.metadata?.width,N=z||Z.metadata?.height;if(R)M.push(`width="${R}"`);if(N)M.push(`height="${N}"`);if(H)M.push(`class="${F0(H)}"`);if(L)M.push(`style="${F0(L)}"`);let I=` <source ${W?`data-src="${F0(O)}"`:`src="${F0(O)}"`} type="${V}" />`,D=`<video ${M.join(" ")}>
11834
11891
  ${I}
11835
11892
  Your browser does not support the video tag.
11836
11893
  </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${F0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -11879,9 +11936,9 @@ ${D}
11879
11936
  width: 100%;
11880
11937
  height: auto;
11881
11938
  }
11882
- `.trim();return{html:D,script:E,css:y}}var EQ=!1,kQ=!0,bQ="metadata",GH="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var PQ=k(()=>{B9()});function CQ(){return s4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=BH($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await O7(G,q),U=W.html;if(W.css)U+=`
11939
+ `.trim();return{html:D,script:E,css:y}}var PQ=!1,vQ=!0,xQ="metadata",LH="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var hQ=k(()=>{H9()});function uQ(){return s4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=NH($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await O7(G,q),U=W.html;if(W.css)U+=`
11883
11940
  <style>${W.css}</style>`;if(W.script)U+=`
11884
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function BH($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=jH(X),J=vQ(Q[0],Y)||"",G={};if(Q[1]){let K=vQ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function jH($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function vQ($,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 X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var _9;var B9=k(()=>{f6();PQ();_9=CQ()});function HH($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11941
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function NH($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=TH(X),J=dQ(Q[0],Y)||"",G={};if(Q[1]){let K=dQ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function TH($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function dQ($,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 X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var j9;var H9=k(()=>{h6();hQ();j9=uQ()});function IH($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11885
11942
  ${$}
11886
11943
  </div>
11887
11944
  <script>
@@ -11926,7 +11983,7 @@ ${D}
11926
11983
  }
11927
11984
  }
11928
11985
  })();
11929
- </script>`}function OH($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
11986
+ </script>`}function EH($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
11930
11987
  <div class="stx-pwa-update-banner" style="
11931
11988
  position: fixed;
11932
11989
  bottom: 0;
@@ -12037,7 +12094,7 @@ else {
12037
12094
  // Also listen for custom event
12038
12095
  window.addEventListener('pwa-update-available', showUpdate);
12039
12096
  })();
12040
- </script>`}function LH($,Z){let Y=$.trim().length>0,X=`
12097
+ </script>`}function DH($,Z){let Y=$.trim().length>0,X=`
12041
12098
  <div class="stx-offline-indicator" style="
12042
12099
  position: fixed;
12043
12100
  top: 16px;
@@ -12098,7 +12155,7 @@ else {
12098
12155
  window.addEventListener('offline', updateStatus);
12099
12156
  updateStatus();
12100
12157
  })();
12101
- </script>`}function FH($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12158
+ </script>`}function kH($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12102
12159
  ${$}
12103
12160
  </div>
12104
12161
  <script>
@@ -12180,7 +12237,7 @@ catch (error) {
12180
12237
  init();
12181
12238
  }
12182
12239
  })();
12183
- </script>`}var VH,wH,AH,RH,xQ;var fQ=k(()=>{VH={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return HH($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},wH={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return OH($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},AH={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return LH($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},RH={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return FH($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},xQ=[VH,wH,AH,RH]});import k$ from"path";function MH($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let _=z[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Q=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function NH($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
12240
+ </script>`}var bH,SH,yH,PH,mQ;var lQ=k(()=>{bH={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return IH($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},SH={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return EH($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},yH={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return DH($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},PH={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return kH($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},mQ=[bH,SH,yH,PH]});import k$ from"path";function CH($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let _=z[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Q=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function vH($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
12184
12241
  get ${z}() {
12185
12242
  return this.getAttribute('${z}') || '';
12186
12243
  }
@@ -12231,9 +12288,9 @@ ${U}
12231
12288
  }
12232
12289
 
12233
12290
  customElements.define('${Z}', ${G});
12234
- `}async function gQ($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[k$.join(k$.dirname(X),G,`${Q}.stx`),k$.join(process.cwd(),G,`${Q}.stx`),k$.join(k$.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=MH(q,Q);return`<script type="module">
12235
- ${NH(W)}
12236
- </script>`}var hQ=k(()=>{B1();w0()});var uQ={};t(uQ,{timingPlugin:()=>kH,pluginManager:()=>TH,definePlugin:()=>L7,debugPlugin:()=>DH,createVariablesPlugin:()=>bH,createFilterPlugin:()=>EH,createDirectivePlugin:()=>IH,PluginManager:()=>j9});function L7($){return $}class j9{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,X]of this.plugins)if(X.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 X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function IH($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function EH($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function bH($){return L7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var TH,DH,kH;var dQ=k(()=>{TH=new j9;DH=L7({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)}}),kH=L7({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 o8={};t(o8,{validateConfig:()=>vH,loadStxConfig:()=>P5,defineStxConfig:()=>CH,defaultConfig:()=>H1,config:()=>i7});import H9 from"fs";import y0 from"path";import{loadConfigWithResult as SH}from"bunfig";function yH($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=y0.join(process.cwd(),"resources","views"),Q=y0.join(process.cwd(),"resources","layouts");if(H9.existsSync(X)&&H9.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=y0.join(process.cwd(),"resources","views","pages");if(H9.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function PH($){if(Q8($.stateDir),$.stateDir=o5(),$.cachePath=a5($.cachePath),$.build)$.build.cacheDir=a5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=a5($.media.cache.directory);if($.story)$.story.outDir=a5($.story.outDir)}async function P5($){if(!$){if(u5)return u5;if(F7)return F7}let Z=$?y0.resolve($):process.cwd(),Y=mQ.get(Z);if(Y)return Y;let X=(async()=>{let J=(await SH({name:"stx",alias:"ui",cwd:Z,defaultConfig:H1,verbose:!1})).config;PH(J);let G=yH(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!y0.isAbsolute(J.partialsDir))J.partialsDir=y0.join(K,J.partialsDir);if(J.componentsDir&&!y0.isAbsolute(J.componentsDir))J.componentsDir=y0.join(K,J.componentsDir);if(J.layoutsDir&&!y0.isAbsolute(J.layoutsDir))J.layoutsDir=y0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (dQ(),uQ)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],_=typeof U==="string"?{}:U[1]||{};try{let B,j;try{B=await import(z),j=y0.dirname(a.resolve(z))}catch{let L=y0.resolve(process.cwd(),z);B=await import(L),j=y0.dirname(L)}let H=B.default||B;if(K.register(H,J),H.components){let L=y0.resolve(j,H.components);q.push(L)}if(H.pages){let L=y0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(B){console.warn(`[stx] Failed to load plugin ${z}:`,B.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(mQ.set(Z,X),!$)F7=X,X.then((Q)=>{u5=Q}).catch(()=>{});return X}function CH($){return $}function vH($){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 X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.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 X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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 X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.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 H1,u5=null,mQ,F7=null,i7;var c1=k(()=>{I7();E7();D7();k7();y6();zQ();B9();fQ();Y6();C$();hQ();H1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:W5,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:fJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:gQ,hasEndTag:!1,description:"Include a web component in the template"},m9,l9,VY,wY,p9,i9,n9,c9,a9,$8,UQ,_9,...xQ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};mQ=new Map;i7=new Proxy(H1,{get($,Z){if(u5&&Z in u5)return u5[Z];if(!F7)P5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var YO=`
12291
+ `}async function pQ($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[k$.join(k$.dirname(X),G,`${Q}.stx`),k$.join(process.cwd(),G,`${Q}.stx`),k$.join(k$.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,s.FILE_NOT_FOUND);let W=CH(q,Q);return`<script type="module">
12292
+ ${vH(W)}
12293
+ </script>`}var cQ=k(()=>{B1();w0()});var iQ={};t(iQ,{timingPlugin:()=>uH,pluginManager:()=>xH,definePlugin:()=>L7,debugPlugin:()=>hH,createVariablesPlugin:()=>dH,createFilterPlugin:()=>gH,createDirectivePlugin:()=>fH,PluginManager:()=>O9});function L7($){return $}class O9{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,X]of this.plugins)if(X.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 X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function fH($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function gH($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function dH($){return L7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var xH,hH,uH;var nQ=k(()=>{xH=new O9;hH=L7({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)}}),uH=L7({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 t8={};t(t8,{validateConfig:()=>iH,loadStxConfig:()=>P5,defineStxConfig:()=>cH,defaultConfig:()=>H1,config:()=>i7});import L9 from"fs";import y0 from"path";import{loadConfigWithResult as mH}from"bunfig";function lH($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=y0.join(process.cwd(),"resources","views"),Q=y0.join(process.cwd(),"resources","layouts");if(L9.existsSync(X)&&L9.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=y0.join(process.cwd(),"resources","views","pages");if(L9.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function pH($){if(K8($.stateDir),$.stateDir=r5(),$.cachePath=a5($.cachePath),$.build)$.build.cacheDir=a5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=a5($.media.cache.directory);if($.story)$.story.outDir=a5($.story.outDir)}async function P5($){if(!$){if(u5)return u5;if(F7)return F7}let Z=$?y0.resolve($):process.cwd(),Y=sQ.get(Z);if(Y)return Y;let X=(async()=>{let J=(await mH({name:"stx",alias:"ui",cwd:Z,defaultConfig:H1,verbose:!1})).config;pH(J);let G=lH(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!y0.isAbsolute(J.partialsDir))J.partialsDir=y0.join(K,J.partialsDir);if(J.componentsDir&&!y0.isAbsolute(J.componentsDir))J.componentsDir=y0.join(K,J.componentsDir);if(J.layoutsDir&&!y0.isAbsolute(J.layoutsDir))J.layoutsDir=y0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (nQ(),iQ)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],_=typeof U==="string"?{}:U[1]||{};try{let B,j;try{B=await import(z),j=y0.dirname(o.resolve(z))}catch{let L=y0.resolve(process.cwd(),z);B=await import(L),j=y0.dirname(L)}let H=B.default||B;if(K.register(H,J),H.components){let L=y0.resolve(j,H.components);q.push(L)}if(H.pages){let L=y0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(B){console.warn(`[stx] Failed to load plugin ${z}:`,B.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(sQ.set(Z,X),!$)F7=X,X.then((Q)=>{u5=Q}).catch(()=>{});return X}function cH($){return $}function iH($){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 X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.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 X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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 X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.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 H1,u5=null,sQ,F7=null,i7;var c1=k(()=>{I7();E7();D7();k7();C6();LQ();H9();lQ();Y6();C$();cQ();H1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:W5,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:lJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:pQ,hasEndTag:!1,description:"Include a web component in the template"},p9,c9,RY,MY,i9,s9,r9,n9,e9,Y8,OQ,j9,...mQ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};sQ=new Map;i7=new Proxy(H1,{get($,Z){if(u5&&Z in u5)return u5[Z];if(!F7)P5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var BO=`
12237
12294
  <script>
12238
12295
  (function() {
12239
12296
  'use strict';
@@ -12699,7 +12756,7 @@ else if (data.type === 'event' && data.method) {
12699
12756
  }
12700
12757
  })();
12701
12758
  </script>
12702
- `;function V9($={}){let{debug:Z=!1,timeout:Y=30000}=$;return`
12759
+ `;function A9($={}){let{debug:Z=!1,timeout:Y=30000}=$;return`
12703
12760
  <script>
12704
12761
  (function() {
12705
12762
  'use strict';
@@ -13165,14 +13222,14 @@ else if (data.type === 'event' && data.method) {
13165
13222
  }
13166
13223
  })();
13167
13224
  </script>
13168
- `.replace("debug: false,",`debug: ${Z},`).replace("timeout: 30000",`timeout: ${Y}`)}function XO(){return!1}function JO($,Z={}){let Y=/@craft(?:\(([\s\S]*?)\))?/g;return $.replace(Y,(X,Q)=>{let J={};if(Q)try{J=JSON.parse(Q.replace(/'/g,'"'))}catch{try{J=Function(`return ${Q}`)()}catch{console.warn(`[stx] Invalid @craft config: ${Q}`)}}return V9(J)})}function w9($,Z={}){if($.includes("__craftBridgeInitialized"))return $;let Y=V9(Z);if($.includes("</head>"))return $.replace("</head>",`${Y}
13225
+ `.replace("debug: false,",`debug: ${Z},`).replace("timeout: 30000",`timeout: ${Y}`)}function jO(){return!1}function HO($,Z={}){let Y=/@craft(?:\(([\s\S]*?)\))?/g;return $.replace(Y,(X,Q)=>{let J={};if(Q)try{J=JSON.parse(Q.replace(/'/g,'"'))}catch{try{J=Function(`return ${Q}`)()}catch{console.warn(`[stx] Invalid @craft config: ${Q}`)}}return A9(J)})}function R9($,Z={}){if($.includes("__craftBridgeInitialized"))return $;let Y=A9(Z);if($.includes("</head>"))return $.replace("</head>",`${Y}
13169
13226
  </head>`);if($.includes("<body"))return $.replace(/(<body[^>]*>)/,`$1
13170
- ${Y}`);return Y+$}var tQ=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 GO($,Z={}){let Y=performance.now(),X={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||tQ},Q=typeof $==="string"?eQ($):$,J=ZG(Q.tree,X),G=qG(J),K=X.treeShake?UG(J,G):J,q=new Map;if(X.target==="universal"){let B=["macos","windows","linux","ios","android"];for(let j of B){let H=R7(K,{...X,target:j});q.set(j,H)}}else{let B=R7(K,X);q.set(X.target,B)}let W=BG(K,X,q),U=jG(Q,K,X),z={compilationTime:performance.now()-Y,totalComponents:M7(Q.tree),nativeComponents:N7(K),webComponents:M7(Q.tree)-N7(K),bundleSize:W.length,treeShakenSize:X.treeShake?zG(J,K):W.length,warnings:[],errors:[]},_;if(X.sourceMaps)_=HG(Q,K);return{code:W,platformCode:q,dependencies:G,manifest:U,sourceMaps:_,stats:z}}function eQ($){let Z={type:"fragment",children:[]},Y=$.match(/<body[^>]*>([\s\S]*?)<\/body>/i),X=Y?Y[1]:$;return R9(X,Z),{id:E9(),hash:D9($),tree:Z,scripts:FG($),styles:VG($),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 R9($,Z){let Y=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,X;while((X=Y.exec($))!==null){let[,Q,J,G]=X,K=Q.startsWith("@craft-"),q={type:K?"component":"element",tag:K?Q.slice(1):Q,props:$G(J),children:[],componentName:K?Q.slice(1):void 0};if(G){let W=G.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});R9(G,q)}Z.children=Z.children??[],Z.children.push(q)}}function $G($){let Z={},Y=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,X;while((X=Y.exec($))!==null){let[,Q,J]=X;Z[Q]=J??!0}return Z}function ZG($,Z){return M9($,Z)}function M9($,Z){let Y=$.componentName?Z.components?.get($.componentName):void 0,X="craft.View";if(Y)X=Y.zigType;else if($.type==="text")X="craft.Text";else if($.tag)X=YG($.tag);let Q={};if($.props)for(let[q,W]of Object.entries($.props))Q[q]=XG(W);let J=[];if($.children)for(let q of $.children)J.push(M9(q,Z));let G=new Map;if($.props){for(let[q,W]of Object.entries($.props))if(q.startsWith("on")&&typeof W==="string")G.set(q.slice(2).toLowerCase(),W)}let K=QG($);return{type:JG($,Y),zigType:X,props:Q,children:J,events:G,styles:K,id:$.hydrationKey,key:$.props?.key}}function YG($){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 XG($){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 JG($,Z){if(Z){let X=Z.name.toLowerCase();if(X.includes("button"))return"button";if(X.includes("input")||X.includes("text"))return"input";if(X.includes("image")||X.includes("avatar"))return"image";if(X.includes("list")||X.includes("table"))return"list";if(X.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 QG($){let Z=$.props?.style,Y={},X={};if(Z){let Q=Z.split(";").filter(Boolean);for(let J of Q){let[G,K]=J.split(":").map((q)=>q.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=GG(K);break;case"align-items":Y.alignItems=KG(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":X.backgroundColor=K;break;case"border-color":X.borderColor=K;break;case"border-width":X.borderWidth=Number.parseInt(K,10);break;case"border-radius":X.borderRadius=Number.parseInt(K,10);break;case"opacity":X.opacity=Number.parseFloat(K);break}}}return{layout:Y,appearance:X}}function GG($){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[$]||"start"}function KG($){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[$]||"start"}function qG($){let Z=[],Y=new Set;function X(Q,J){let G=Q.id||E9();if(Y.has(G))return;Y.add(G);let K={id:G,type:"component",path:Q.zigType,dependencies:J?[J]:[],size:N9(Q),isStatic:WG(Q)};Z.push(K);for(let q of Q.children)X(q,G)}return X($),Z}function N9($){let Z=100;return Z+=Object.keys($.props).length*20,Z+=$.events.size*50,Z}function WG($){for(let Z of Object.values($.props))if(Z.type!=="literal")return!1;return $.events.size===0}function UG($,Z){return $}function zG($,Z){let Y=0;function X(Q){Y+=N9(Q);for(let J of Q.children)X(J)}return X(Z),Y}function R7($,Z){switch(Z.format){case"zig":return A9($,Z);case"typescript":return _G($,Z);case"json":return JSON.stringify($,null,Z.minify?0:2);default:return A9($,Z)}}function A9($,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(""),T9($,Y,0),Y.join(`
13171
- `)}function T9($,Z,Y){let X=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let Q=`node_${Y}`;Z.push(`${X} var ${Q} = try ${$.zigType}.init(allocator);`);for(let[J,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${X} ${Q}.set${LG(J)}(${K});`)}for(let J=0;J<$.children.length;J++){let G=$.children[J];if(G.type==="text"){let K=G.props.text?.type==="literal"?String(G.props.text.value):"";Z.push(`${X} try ${Q}.addChild(try craft.Text.init(allocator, "${K}"));`)}else T9(G,Z,Y+1),Z.push(`${X} try ${Q}.addChild(node_${Y+1});`)}if(Y===0)Z.push(` return ${Q}.element();`),Z.push("}")}function _G($,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 "+I9($,1)+";"),Y.push("}"),Y.join(`
13172
- `)}function I9($,Z){let Y=" ".repeat(Z),X=[];for(let[K,q]of Object.entries($.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);X.push(`${K}: ${W}`)}let Q=X.length>0?`{ ${X.join(", ")} }`:"{}",J=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:I9(K,Z+1)),G=J.length>0?`,
13227
+ ${Y}`);return Y+$}var JG=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 LO($,Z={}){let Y=performance.now(),X={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||JG},Q=typeof $==="string"?QG($):$,J=KG(Q.tree,X),G=jG(J),K=X.treeShake?OG(J,G):J,q=new Map;if(X.target==="universal"){let B=["macos","windows","linux","ios","android"];for(let j of B){let H=R7(K,{...X,target:j});q.set(j,H)}}else{let B=R7(K,X);q.set(X.target,B)}let W=VG(K,X,q),U=wG(Q,K,X),z={compilationTime:performance.now()-Y,totalComponents:M7(Q.tree),nativeComponents:N7(K),webComponents:M7(Q.tree)-N7(K),bundleSize:W.length,treeShakenSize:X.treeShake?LG(J,K):W.length,warnings:[],errors:[]},_;if(X.sourceMaps)_=AG(Q,K);return{code:W,platformCode:q,dependencies:G,manifest:U,sourceMaps:_,stats:z}}function QG($){let Z={type:"fragment",children:[]},Y=$.match(/<body[^>]*>([\s\S]*?)<\/body>/i),X=Y?Y[1]:$;return N9(X,Z),{id:k9(),hash:b9($),tree:Z,scripts:NG($),styles:TG($),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 N9($,Z){let Y=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,X;while((X=Y.exec($))!==null){let[,Q,J,G]=X,K=Q.startsWith("@craft-"),q={type:K?"component":"element",tag:K?Q.slice(1):Q,props:GG(J),children:[],componentName:K?Q.slice(1):void 0};if(G){let W=G.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});N9(G,q)}Z.children=Z.children??[],Z.children.push(q)}}function GG($){let Z={},Y=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,X;while((X=Y.exec($))!==null){let[,Q,J]=X;Z[Q]=J??!0}return Z}function KG($,Z){return T9($,Z)}function T9($,Z){let Y=$.componentName?Z.components?.get($.componentName):void 0,X="craft.View";if(Y)X=Y.zigType;else if($.type==="text")X="craft.Text";else if($.tag)X=qG($.tag);let Q={};if($.props)for(let[q,W]of Object.entries($.props))Q[q]=WG(W);let J=[];if($.children)for(let q of $.children)J.push(T9(q,Z));let G=new Map;if($.props){for(let[q,W]of Object.entries($.props))if(q.startsWith("on")&&typeof W==="string")G.set(q.slice(2).toLowerCase(),W)}let K=zG($);return{type:UG($,Y),zigType:X,props:Q,children:J,events:G,styles:K,id:$.hydrationKey,key:$.props?.key}}function qG($){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 WG($){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 UG($,Z){if(Z){let X=Z.name.toLowerCase();if(X.includes("button"))return"button";if(X.includes("input")||X.includes("text"))return"input";if(X.includes("image")||X.includes("avatar"))return"image";if(X.includes("list")||X.includes("table"))return"list";if(X.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 zG($){let Z=$.props?.style,Y={},X={};if(Z){let Q=Z.split(";").filter(Boolean);for(let J of Q){let[G,K]=J.split(":").map((q)=>q.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=_G(K);break;case"align-items":Y.alignItems=BG(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":X.backgroundColor=K;break;case"border-color":X.borderColor=K;break;case"border-width":X.borderWidth=Number.parseInt(K,10);break;case"border-radius":X.borderRadius=Number.parseInt(K,10);break;case"opacity":X.opacity=Number.parseFloat(K);break}}}return{layout:Y,appearance:X}}function _G($){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[$]||"start"}function BG($){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[$]||"start"}function jG($){let Z=[],Y=new Set;function X(Q,J){let G=Q.id||k9();if(Y.has(G))return;Y.add(G);let K={id:G,type:"component",path:Q.zigType,dependencies:J?[J]:[],size:I9(Q),isStatic:HG(Q)};Z.push(K);for(let q of Q.children)X(q,G)}return X($),Z}function I9($){let Z=100;return Z+=Object.keys($.props).length*20,Z+=$.events.size*50,Z}function HG($){for(let Z of Object.values($.props))if(Z.type!=="literal")return!1;return $.events.size===0}function OG($,Z){return $}function LG($,Z){let Y=0;function X(Q){Y+=I9(Q);for(let J of Q.children)X(J)}return X(Z),Y}function R7($,Z){switch(Z.format){case"zig":return M9($,Z);case"typescript":return FG($,Z);case"json":return JSON.stringify($,null,Z.minify?0:2);default:return M9($,Z)}}function M9($,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(""),E9($,Y,0),Y.join(`
13228
+ `)}function E9($,Z,Y){let X=" ".repeat(Y);if(Y===0)Z.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let Q=`node_${Y}`;Z.push(`${X} var ${Q} = try ${$.zigType}.init(allocator);`);for(let[J,G]of Object.entries($.props))if(G.type==="literal"){let K=typeof G.value==="string"?`"${G.value}"`:String(G.value);Z.push(`${X} ${Q}.set${MG(J)}(${K});`)}for(let J=0;J<$.children.length;J++){let G=$.children[J];if(G.type==="text"){let K=G.props.text?.type==="literal"?String(G.props.text.value):"";Z.push(`${X} try ${Q}.addChild(try craft.Text.init(allocator, "${K}"));`)}else E9(G,Z,Y+1),Z.push(`${X} try ${Q}.addChild(node_${Y+1});`)}if(Y===0)Z.push(` return ${Q}.element();`),Z.push("}")}function FG($,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 "+D9($,1)+";"),Y.push("}"),Y.join(`
13229
+ `)}function D9($,Z){let Y=" ".repeat(Z),X=[];for(let[K,q]of Object.entries($.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);X.push(`${K}: ${W}`)}let Q=X.length>0?`{ ${X.join(", ")} }`:"{}",J=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:D9(K,Z+1)),G=J.length>0?`,
13173
13230
  ${Y} [${J.join(`,
13174
- ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[Q,J]of Y)X.push(`// --- ${Q.toUpperCase()} ---`),X.push(`#if ${Q.toUpperCase()}`),X.push(J),X.push("#endif"),X.push("");return X.join(`
13175
- `)}return Y.get(Z.target)||R7($,Z)}function jG($,Z,Y){let X=[];function Q(J){X.push({name:J.zigType,hash:D9(JSON.stringify(J.props)),props:Object.keys(J.props),events:Array.from(J.events.keys()),slots:[],isNative:J.zigType.startsWith("craft.")});for(let G of J.children)Q(G)}return Q(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function HG($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var OG=0;function E9(){return`id_${++OG}`}function D9($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function LG($){return $.charAt(0).toUpperCase()+$.slice(1)}function FG($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function VG($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function M7($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=M7(Y);return Z}function N7($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=N7(Y);return Z}function KO($){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 T7={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":"",X=$.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
13231
+ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function VG($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[Q,J]of Y)X.push(`// --- ${Q.toUpperCase()} ---`),X.push(`#if ${Q.toUpperCase()}`),X.push(J),X.push("#endif"),X.push("");return X.join(`
13232
+ `)}return Y.get(Z.target)||R7($,Z)}function wG($,Z,Y){let X=[];function Q(J){X.push({name:J.zigType,hash:b9(JSON.stringify(J.props)),props:Object.keys(J.props),events:Array.from(J.events.keys()),slots:[],isNative:J.zigType.startsWith("craft.")});for(let G of J.children)Q(G)}return Q(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function AG($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var RG=0;function k9(){return`id_${++RG}`}function b9($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function MG($){return $.charAt(0).toUpperCase()+$.slice(1)}function NG($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function TG($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function M7($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=M7(Y);return Z}function N7($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=N7(Y);return Z}function FO($){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 T7={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":"",X=$.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
13176
13233
  <input type="checkbox" class="craft-checkbox" ${Y} ${X}>
13177
13234
  <span class="craft-checkbox-label">${Z||$.label||""}</span>
13178
13235
  </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,X=$.max??100,Q=$.step??1,J=$.value??50,G=$.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${Y}" max="${X}" step="${Q}" value="${J}" ${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,X=$.src,Q=String($.alt||""),J=$.fallback||(Q?Q.charAt(0).toUpperCase():"?");if(X)return`<img class="craft-avatar" src="${X}" alt="${Q}" 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">${J}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:($,Z)=>{let Y=Number($.value)||0,X=Number($.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,Y/X*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":"",X=$.title||"";return`<dialog class="craft-modal" ${Y}>
@@ -13186,7 +13243,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,
13186
13243
  </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",X=$.title||"";return`<div class="craft-alert craft-alert-${Y}" role="alert">
13187
13244
  ${X?`<div class="craft-alert-title">${X}</div>`:""}
13188
13245
  <div class="craft-alert-content">${Z}</div>
13189
- </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||"",X=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${X}">${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:wG},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:AG},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:RG},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:MG},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||"",X=$.min||"",Q=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${X}" max="${Q}">`}},"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||""}">`}}},k9=`
13246
+ </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||"",X=$.position||"top";return`<span class="craft-tooltip" data-tooltip="${Y}" data-position="${X}">${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:IG},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:EG},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:DG},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:kG},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||"",X=$.min||"",Q=$.max||"";return`<input type="date" class="craft-date-picker" value="${Y}" min="${X}" max="${Q}">`}},"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||""}">`}}},S9=`
13190
13247
  <style id="craft-component-styles">
13191
13248
  /* Craft Component Base Styles */
13192
13249
  .craft-button {
@@ -13604,7 +13661,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,
13604
13661
  }
13605
13662
  }
13606
13663
  </style>
13607
- `,WO=`
13664
+ `,wO=`
13608
13665
  <script id="craft-component-runtime">
13609
13666
  (function() {
13610
13667
  if (window.__stxCraftComponentRuntime) return;
@@ -13708,7 +13765,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,
13708
13765
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
13709
13766
  })();
13710
13767
  </script>
13711
- `;function b9($,Z={}){let{classPrefix:Y="craft"}=Z;if(!$.includes("craft-component-styles"))if($.includes("</head>"))$=$.replace("</head>",`${`
13768
+ `;function y9($,Z={}){let{classPrefix:Y="craft"}=Z;if(!$.includes("craft-component-styles"))if($.includes("</head>"))$=$.replace("</head>",`${`
13712
13769
  <style id="craft-component-styles">
13713
13770
  /* Craft Component Base Styles */
13714
13771
  .craft-button {
@@ -15173,35 +15230,35 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,
15173
15230
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
15174
15231
  })();
15175
15232
  </script>
15176
- `;return $=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(X,Q,J)=>{return y$("sidebar",Q,J.trim(),Z,Y)}),$=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(X,Q)=>{return y$("sidebar",Q,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(X,Q,J)=>{return y$(Q,J,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(X,Q,J,G)=>{return y$(Q,J,G.trim(),Z,Y)}),$}function y$($,Z,Y,X,Q){let J=X.components?.[$]||T7[$];if(!J)return console.warn(`[stx] Unknown Craft component: @craft-${$}`),`<div class="${Q}-unknown" data-component="${$}">${Y}</div>`;let G=P$(Z),K=[J.fallbackClasses||`${Q}-${$}`];if(G.class)K.push(G.class),delete G.class;if(J.render)return G.__fallbackClasses=K.join(" "),J.render(G,Y);let q=SG(G,J,K);if(["input","hr","br","img"].includes(J.fallbackTag))return`<${J.fallbackTag} ${q}>`;return`<${J.fallbackTag} ${q}>${Y}</${J.fallbackTag}>`}function P$($){let Z={},Y=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,X;while((X=Y.exec($))!==null){let[Q,J,G,K]=X,q=G??K;if(Q.startsWith(":"))Z[J]=q;else if(Q.startsWith("@"))Z[`on${J.charAt(0).toUpperCase()}${J.slice(1)}`]=q;else if(q===void 0)Z[J]=!0;else Z[J]=q}return Z}function wG($,Z){let Y=q5(String($.id||`craft-sidebar-${kG(Z||JSON.stringify($))}`)),X=IG($.spaces)||TG(Z),Q=X.length?[]:DG($.sections)||S9(Z),J=String($.selectedSpace||X[0]?.id||""),G=X.find((j)=>j.id===J)||X[0],K=String($.selectedItem||$.selected||(X.length?G?.sections[0]?.items[0]?.id:Q[0]?.items[0]?.id)||""),q={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:Q,spaces:X,selectedSpace:J||void 0},W=String($.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number($.width||$.sidebarWidth||286),z=$.native===!1||$.native==="false"?"false":"true",_=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${U1(q.searchPlaceholder)}"></div>`:"",B;if(X.length)B=EG(X,J,K);else if(Q.length)B=Q.map((j)=>y9(j,K)).join("");else B=Z;return`<aside class="${h0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h0(Y)}" data-native="${z}" style="--craft-sidebar-width:${U}px">
15233
+ `;return $=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(X,Q,J)=>{return y$("sidebar",Q,J.trim(),Z,Y)}),$=$.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(X,Q)=>{return y$("sidebar",Q,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(X,Q,J)=>{return y$(Q,J,"",Z,Y)}),$=$.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(X,Q,J,G)=>{return y$(Q,J,G.trim(),Z,Y)}),$}function y$($,Z,Y,X,Q){let J=X.components?.[$]||T7[$];if(!J)return console.warn(`[stx] Unknown Craft component: @craft-${$}`),`<div class="${Q}-unknown" data-component="${$}">${Y}</div>`;let G=P$(Z),K=[J.fallbackClasses||`${Q}-${$}`];if(G.class)K.push(G.class),delete G.class;if(J.render)return G.__fallbackClasses=K.join(" "),J.render(G,Y);let q=fG(G,J,K);if(["input","hr","br","img"].includes(J.fallbackTag))return`<${J.fallbackTag} ${q}>`;return`<${J.fallbackTag} ${q}>${Y}</${J.fallbackTag}>`}function P$($){let Z={},Y=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,X;while((X=Y.exec($))!==null){let[Q,J,G,K]=X,q=G??K;if(Q.startsWith(":"))Z[J]=q;else if(Q.startsWith("@"))Z[`on${J.charAt(0).toUpperCase()}${J.slice(1)}`]=q;else if(q===void 0)Z[J]=!0;else Z[J]=q}return Z}function IG($,Z){let Y=q5(String($.id||`craft-sidebar-${vG(Z||JSON.stringify($))}`)),X=yG($.spaces)||SG(Z),Q=X.length?[]:CG($.sections)||P9(Z),J=String($.selectedSpace||X[0]?.id||""),G=X.find((j)=>j.id===J)||X[0],K=String($.selectedItem||$.selected||(X.length?G?.sections[0]?.items[0]?.id:Q[0]?.items[0]?.id)||""),q={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:Q,spaces:X,selectedSpace:J||void 0},W=String($.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number($.width||$.sidebarWidth||286),z=$.native===!1||$.native==="false"?"false":"true",_=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${U1(q.searchPlaceholder)}"></div>`:"",B;if(X.length)B=PG(X,J,K);else if(Q.length)B=Q.map((j)=>C9(j,K)).join("");else B=Z;return`<aside class="${h0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h0(Y)}" data-native="${z}" style="--craft-sidebar-width:${U}px">
15177
15234
  ${_}
15178
15235
  ${B}
15179
15236
  </aside>
15180
- <script type="application/json" data-craft-sidebar-config="${h0(Y)}">${bG(q)}</script>`}function AG($,Z){let Y=q5(String($.id||$.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h0(Y)}">
15237
+ <script type="application/json" data-craft-sidebar-config="${h0(Y)}">${xG(q)}</script>`}function EG($,Z){let Y=q5(String($.id||$.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h0(Y)}">
15181
15238
  ${$.label?`<div class="craft-sidebar-space-title">${U1(String($.label))}</div>`:""}
15182
15239
  ${Z}
15183
- </section>`}function RG($,Z){let Y=String($.header||$.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${h0(String($.id||"section"))}">
15240
+ </section>`}function DG($,Z){let Y=String($.header||$.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${h0(String($.id||"section"))}">
15184
15241
  ${Y?`<div class="craft-sidebar-section-title">${U1(Y)}</div>`:""}
15185
15242
  ${Z}
15186
- </section>`}function MG($,Z){let Y={id:String($.id||q5(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 P9(Y,String($.selected||"")==="true")}function S9($){let Z=[],Y=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=X[2]||"",G=String(Q.id||q5(String(Q.header||Q.title||`section-${Z.length+1}`))),K=String(Q.header||Q.title||G),q=NG(J);Z.push({id:G,header:K,title:K,items:q})}return Z}function NG($){let Z=[],Y=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=String(Q.label||(X[2]||"").replace(/<[^>]*>/g,"").trim()),G=String(Q.id||q5(J||`item-${Z.length+1}`));Z.push({id:G,label:J,icon:Q.icon?String(Q.icon):void 0,badge:Q.badge?String(Q.badge):void 0,tintColor:Q.tintColor?String(Q.tintColor):void 0})}return Z}function TG($){let Z=[],Y=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=X[2]||"",G=String(Q.label||Q.title||`Space ${Z.length+1}`);Z.push({id:String(Q.id||q5(G)),label:G,icon:Q.icon?String(Q.icon):void 0,tint:Q.tint?String(Q.tint):void 0,sections:S9(J)})}return Z}function IG($){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 EG($,Z,Y){let X=$.map((J)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h0(J.id)}" data-selected="${J.id===Z?"true":"false"}" title="${h0(J.label||J.id)}">${J.icon?`<span class="craft-sidebar-item-icon" data-icon="${h0(J.icon)}"></span>`:U1((J.label||J.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${$.map((J)=>`<section class="craft-sidebar-space" data-space-id="${h0(J.id)}" data-selected="${J.id===Z?"true":"false"}">
15243
+ </section>`}function kG($,Z){let Y={id:String($.id||q5(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 v9(Y,String($.selected||"")==="true")}function P9($){let Z=[],Y=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=X[2]||"",G=String(Q.id||q5(String(Q.header||Q.title||`section-${Z.length+1}`))),K=String(Q.header||Q.title||G),q=bG(J);Z.push({id:G,header:K,title:K,items:q})}return Z}function bG($){let Z=[],Y=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=String(Q.label||(X[2]||"").replace(/<[^>]*>/g,"").trim()),G=String(Q.id||q5(J||`item-${Z.length+1}`));Z.push({id:G,label:J,icon:Q.icon?String(Q.icon):void 0,badge:Q.badge?String(Q.badge):void 0,tintColor:Q.tintColor?String(Q.tintColor):void 0})}return Z}function SG($){let Z=[],Y=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,X;while((X=Y.exec($))!==null){let Q=P$(X[1]||""),J=X[2]||"",G=String(Q.label||Q.title||`Space ${Z.length+1}`);Z.push({id:String(Q.id||q5(G)),label:G,icon:Q.icon?String(Q.icon):void 0,tint:Q.tint?String(Q.tint):void 0,sections:P9(J)})}return Z}function yG($){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 PG($,Z,Y){let X=$.map((J)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h0(J.id)}" data-selected="${J.id===Z?"true":"false"}" title="${h0(J.label||J.id)}">${J.icon?`<span class="craft-sidebar-item-icon" data-icon="${h0(J.icon)}"></span>`:U1((J.label||J.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${$.map((J)=>`<section class="craft-sidebar-space" data-space-id="${h0(J.id)}" data-selected="${J.id===Z?"true":"false"}">
15187
15244
  ${J.label?`<div class="craft-sidebar-space-title">${U1(J.label)}</div>`:""}
15188
- ${J.sections.map((G)=>y9(G,Y)).join("")}
15245
+ ${J.sections.map((G)=>C9(G,Y)).join("")}
15189
15246
  </section>`).join("")}</div>
15190
- <div class="craft-sidebar-space-switcher">${X}</div>`}function DG($){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 y9($,Z){let Y=$.header||$.title||$.id;return`<section class="craft-sidebar-section" data-section-id="${h0($.id)}">
15247
+ <div class="craft-sidebar-space-switcher">${X}</div>`}function CG($){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 C9($,Z){let Y=$.header||$.title||$.id;return`<section class="craft-sidebar-section" data-section-id="${h0($.id)}">
15191
15248
  <div class="craft-sidebar-section-title">${U1(Y)}</div>
15192
- ${$.items.map((X)=>P9(X,X.id===Z)).join("")}
15193
- </section>`}function P9($,Z){let Y=$.tintColor?` style="--craft-sidebar-icon-color:${h0($.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${h0($.id)}" data-selected="${Z?"true":"false"}">
15249
+ ${$.items.map((X)=>v9(X,X.id===Z)).join("")}
15250
+ </section>`}function v9($,Z){let Y=$.tintColor?` style="--craft-sidebar-icon-color:${h0($.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${h0($.id)}" data-selected="${Z?"true":"false"}">
15194
15251
  ${$.icon?`<span class="craft-sidebar-item-icon" data-icon="${h0($.icon)}"${Y}></span>`:""}
15195
15252
  <span class="craft-sidebar-item-label">${U1($.label)}</span>
15196
15253
  ${$.badge?`<span class="craft-sidebar-item-badge">${U1($.badge)}</span>`:""}
15197
- </button>`}function q5($){return $.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function kG($){let Z=5381;for(let Y=0;Y<$.length;Y++)Z=Z*33^$.charCodeAt(Y);return(Z>>>0).toString(36)}function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h0($){return U1($).replace(/`/g,"&#96;")}function bG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function SG($,Z,Y){let X=[];X.push(`class="${Y.join(" ")}"`),X.push(`data-craft="${Z.nativeType}"`);for(let[Q,J]of Object.entries($))if(J===!0)X.push(Q);else if(J!==!1&&J!==void 0&&J!==null){let G=String(J).replace(/"/g,"&quot;");X.push(`${Q}="${G}"`)}return X.join(" ")}function UO($,Z){T7[$]=Z}function zO(){return{...T7}}var m5=new Map,l5=new Map;function yG($,Z){let Y=Z?.id||pG($),X=cG($),Q=m5.get(Y);if(Q&&Q.hash===X)return Q;let J=PG($),G=uG($),K=dG($),q=gG(J),{staticParts:W,dynamicParts:U}=hG(J),z=mG($),_={id:Y,hash:X,tree:J,scripts:G,styles:K,staticParts:W,dynamicParts:U,dependencies:z,metadata:q};return m5.set(Y,_),_}async function BO($,Z={},Y={}){let X=performance.now();if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`,q=l5.get(K);if(q&&Date.now()-q.timestamp<(Y.cacheTTL||60000))return{html:q.html,styles:$.styles.join(`
15254
+ </button>`}function q5($){return $.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function vG($){let Z=5381;for(let Y=0;Y<$.length;Y++)Z=Z*33^$.charCodeAt(Y);return(Z>>>0).toString(36)}function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h0($){return U1($).replace(/`/g,"&#96;")}function xG($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fG($,Z,Y){let X=[];X.push(`class="${Y.join(" ")}"`),X.push(`data-craft="${Z.nativeType}"`);for(let[Q,J]of Object.entries($))if(J===!0)X.push(Q);else if(J!==!1&&J!==void 0&&J!==null){let G=String(J).replace(/"/g,"&quot;");X.push(`${Q}="${G}"`)}return X.join(" ")}function AO($,Z){T7[$]=Z}function RO(){return{...T7}}var m5=new Map,l5=new Map;function gG($,Z){let Y=Z?.id||oG($),X=aG($),Q=m5.get(Y);if(Q&&Q.hash===X)return Q;let J=hG($),G=iG($),K=nG($),q=pG(J),{staticParts:W,dynamicParts:U}=cG(J),z=sG($),_={id:Y,hash:X,tree:J,scripts:G,styles:K,staticParts:W,dynamicParts:U,dependencies:z,metadata:q};return m5.set(Y,_),_}async function NO($,Z={},Y={}){let X=performance.now();if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`,q=l5.get(K);if(q&&Date.now()-q.timestamp<(Y.cacheTTL||60000))return{html:q.html,styles:$.styles.join(`
15198
15255
  `),scripts:$.scripts.join(`
15199
- `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:$.metadata.componentCount}}}let Q;if(Y.streaming)Q=await vG($.tree,Z);else Q=p5($.tree,Z);let J;if(Y.hydrate){let K=fG(Q,$,Z);Q=K.html,J=K.data}if(Y.minify)Q=lG(Q);if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`;l5.set(K,{html:Q,timestamp:Date.now()})}let G=performance.now()-X;return{html:Q,styles:$.styles.join(`
15256
+ `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:$.metadata.componentCount}}}let Q;if(Y.streaming)Q=await dG($.tree,Z);else Q=p5($.tree,Z);let J;if(Y.hydrate){let K=lG(Q,$,Z);Q=K.html,J=K.data}if(Y.minify)Q=rG(Q);if(Y.cache){let K=`${$.id}:${JSON.stringify(Z)}`;l5.set(K,{html:Q,timestamp:Date.now()})}let G=performance.now()-X;return{html:Q,styles:$.styles.join(`
15200
15257
  `),scripts:$.scripts.join(`
15201
- `),hydrationData:J,metadata:{renderTime:G,cacheHit:!1,totalSize:Q.length,componentCount:$.metadata.componentCount}}}function jO($,Z){let Y=[],X=[],Q=[],J=new Map,G=[];return c5($.tree,(K,q)=>{if(K.type==="component"&&K.componentName){if(u9(K.componentName))Y.push(K.componentName)}if(K.type==="element"&&K.tag){let W=sG(K);if(W)G.push(W);if(K.props){for(let[U,z]of Object.entries(K.props))if(U.startsWith("on")&&typeof z==="string"){let _=`handler_${J.size}`;J.set(_,z)}}}if(K.isStatic&&K.type==="element")X.push(x9(K));else if(!K.isStatic&&K.type!=="text")Q.push(K.tag||K.componentName||"unknown")}),{nativeComponents:Y,staticHTML:X,dynamicParts:Q,eventHandlers:J,nativeWidgets:G}}function HO($,Z={}){let Y=yG($),X=xG(Y,Z),Q=new Map,J=[];return c5(Y.tree,(G)=>{if(G.type==="component"&&G.componentName){if(u9(G.componentName)){J.push(G.componentName);let K=`<!--craft:${G.componentName}:${G.hydrationKey||"default"}-->`;Q.set(G.hydrationKey||G.componentName,K)}}}),{staticHTML:X,dynamicPlaceholders:Q,craftComponents:J}}function PG($){let Z={type:"fragment",children:[]},Y=Z,X=[Z],Q=$,J=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(Q.length>0){let G=Q.match(/^<(@?[\w-]+)([^>]*)>/);if(G){let[W,U,z]=G,_=CG(z),B=U.startsWith("@craft-"),j=B?U:U.toLowerCase(),H={type:B?"component":"element",tag:j,props:_,children:[],componentName:B?j.slice(1):void 0,isStatic:!C9(z),hydrationKey:nG()};if(Y.children=Y.children||[],Y.children.push(H),!J.has(j)&&!z.endsWith("/"))X.push(H),Y=H;Q=Q.slice(W.length);continue}let K=Q.match(/^<\/(@?[\w-]+)>/);if(K){let[W,U]=K,_=U.startsWith("@craft-")?U:U.toLowerCase();while(X.length>1){let B=X.pop();if(Y=X[X.length-1],B.tag===_)break}Q=Q.slice(W.length);continue}let q=Q.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!C9(W)};Y.children=Y.children||[],Y.children.push(U)}Q=Q.slice(W.length);continue}Q=Q.slice(1)}return Z}function CG($){let Z={},Y=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,X;while((X=Y.exec($))!==null){let[,Q,J,G,K]=X,q=J??G??K??!0;Z[Q]=q}return Z}function c5($,Z,Y=[]){if(Z($,Y),$.children)$.children.forEach((X,Q)=>{c5(X,Z,[...Y,`${Q}`])})}function p5($,Z){switch($.type){case"text":return g9($.text||"",Z);case"element":case"component":{let Y=$.tag||"div",X=f9($.props||{},Z),Q=($.children||[]).map((J)=>p5(J,Z)).join("");if(!$.children||$.children.length===0){if(["input","br","hr","img","meta","link"].includes(Y))return`<${Y}${X} />`}return`<${Y}${X}>${Q}</${Y}>`}case"fragment":return($.children||[]).map((Y)=>p5(Y,Z)).join("");case"slot":return`<!--slot:${$.slotName||"default"}-->`;default:return""}}function x9($){if($.type==="text")return $.text||"";let Z=$.tag||"div",Y=f9($.props||{},{});return`<${Z}${Y}></${Z}>`}function f9($,Z){let Y=[];for(let[X,Q]of Object.entries($))if(Q===!0)Y.push(` ${X}`);else if(Q!==!1&&Q!==null&&Q!==void 0){let J=g9(String(Q),Z);Y.push(` ${X}="${h9(J)}"`)}return Y.join("")}async function vG($,Z){return p5($,Z)}function xG($,Z){let Y=[];return c5($.tree,(X)=>{if(X.isStatic)Y.push(p5(X,Z))}),Y.join("")}function fG($,Z,Y){let X={templateId:Z.id,context:Y,dynamicParts:Array.from(Z.dynamicParts.entries())},Q=`
15258
+ `),hydrationData:J,metadata:{renderTime:G,cacheHit:!1,totalSize:Q.length,componentCount:$.metadata.componentCount}}}function TO($,Z){let Y=[],X=[],Q=[],J=new Map,G=[];return c5($.tree,(K,q)=>{if(K.type==="component"&&K.componentName){if(m9(K.componentName))Y.push(K.componentName)}if(K.type==="element"&&K.tag){let W=$K(K);if(W)G.push(W);if(K.props){for(let[U,z]of Object.entries(K.props))if(U.startsWith("on")&&typeof z==="string"){let _=`handler_${J.size}`;J.set(_,z)}}}if(K.isStatic&&K.type==="element")X.push(g9(K));else if(!K.isStatic&&K.type!=="text")Q.push(K.tag||K.componentName||"unknown")}),{nativeComponents:Y,staticHTML:X,dynamicParts:Q,eventHandlers:J,nativeWidgets:G}}function IO($,Z={}){let Y=gG($),X=mG(Y,Z),Q=new Map,J=[];return c5(Y.tree,(G)=>{if(G.type==="component"&&G.componentName){if(m9(G.componentName)){J.push(G.componentName);let K=`<!--craft:${G.componentName}:${G.hydrationKey||"default"}-->`;Q.set(G.hydrationKey||G.componentName,K)}}}),{staticHTML:X,dynamicPlaceholders:Q,craftComponents:J}}function hG($){let Z={type:"fragment",children:[]},Y=Z,X=[Z],Q=$,J=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(Q.length>0){let G=Q.match(/^<(@?[\w-]+)([^>]*)>/);if(G){let[W,U,z]=G,_=uG(z),B=U.startsWith("@craft-"),j=B?U:U.toLowerCase(),H={type:B?"component":"element",tag:j,props:_,children:[],componentName:B?j.slice(1):void 0,isStatic:!x9(z),hydrationKey:eG()};if(Y.children=Y.children||[],Y.children.push(H),!J.has(j)&&!z.endsWith("/"))X.push(H),Y=H;Q=Q.slice(W.length);continue}let K=Q.match(/^<\/(@?[\w-]+)>/);if(K){let[W,U]=K,_=U.startsWith("@craft-")?U:U.toLowerCase();while(X.length>1){let B=X.pop();if(Y=X[X.length-1],B.tag===_)break}Q=Q.slice(W.length);continue}let q=Q.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!x9(W)};Y.children=Y.children||[],Y.children.push(U)}Q=Q.slice(W.length);continue}Q=Q.slice(1)}return Z}function uG($){let Z={},Y=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,X;while((X=Y.exec($))!==null){let[,Q,J,G,K]=X,q=J??G??K??!0;Z[Q]=q}return Z}function c5($,Z,Y=[]){if(Z($,Y),$.children)$.children.forEach((X,Q)=>{c5(X,Z,[...Y,`${Q}`])})}function p5($,Z){switch($.type){case"text":return u9($.text||"",Z);case"element":case"component":{let Y=$.tag||"div",X=h9($.props||{},Z),Q=($.children||[]).map((J)=>p5(J,Z)).join("");if(!$.children||$.children.length===0){if(["input","br","hr","img","meta","link"].includes(Y))return`<${Y}${X} />`}return`<${Y}${X}>${Q}</${Y}>`}case"fragment":return($.children||[]).map((Y)=>p5(Y,Z)).join("");case"slot":return`<!--slot:${$.slotName||"default"}-->`;default:return""}}function g9($){if($.type==="text")return $.text||"";let Z=$.tag||"div",Y=h9($.props||{},{});return`<${Z}${Y}></${Z}>`}function h9($,Z){let Y=[];for(let[X,Q]of Object.entries($))if(Q===!0)Y.push(` ${X}`);else if(Q!==!1&&Q!==null&&Q!==void 0){let J=u9(String(Q),Z);Y.push(` ${X}="${d9(J)}"`)}return Y.join("")}async function dG($,Z){return p5($,Z)}function mG($,Z){let Y=[];return c5($.tree,(X)=>{if(X.isStatic)Y.push(p5(X,Z))}),Y.join("")}function lG($,Z,Y){let X={templateId:Z.id,context:Y,dynamicParts:Array.from(Z.dynamicParts.entries())},Q=`
15202
15259
  <script data-craft-hydration>
15203
15260
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(X)};
15204
- </script>`;return{html:$+Q,data:X}}function gG($){let Z=!1,Y=!1,X=!1,Q=!1,J=0,G=0;function K(q,W){if(G=Math.max(G,W),q.type==="slot")Z=!0;if(q.type==="component")J++;if(!q.isStatic)Y=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))X=!0;if(U==="@async"||U==="data-async")Q=!0}if(q.children)q.children.forEach((U)=>K(U,W+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:X,hasAsyncContent:Q,componentCount:J,maxDepth:G,estimatedSize:JSON.stringify($).length}}function hG($){let Z=new Map,Y=new Map;return c5($,(X,Q)=>{let J=Q.join(".");if(X.isStatic)Z.set(J,x9(X));else Y.set(J,X.tag||X.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function uG($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function dG($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function mG($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,X;while((X=Y.exec($))!==null)Z.push(X[1]);let Q=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((X=Q.exec($))!==null)Z.push(X[1]);let J=/<@craft-[\w-]+/g;while((X=J.exec($))!==null)Z.push(X[0].slice(2));return[...new Set(Z)]}function C9($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function g9($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(X,Q)=>{try{let J=v9(Q.trim(),Z);return h9(String(J??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(X,Q)=>{try{let J=v9(Q.trim(),Z);return String(J??"")}catch{return""}}),Y}function v9($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function h9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function lG($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function pG($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function cG($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}var iG=0;function nG(){return`h_${++iG}`}function u9($){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 sG($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,X={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"}},Q=Y?`${Z}:${Y}`:Z,J=X[Q||""]||X[Z||""];if(J)return{htmlSelector:Q||Z||"",nativeComponent:J.component,confidence:J.confidence,reason:J.reason};return null}function oG(){m5.clear()}function rG(){l5.clear()}function OO(){oG(),rG()}function LO(){return{templateCacheSize:m5.size,renderCacheSize:l5.size,totalEntries:m5.size+l5.size}}import{existsSync as iQ,mkdirSync as s0,copyFileSync as P1,chmodSync as C1}from"fs";import{join as u,basename as hH}from"path";import{spawn as w7,execSync as uH}from"child_process";import{tmpdir as nQ,homedir as L9,platform as dH}from"os";c1();D5();z4();z5();W4();import{dirname as xH,resolve as lQ}from"path";function fH($){let Z=$,Y=A5($);if(Y)Z=Y.content.trim();let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q=[],J=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=X.exec($))!==null){let U=q[1],z=q[2],_=q[0],B=U.includes("server");if(K(z))G.push(_);else if(B)J.push(z);else Q.push(_)}let W=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,_=[];while((z=U.exec(W))!==null){let B=z.index+z[0].length,j=1,H=B;while(H<W.length&&j>0){let L=W.indexOf("<script",H),F=W.indexOf("</script>",H);if(F===-1)break;if(L!==-1&&L<F)j++,H=L+7;else{if(j--,j===0){_.push({start:z.index,end:F+9});break}H=F+9}}}for(let B=_.length-1;B>=0;B--)W=W.substring(0,_[B].start)+W.substring(_[B].end)}for(let U of Q)W=W.replace(U,"");return{templateContent:W,serverScripts:J,clientScripts:Q,signalsScripts:G}}function gH($,Z){return`<!DOCTYPE html>
15261
+ </script>`;return{html:$+Q,data:X}}function pG($){let Z=!1,Y=!1,X=!1,Q=!1,J=0,G=0;function K(q,W){if(G=Math.max(G,W),q.type==="slot")Z=!0;if(q.type==="component")J++;if(!q.isStatic)Y=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))X=!0;if(U==="@async"||U==="data-async")Q=!0}if(q.children)q.children.forEach((U)=>K(U,W+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:X,hasAsyncContent:Q,componentCount:J,maxDepth:G,estimatedSize:JSON.stringify($).length}}function cG($){let Z=new Map,Y=new Map;return c5($,(X,Q)=>{let J=Q.join(".");if(X.isStatic)Z.set(J,g9(X));else Y.set(J,X.tag||X.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function iG($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function nG($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function sG($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,X;while((X=Y.exec($))!==null)Z.push(X[1]);let Q=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((X=Q.exec($))!==null)Z.push(X[1]);let J=/<@craft-[\w-]+/g;while((X=J.exec($))!==null)Z.push(X[0].slice(2));return[...new Set(Z)]}function x9($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function u9($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(X,Q)=>{try{let J=f9(Q.trim(),Z);return d9(String(J??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(X,Q)=>{try{let J=f9(Q.trim(),Z);return String(J??"")}catch{return""}}),Y}function f9($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function d9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function rG($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function oG($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function aG($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}var tG=0;function eG(){return`h_${++tG}`}function m9($){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 $K($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,X={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"}},Q=Y?`${Z}:${Y}`:Z,J=X[Q||""]||X[Z||""];if(J)return{htmlSelector:Q||Z||"",nativeComponent:J.component,confidence:J.confidence,reason:J.reason};return null}function ZK(){m5.clear()}function YK(){l5.clear()}function EO(){ZK(),YK()}function DO(){return{templateCacheSize:m5.size,renderCacheSize:l5.size,totalEntries:m5.size+l5.size}}import{existsSync as tQ,mkdirSync as s0,copyFileSync as P1,chmodSync as C1}from"fs";import{join as u,basename as oH}from"path";import{spawn as w7,execSync as aH}from"child_process";import{tmpdir as eQ,homedir as V9,platform as tH}from"os";c1();D5();z4();z5();W4();import{dirname as nH,resolve as rQ}from"path";function sH($){let Z=$,Y=A5($);if(Y)Z=Y.content.trim();let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q=[],J=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=X.exec($))!==null){let U=q[1],z=q[2],_=q[0],B=U.includes("server");if(K(z))G.push(_);else if(B)J.push(z);else Q.push(_)}let W=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,_=[];while((z=U.exec(W))!==null){let B=z.index+z[0].length,j=1,H=B;while(H<W.length&&j>0){let L=W.indexOf("<script",H),F=W.indexOf("</script>",H);if(F===-1)break;if(L!==-1&&L<F)j++,H=L+7;else{if(j--,j===0){_.push({start:z.index,end:F+9});break}H=F+9}}}for(let B=_.length-1;B>=0;B--)W=W.substring(0,_[B].start)+W.substring(_[B].end)}for(let U of Q)W=W.replace(U,"");return{templateContent:W,serverScripts:J,clientScripts:Q,signalsScripts:G}}function rH($,Z){return`<!DOCTYPE html>
15205
15262
  <html lang="en">
15206
15263
  <head>
15207
15264
  <meta charset="UTF-8">
@@ -15211,30 +15268,30 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${Q}${G})`}function BG($,Z,
15211
15268
  <body>
15212
15269
  ${$}
15213
15270
  </body>
15214
- </html>`}async function pQ($,Z={}){let Y=lQ($),X=Bun.file(Y);if(!await X.exists())throw Error(`Template file not found: ${Y}`);let Q=await X.text();if(Z.layout){let J=lQ(Z.layout),G=Bun.file(J);if(!await G.exists())throw Error(`Layout template not found: ${J}`);let{layout:K,injectCSS:q,...W}=Z,U=await O9(Q,Y,{...W,injectCSS:!1}),z=await G.text(),_={...Z.context||{},content:U},B={...W,context:_,injectCSS:q};return O9(z,J,B)}return O9(Q,Y,Z)}async function O9($,Z,Y={}){let{templateContent:X,serverScripts:Q,clientScripts:J}=fH($),G={...H1,...Y.options},K={__filename:Z,__dirname:xH(Z),__stx:{},__stx_options:G,__stx_sfc_mode:!0,__stx_inject_css:Y.injectCSS!==!1,...Y.context||{}};for(let U of Q)await j1(U,K,Z);let q=new Set,W=X;if(W=await L0(W,K,Z,G,q),Y.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),J.length>0)W+=`
15271
+ </html>`}async function oQ($,Z={}){let Y=rQ($),X=Bun.file(Y);if(!await X.exists())throw Error(`Template file not found: ${Y}`);let Q=await X.text();if(Z.layout){let J=rQ(Z.layout),G=Bun.file(J);if(!await G.exists())throw Error(`Layout template not found: ${J}`);let{layout:K,injectCSS:q,...W}=Z,U=await F9(Q,Y,{...W,injectCSS:!1}),z=await G.text(),_={...Z.context||{},content:U},B={...W,context:_,injectCSS:q};return F9(z,J,B)}return F9(Q,Y,Z)}async function F9($,Z,Y={}){let{templateContent:X,serverScripts:Q,clientScripts:J}=sH($),G={...H1,...Y.options},K={__filename:Z,__dirname:nH(Z),__stx:{},__stx_options:G,__stx_sfc_mode:!0,__stx_inject_css:Y.injectCSS!==!1,...Y.context||{}};for(let U of Q)await j1(U,K,Z);let q=new Set,W=X;if(W=await L0(W,K,Z,G,q),Y.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),J.length>0)W+=`
15215
15272
  ${J.join(`
15216
15273
  `)}`}else{if(Y.processClientScripts!==!1&&J.length>0){let U=K.__stx_event_bindings||[],z=h1(K),B=(await Promise.all(J.map(async(H)=>{let L=H.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!L)return H;return await u1(L[1],{eventBindings:U,templateContent:W,serverData:z,filePath:Z})}))).join(`
15217
15274
  `);if(W.match(/(<\/body>)/i))W=W.replace(/(<\/body>)/i,`${B}
15218
15275
  $1`);else W+=`
15219
- ${B}`}W=await j6(W)}if(Y.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=gH(W,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (m7(),s8));W=await U(W)}catch{}return W}async function BT($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||V7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||V7(),X=$.format||rH(Y),Q=$.output||u(process.cwd(),"dist","native");if(!iQ(Q))s0(Q,{recursive:!0});let J=await pQ($.input,{context:$.context,options:{isDev:!1}});if(J=w9(J,{debug:$.verbose}),J=b9(J),!J.includes("craft-component-styles")){if(J.includes("</head>"))J=J.replace("</head>",`${k9}
15220
- </head>`)}let G=$.name||hH($.input,".stx"),K=$.version||"1.0.0",q=$.craftPath||await oH();if(!q)return{success:!1,target:Y,format:X,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: ${Q}`),console.log(` Craft: ${q}`);let W;switch(Y){case"macos":W=await mH(J,G,K,Q,X,$,q);break;case"windows":W=await cH(J,G,K,Q,X,$,q);break;case"linux":W=await iH(J,G,K,Q,X,$,q);break;case"ios":W=await nH(J,G,K,Q,$,q);break;case"android":W=await sH(J,G,K,Q,$,q);break;default:W={success:!1,target:Y,format:X,error:`Unsupported target: ${Y}`}}return W.duration=Date.now()-Z,W}catch(Y){return{success:!1,target:$.target||V7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function mH($,Z,Y,X,Q,J,G){let K=J.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=u(X,`${Z}.app`),W=u(q,"Contents"),U=u(W,"MacOS"),z=u(W,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let _=u(z,"index.html");await Bun.write(_,$);let B="";if(J.sidebar?.enabled&&J.sidebar?.config)B=u(z,"sidebar-config.json"),await Bun.write(B,JSON.stringify(J.sidebar.config));let j=J.sidebar?.enabled?`--native-sidebar --sidebar-width ${J.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",H=J.menubarOnly??J.systemTray;if((J.bundleStyle||(await lH(G)?"executable":"launcher"))==="executable"){let V=u(U,Z);P1(G,V),C1(V,493);let w={html:"index.html",title:J.window?.title||Z,width:J.window?.width||1200,height:J.window?.height||800,devTools:Boolean(J.devTools)};if(H)w.menubarOnly=!0;else if(J.systemTray)w.systemTray=!0;if(J.window?.frameless)w.frameless=!0;if(J.window?.transparent)w.transparent=!0;if(J.window?.alwaysOnTop)w.alwaysOnTop=!0;if(J.window?.resizable===!1)w.resizable=!1;await Bun.write(u(z,"craft.json"),`${JSON.stringify(w,null,2)}
15276
+ ${B}`}W=await O6(W)}if(Y.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=rH(W,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (m7(),a8));W=await U(W)}catch{}return W}async function ET($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||V7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||V7(),X=$.format||KO(Y),Q=$.output||u(process.cwd(),"dist","native");if(!tQ(Q))s0(Q,{recursive:!0});let J=await oQ($.input,{context:$.context,options:{isDev:!1}});if(J=R9(J,{debug:$.verbose}),J=y9(J),!J.includes("craft-component-styles")){if(J.includes("</head>"))J=J.replace("</head>",`${S9}
15277
+ </head>`)}let G=$.name||oH($.input,".stx"),K=$.version||"1.0.0",q=$.craftPath||await GO();if(!q)return{success:!1,target:Y,format:X,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: ${Q}`),console.log(` Craft: ${q}`);let W;switch(Y){case"macos":W=await eH(J,G,K,Q,X,$,q);break;case"windows":W=await YO(J,G,K,Q,X,$,q);break;case"linux":W=await XO(J,G,K,Q,X,$,q);break;case"ios":W=await JO(J,G,K,Q,$,q);break;case"android":W=await QO(J,G,K,Q,$,q);break;default:W={success:!1,target:Y,format:X,error:`Unsupported target: ${Y}`}}return W.duration=Date.now()-Z,W}catch(Y){return{success:!1,target:$.target||V7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function eH($,Z,Y,X,Q,J,G){let K=J.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=u(X,`${Z}.app`),W=u(q,"Contents"),U=u(W,"MacOS"),z=u(W,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let _=u(z,"index.html");await Bun.write(_,$);let B="";if(J.sidebar?.enabled&&J.sidebar?.config)B=u(z,"sidebar-config.json"),await Bun.write(B,JSON.stringify(J.sidebar.config));let j=J.sidebar?.enabled?`--native-sidebar --sidebar-width ${J.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",H=J.menubarOnly??J.systemTray;if((J.bundleStyle||(await $O(G)?"executable":"launcher"))==="executable"){let V=u(U,Z);P1(G,V),C1(V,493);let w={html:"index.html",title:J.window?.title||Z,width:J.window?.width||1200,height:J.window?.height||800,devTools:Boolean(J.devTools)};if(H)w.menubarOnly=!0;else if(J.systemTray)w.systemTray=!0;if(J.window?.frameless)w.frameless=!0;if(J.window?.transparent)w.transparent=!0;if(J.window?.alwaysOnTop)w.alwaysOnTop=!0;if(J.window?.resizable===!1)w.resizable=!1;await Bun.write(u(z,"craft.json"),`${JSON.stringify(w,null,2)}
15221
15278
  `)}else{let V=u(U,"craft");P1(G,V),C1(V,493);let w=J.sidebar?.enabled?`--native-sidebar --sidebar-width ${J.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",M=`#!/bin/bash
15222
15279
  set -euo pipefail
15223
15280
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
15224
15281
  RESOURCES="$DIR/../Resources"
15225
15282
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
15226
15283
  ${[`--title "${J.window?.title||Z}"`,`--width ${J.window?.width||1200}`,`--height ${J.window?.height||800}`,H?"--menubar-only":J.systemTray?"--system-tray":"",J.devTools?"":"--no-devtools",J.window?.frameless?"--frameless":"",J.window?.transparent?"--transparent":"",J.window?.alwaysOnTop?"--always-on-top":"",J.window?.resizable===!1?"--no-resize":"",w].filter(Boolean).join(" \\\n ")}
15227
- `,R=u(U,Z);await Bun.write(R,M),C1(R,493)}let F=Boolean(J.icon&&await Bun.file(J.icon).exists());if(F)P1(J.icon,u(z,"AppIcon.icns"));let O={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:J.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:J.menubarOnly??Boolean(J.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...J.category?{LSApplicationCategoryType:J.category}:{},...J.copyright?{NSHumanReadableCopyright:J.copyright}:{},...J.infoPlist||{}};if(await Bun.write(u(W,"Info.plist"),pH(O)),Q==="dmg"){let V=u(X,`${Z}-${Y}.dmg`),w=await aH(q,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:q}}async function lH($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,X]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let J=`${Y}
15228
- ${X}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!J)return!1;let[G,K,q]=J.slice(1).map(Number);if(G>0||K>0)return!0;return q>=57}catch{return!1}}function cQ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pH($){return`<?xml version="1.0" encoding="UTF-8"?>
15284
+ `,R=u(U,Z);await Bun.write(R,M),C1(R,493)}let F=Boolean(J.icon&&await Bun.file(J.icon).exists());if(F)P1(J.icon,u(z,"AppIcon.icns"));let O={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:J.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:J.menubarOnly??Boolean(J.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...J.category?{LSApplicationCategoryType:J.category}:{},...J.copyright?{NSHumanReadableCopyright:J.copyright}:{},...J.infoPlist||{}};if(await Bun.write(u(W,"Info.plist"),ZO(O)),Q==="dmg"){let V=u(X,`${Z}-${Y}.dmg`),w=await qO(q,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:q}}async function $O($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,X]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let J=`${Y}
15285
+ ${X}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!J)return!1;let[G,K,q]=J.slice(1).map(Number);if(G>0||K>0)return!0;return q>=57}catch{return!1}}function aQ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZO($){return`<?xml version="1.0" encoding="UTF-8"?>
15229
15286
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
15230
15287
  <plist version="1.0">
15231
15288
  <dict>
15232
- ${Object.entries($).map(([Y,X])=>{let Q=typeof X==="boolean"?`<${X}/>`:typeof X==="number"?`<integer>${X}</integer>`:`<string>${cQ(String(X))}</string>`;return` <key>${cQ(Y)}</key>
15289
+ ${Object.entries($).map(([Y,X])=>{let Q=typeof X==="boolean"?`<${X}/>`:typeof X==="number"?`<integer>${X}</integer>`:`<string>${aQ(String(X))}</string>`;return` <key>${aQ(Y)}</key>
15233
15290
  ${Q}`}).join(`
15234
15291
  `)}
15235
15292
  </dict>
15236
15293
  </plist>
15237
- `}async function cH($,Z,Y,X,Q,J,G){let K=u(X,Z);s0(K,{recursive:!0});let q=u(K,"index.html");await Bun.write(q,$),P1(G,u(K,"craft.exe"));let W=`@echo off
15294
+ `}async function YO($,Z,Y,X,Q,J,G){let K=u(X,Z);s0(K,{recursive:!0});let q=u(K,"index.html");await Bun.write(q,$),P1(G,u(K,"craft.exe"));let W=`@echo off
15238
15295
  set DIR=%~dp0
15239
15296
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
15240
15297
  --title "${J.window?.title||Z}" ^
@@ -15242,7 +15299,7 @@ set DIR=%~dp0
15242
15299
  --height ${J.window?.height||800} ^
15243
15300
  ${J.systemTray?"--system-tray":""} ^
15244
15301
  ${J.devTools?"":"--no-devtools"}
15245
- `;if(await Bun.write(u(K,`${Z}.bat`),W),Q==="zip"){let U=u(X,`${Z}-${Y}-windows.zip`),z=await tH(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 iH($,Z,Y,X,Q,J,G){let K=u(X,Z);s0(K,{recursive:!0});let q=u(K,"index.html");await Bun.write(q,$);let W=u(K,"craft");P1(G,W),C1(W,493);let U=`#!/bin/bash
15302
+ `;if(await Bun.write(u(K,`${Z}.bat`),W),Q==="zip"){let U=u(X,`${Z}-${Y}-windows.zip`),z=await WO(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 XO($,Z,Y,X,Q,J,G){let K=u(X,Z);s0(K,{recursive:!0});let q=u(K,"index.html");await Bun.write(q,$);let W=u(K,"craft");P1(G,W),C1(W,493);let U=`#!/bin/bash
15246
15303
  set -euo pipefail
15247
15304
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
15248
15305
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -15257,9 +15314,9 @@ Name=${Z}
15257
15314
  Exec=${z}
15258
15315
  Terminal=false
15259
15316
  Categories=Utility;
15260
- `;if(await Bun.write(u(K,`${Z.toLowerCase()}.desktop`),_),Q==="deb"){let B=u(X,`${Z.toLowerCase()}_${Y}_amd64.deb`),j=await eH(K,B,Z,Y,J);if(!j.success)return{success:!1,target:"linux",format:"deb",error:j.error};return{success:!0,target:"linux",format:"deb",outputPath:B}}if(Q==="appimage"){let B=u(X,`${Z}-${Y}-x86_64.AppImage`),j=await $O(K,B,Z,J);if(!j.success)return{success:!1,target:"linux",format:"appimage",error:j.error};return{success:!0,target:"linux",format:"appimage",outputPath:B}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function nH($,Z,Y,X,Q,J){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 sH($,Z,Y,X,Q,J){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 oH(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[u(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),u(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),u(L9(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),u(L9(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",u(L9(),".local/bin/craft"),u(process.env.LOCALAPPDATA||"","craft","craft.exe"),u(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=uH("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
15261
- `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function V7(){switch(dH()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function rH($){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 aH($,Z,Y){return new Promise((X)=>{let Q=w7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);Q.on("close",(J)=>{if(J===0)X({success:!0});else X({success:!1,error:`hdiutil exited with code ${J}`})}),Q.on("error",(J)=>{X({success:!1,error:J.message})})})}async function tH($,Z){return new Promise((Y)=>{let X=w7("zip",["-r",Z,"."],{cwd:$});X.on("close",(Q)=>{if(Q===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${Q}`})}),X.on("error",(Q)=>{Y({success:!1,error:Q.message})})})}async function eH($,Z,Y,X,Q){return new Promise((J)=>{try{let G=u(nQ(),`stx-deb-${Date.now()}`),K=u(G,"DEBIAN"),q=u(G,"usr","bin"),W=u(G,"usr","share","applications"),U=u(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(q,{recursive:!0}),s0(W,{recursive:!0}),s0(U,{recursive:!0});let z=a("fs").readdirSync($);for(let H of z)P1(u($,H),u(U,H));let _=`#!/bin/bash
15262
- exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;a("fs").writeFileSync(u(q,Y.toLowerCase()),_),C1(u(q,Y.toLowerCase()),493);let B=`Package: ${Y.toLowerCase()}
15317
+ `;if(await Bun.write(u(K,`${Z.toLowerCase()}.desktop`),_),Q==="deb"){let B=u(X,`${Z.toLowerCase()}_${Y}_amd64.deb`),j=await UO(K,B,Z,Y,J);if(!j.success)return{success:!1,target:"linux",format:"deb",error:j.error};return{success:!0,target:"linux",format:"deb",outputPath:B}}if(Q==="appimage"){let B=u(X,`${Z}-${Y}-x86_64.AppImage`),j=await zO(K,B,Z,J);if(!j.success)return{success:!1,target:"linux",format:"appimage",error:j.error};return{success:!0,target:"linux",format:"appimage",outputPath:B}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function JO($,Z,Y,X,Q,J){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 QO($,Z,Y,X,Q,J){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 GO(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[u(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),u(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),u(V9(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),u(V9(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",u(V9(),".local/bin/craft"),u(process.env.LOCALAPPDATA||"","craft","craft.exe"),u(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=aH("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
15318
+ `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function V7(){switch(tH()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function KO($){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 qO($,Z,Y){return new Promise((X)=>{let Q=w7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);Q.on("close",(J)=>{if(J===0)X({success:!0});else X({success:!1,error:`hdiutil exited with code ${J}`})}),Q.on("error",(J)=>{X({success:!1,error:J.message})})})}async function WO($,Z){return new Promise((Y)=>{let X=w7("zip",["-r",Z,"."],{cwd:$});X.on("close",(Q)=>{if(Q===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${Q}`})}),X.on("error",(Q)=>{Y({success:!1,error:Q.message})})})}async function UO($,Z,Y,X,Q){return new Promise((J)=>{try{let G=u(eQ(),`stx-deb-${Date.now()}`),K=u(G,"DEBIAN"),q=u(G,"usr","bin"),W=u(G,"usr","share","applications"),U=u(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(q,{recursive:!0}),s0(W,{recursive:!0}),s0(U,{recursive:!0});let z=o("fs").readdirSync($);for(let H of z)P1(u($,H),u(U,H));let _=`#!/bin/bash
15319
+ exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;o("fs").writeFileSync(u(q,Y.toLowerCase()),_),C1(u(q,Y.toLowerCase()),493);let B=`Package: ${Y.toLowerCase()}
15263
15320
  Version: ${X}
15264
15321
  Section: utils
15265
15322
  Priority: optional
@@ -15267,16 +15324,16 @@ Architecture: amd64
15267
15324
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
15268
15325
  Maintainer: ${Q.author||"Unknown"}
15269
15326
  Description: ${Q.description||Y}
15270
- `;a("fs").writeFileSync(u(K,"control"),B);let j=w7("dpkg-deb",["--build",G,Z]);j.on("close",(H)=>{if(a("fs").rmSync(G,{recursive:!0,force:!0}),H===0)J({success:!0});else J({success:!1,error:`dpkg-deb exited with code ${H}`})}),j.on("error",(H)=>{a("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:H.message})})}catch(G){J({success:!1,error:G.message})}})}async function $O($,Z,Y,X){return new Promise((Q)=>{try{let J=u(nQ(),`stx-appimage-${Date.now()}`),G=u(J,`${Y}.AppDir`),K=u(G,"usr"),q=u(K,"bin"),W=u(K,"share");s0(q,{recursive:!0}),s0(W,{recursive:!0});let U=u(W,Y.toLowerCase());s0(U,{recursive:!0});let z=a("fs").readdirSync($);for(let L of z)P1(u($,L),u(U,L));let _=`#!/bin/bash
15327
+ `;o("fs").writeFileSync(u(K,"control"),B);let j=w7("dpkg-deb",["--build",G,Z]);j.on("close",(H)=>{if(o("fs").rmSync(G,{recursive:!0,force:!0}),H===0)J({success:!0});else J({success:!1,error:`dpkg-deb exited with code ${H}`})}),j.on("error",(H)=>{o("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:H.message})})}catch(G){J({success:!1,error:G.message})}})}async function zO($,Z,Y,X){return new Promise((Q)=>{try{let J=u(eQ(),`stx-appimage-${Date.now()}`),G=u(J,`${Y}.AppDir`),K=u(G,"usr"),q=u(K,"bin"),W=u(K,"share");s0(q,{recursive:!0}),s0(W,{recursive:!0});let U=u(W,Y.toLowerCase());s0(U,{recursive:!0});let z=o("fs").readdirSync($);for(let L of z)P1(u($,L),u(U,L));let _=`#!/bin/bash
15271
15328
  SELF=$(readlink -f "$0")
15272
15329
  HERE=\${SELF%/*}
15273
15330
  export PATH="\${HERE}/usr/bin:\${PATH}"
15274
15331
  exec "\${HERE}/usr/share/${Y.toLowerCase()}/${Y.toLowerCase()}" "$@"
15275
- `;a("fs").writeFileSync(u(G,"AppRun"),_),C1(u(G,"AppRun"),493);let B=`[Desktop Entry]
15332
+ `;o("fs").writeFileSync(u(G,"AppRun"),_),C1(u(G,"AppRun"),493);let B=`[Desktop Entry]
15276
15333
  Type=Application
15277
15334
  Name=${Y}
15278
15335
  Exec=${Y.toLowerCase()}
15279
15336
  Terminal=false
15280
15337
  Categories=Utility;
15281
15338
  Icon=${Y.toLowerCase()}
15282
- `;a("fs").writeFileSync(u(G,`${Y.toLowerCase()}.desktop`),B);let j=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(a("fs").writeFileSync(u(G,`${Y.toLowerCase()}.png`),j),X.icon&&iQ(X.icon))P1(X.icon,u(G,`${Y.toLowerCase()}.png`));let H=w7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(L)=>{if(a("fs").rmSync(J,{recursive:!0,force:!0}),L===0)C1(Z,493),Q({success:!0});else Q({success:!1,error:`appimagetool exited with code ${L}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(L)=>{a("fs").rmSync(J,{recursive:!0,force:!0}),Q({success:!1,error:`appimagetool not found: ${L.message}`})})}catch(J){Q({success:!1,error:J.message})}})}function jT(){return[V7()]}function HT($){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{BO as renderSSR,UO as registerCraftComponent,JO as processCraftDirective,b9 as processCraftComponents,HO as prerenderForCraft,XO as isCraftEnvironment,w9 as injectCraftBridge,LO as getSSRCacheStats,zO as getCraftComponents,jT as getAvailableTargets,HT as getAvailableFormats,jO as generateCraftOptimizations,V9 as generateCraftBridgeScript,KO as createHotReloadServer,GO as compileToNative,yG as compileTemplate,oG as clearTemplateCache,rG as clearRenderCache,OO as clearAllCaches,BT as buildNative,tQ as NATIVE_COMPONENTS,k9 as CRAFT_COMPONENT_STYLES,WO as CRAFT_COMPONENT_RUNTIME,T7 as CRAFT_COMPONENTS,YO as CRAFT_BRIDGE_SCRIPT};
15339
+ `;o("fs").writeFileSync(u(G,`${Y.toLowerCase()}.desktop`),B);let j=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(o("fs").writeFileSync(u(G,`${Y.toLowerCase()}.png`),j),X.icon&&tQ(X.icon))P1(X.icon,u(G,`${Y.toLowerCase()}.png`));let H=w7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(L)=>{if(o("fs").rmSync(J,{recursive:!0,force:!0}),L===0)C1(Z,493),Q({success:!0});else Q({success:!1,error:`appimagetool exited with code ${L}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(L)=>{o("fs").rmSync(J,{recursive:!0,force:!0}),Q({success:!1,error:`appimagetool not found: ${L.message}`})})}catch(J){Q({success:!1,error:J.message})}})}function DT(){return[V7()]}function kT($){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{NO as renderSSR,AO as registerCraftComponent,HO as processCraftDirective,y9 as processCraftComponents,IO as prerenderForCraft,jO as isCraftEnvironment,R9 as injectCraftBridge,DO as getSSRCacheStats,RO as getCraftComponents,DT as getAvailableTargets,kT as getAvailableFormats,TO as generateCraftOptimizations,A9 as generateCraftBridgeScript,FO as createHotReloadServer,LO as compileToNative,gG as compileTemplate,ZK as clearTemplateCache,YK as clearRenderCache,EO as clearAllCaches,ET as buildNative,JG as NATIVE_COMPONENTS,S9 as CRAFT_COMPONENT_STYLES,wO as CRAFT_COMPONENT_RUNTIME,T7 as CRAFT_COMPONENTS,BO as CRAFT_BRIDGE_SCRIPT};