@stacksjs/stx 0.2.179 → 0.2.181

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 _W=Object.defineProperty;var jW=(X)=>X;function HW(X,$){this[X]=jW.bind(null,$)}var a=(X,$)=>{for(var Z in $)_W(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:HW.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var X0=import.meta.require;var P6=()=>{};function v6(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,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"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),J}var x6,f6;var A$=E(()=>{P6();x6={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",w={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${X}`},hasEndTag:!1},f6={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function HU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...j1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 FW=Object.defineProperty;var VW=(X)=>X;function AW(X,$){this[X]=VW.bind(null,$)}var e=(X,$)=>{for(var Z in $)FW(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:AW.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var Z0=import.meta.require;var d6=()=>{};function m6(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,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"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),J}var l6,c6;var I$=E(()=>{d6();l6={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",w={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${X}`},hasEndTag:!1},c6={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function AU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...O1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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`${G==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 _W=Object.defineProperty;var jW=(X)=>X;function HW(X,$){this[X]=jW.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`${G==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 LU(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function RU(){return`
13
13
  <script data-stx-scoped data-stx-run="once">
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function OU(X){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((Z)=>Z.test(X))}function FU(X=0.1,$="0px"){return`
40
+ `}function MU(X){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((Z)=>Z.test(X))}function TU(X=0.1,$="0px"){return`
41
41
  <script data-stx-scoped data-stx-run="always">
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function VU(){return`
83
+ `}function NU(){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 AU(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
198
+ `}function kU(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
199
199
  <script data-stx-scoped data-stx-run="always">
200
200
  // Animation Group: ${X}
201
201
  (function() {
@@ -232,13 +232,13 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function m6(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!OU(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let w=VU();J=J.replace("</head>",`${w}
236
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=FU(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
237
- `+J.slice(W)}}return J}var j1,g6,h6,u6,d6;var R$=E(()=>{j1={duration:300,delay:0,ease:"ease",direction:"both"};g6={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||j1.duration:j1.duration,Q=$.length>2?$[2]||j1.ease:j1.ease,w=$.length>3?Number.parseInt($[3],10)||j1.delay:j1.delay,q=$.length>4?$[4]||j1.direction:j1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=HU(J,{duration:G,delay:w,ease:Q,direction:q}),K="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${W}" class="${K} ${z} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},h6={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",w=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(J==="fade")K+=" stx-fade";else if(J==="slide-up"||J==="slide")K+=" stx-from-bottom";else if(J==="slide-down")K+=" stx-from-top";else if(J==="slide-left")K+=" stx-from-right";else if(J==="slide-right")K+=" stx-from-left";else if(J==="scale")K+=" stx-scale";else if(J.includes("-"))K+=` stx-${J}`;else K+=` stx-${J}`;return`<div id="${W}" class="${K}" style="${U}" data-threshold="${w}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},u6={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=AU(J,G,{staggerDelay:Q,sequence:w});return`${X}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},d6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=LU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function M$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>z7.includes(Z))}function B7(X){return M$(X.replace(/^\//,""))}var z7;var zX=E(()=>{z7=["components","layouts","partials","emails"]});import R5 from"fs";import _7 from"path";function j7(X,$){let Z=X.filter((Q)=>!B7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let W of Q.params){let U=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${U}: string`)}let q=w.join("; ");Y.push(` '${Q.pattern}': { ${q} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
240
- `),G=_7.join($,"route-types.d.ts");try{if(R5.existsSync(G)&&R5.readFileSync(G,"utf8")===J)return;R5.mkdirSync($,{recursive:!0}),R5.writeFileSync(G,J)}catch{}}function H7(X,$,Z){let Y=process.cwd(),J=_7.relative(Y,Z),G=X.filter((w)=>!B7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let q=_7.relative(Y,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),U=w.layout?`, layout: '${_7.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${U} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),R5.mkdirSync($,{recursive:!0}),R5.writeFileSync(_7.join($,"routes.ts"),Q.join(`
241
- `))}var T$=E(()=>{zX()});import l6 from"path";function BX(X,$){let Y=l6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(l6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function L7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function _X(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function c6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return L7($)}var N$=()=>{};import RU from"fs";import k$ from"path";function jX(X,$){let Z=[],Y=k$.dirname(X);while(Y.startsWith($)||Y===$){let J=k$.join(Y,"_layout.stx");if(RU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=k$.dirname(Y)}return Z}var I$=()=>{};import E$ from"fs";import M5 from"path";function p6(X,$){let Z=[];if(!E$.existsSync(X))return Z;let Y=E$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=M5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(z7.includes(J.name))continue;Z.push(...p6(G,$))}else if(J.isFile()){let Q=M5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class T5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>M5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=p6(Q,Y);for(let q of w){let W=BX(q,Q);if(J.has(W))continue;J.add(W);let{regex:U,params:K}=L7(W),z=$.layouts!==!1?jX(q,Q):[];this.routes.push({pattern:W,regex:U,params:K,filePath:q,isDynamic:K.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,w)=>{if(!Q.isDynamic&&w.isDynamic)return-1;if(Q.isDynamic&&!w.isDynamic)return 1;let q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=M5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");j7(this.routes,G),H7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function i6(X,$){return new T5(X,$)}function D$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=M5.join(X,Y);if(E$.existsSync(J))return J}return null}function y$(X,$){return X.map((Z)=>{let Y=M5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var n6=E(()=>{T$();N$();I$();zX()});function b$(X){HX=X.replace(/\/$/,"")}function S$(X,$,Z={}){N5[X]={path:$,name:X,params:Z}}function C$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")N5[$]={path:Z,name:$};else N5[$]={...Z,name:$}}function O7(X,$={},Z=!1){let Y=N5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=J[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${X}].`),`:${q}`;return delete J[q],encodeURIComponent(String(W))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&HX?`${HX}${G}`:G}function P$(){for(let X of Object.keys(N5))delete N5[X];HX=""}var N5,HX="";var r6=E(()=>{N5={}});import s6 from"fs";import o6 from"path";function a6(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function t6(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function e6(X,$={}){return{handler:X,mode:$.mode??"universal"}}function v$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(w)}}return $}function LX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function x$(X,$){let Z=X.headers.get("cookie")||"",Y=v$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",LX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",LX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function f$(){return{get(X){if(typeof document>"u")return;return v$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=LX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=LX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return v$(document.cookie)}}}function g$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function OX(X,$){F7.set(X,$)}function h$(X){return F7.get(X)}function X2(X){return F7.has(X)}function $2(){F7.clear()}function Z2(){return Array.from(F7.keys())}async function Y2(X,$="middleware"){let Z=o6.resolve(X,$);if(!s6.existsSync(Z))return;let Y=s6.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=o6.join(Z,J);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")OX(G,q);else if(typeof q==="function")OX(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function MU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function J2(X,$,Z,Y=""){return{path:X,params:$,query:MU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function G2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?x$(Z,Q):f$(),storage:g$(),state:{},request:Z,responseHeaders:Q}}async function Q2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=h$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var F7;var w2=E(()=>{F7=new Map});function V7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function q2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||V7(J)}}function TU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function A7(){if(FX)return FX;return FX=TU(`
235
+ `}function s6(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!MU(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let w=NU();J=J.replace("</head>",`${w}
236
+ </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=TU(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
237
+ `+J.slice(W)}}return J}var O1,p6,i6,n6,r6;var E$=E(()=>{O1={duration:300,delay:0,ease:"ease",direction:"both"};p6={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||O1.duration:O1.duration,Q=$.length>2?$[2]||O1.ease:O1.ease,w=$.length>3?Number.parseInt($[3],10)||O1.delay:O1.delay,q=$.length>4?$[4]||O1.direction:O1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=AU(J,{duration:G,delay:w,ease:Q,direction:q}),K="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${W}" class="${K} ${z} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},i6={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",w=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(J==="fade")K+=" stx-fade";else if(J==="slide-up"||J==="slide")K+=" stx-from-bottom";else if(J==="slide-down")K+=" stx-from-top";else if(J==="slide-left")K+=" stx-from-right";else if(J==="slide-right")K+=" stx-from-left";else if(J==="scale")K+=" stx-scale";else if(J.includes("-"))K+=` stx-${J}`;else K+=` stx-${J}`;return`<div id="${W}" class="${K}" style="${U}" data-threshold="${w}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},n6={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=kU(J,G,{staggerDelay:Q,sequence:w});return`${X}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},r6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=RU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function D$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>H7.includes(Z))}function L7(X){return D$(X.replace(/^\//,""))}var H7;var HX=E(()=>{H7=["components","layouts","partials","emails"]});import N5 from"fs";import O7 from"path";function F7(X,$){let Z=X.filter((Q)=>!L7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let W of Q.params){let U=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${U}: string`)}let q=w.join("; ");Y.push(` '${Q.pattern}': { ${q} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
240
+ `),G=O7.join($,"route-types.d.ts");try{if(N5.existsSync(G)&&N5.readFileSync(G,"utf8")===J)return;N5.mkdirSync($,{recursive:!0}),N5.writeFileSync(G,J)}catch{}}function V7(X,$,Z){let Y=process.cwd(),J=O7.relative(Y,Z),G=X.filter((w)=>!L7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let q=O7.relative(Y,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),U=w.layout?`, layout: '${O7.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${U} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),N5.mkdirSync($,{recursive:!0}),N5.writeFileSync(O7.join($,"routes.ts"),Q.join(`
241
+ `))}var y$=E(()=>{HX()});import o6 from"path";function LX(X,$){let Y=o6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(o6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function A7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function OX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function a6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return A7($)}var b$=()=>{};import IU from"fs";import S$ from"path";function FX(X,$){let Z=[],Y=S$.dirname(X);while(Y.startsWith($)||Y===$){let J=S$.join(Y,"_layout.stx");if(IU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=S$.dirname(Y)}return Z}var C$=()=>{};import P$ from"fs";import k5 from"path";function t6(X,$){let Z=[];if(!P$.existsSync(X))return Z;let Y=P$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=k5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(H7.includes(J.name))continue;Z.push(...t6(G,$))}else if(J.isFile()){let Q=k5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class I5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>k5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=t6(Q,Y);for(let q of w){let W=LX(q,Q);if(J.has(W))continue;J.add(W);let{regex:U,params:K}=A7(W),z=$.layouts!==!1?FX(q,Q):[];this.routes.push({pattern:W,regex:U,params:K,filePath:q,isDynamic:K.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,w)=>{if(!Q.isDynamic&&w.isDynamic)return-1;if(Q.isDynamic&&!w.isDynamic)return 1;let q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=k5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");F7(this.routes,G),V7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function e6(X,$){return new I5(X,$)}function v$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=k5.join(X,Y);if(P$.existsSync(J))return J}return null}function x$(X,$){return X.map((Z)=>{let Y=k5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var X2=E(()=>{y$();b$();C$();HX()});function f$(X){VX=X.replace(/\/$/,"")}function g$(X,$,Z={}){E5[X]={path:$,name:X,params:Z}}function h$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")E5[$]={path:Z,name:$};else E5[$]={...Z,name:$}}function R7(X,$={},Z=!1){let Y=E5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=J[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${X}].`),`:${q}`;return delete J[q],encodeURIComponent(String(W))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&VX?`${VX}${G}`:G}function u$(){for(let X of Object.keys(E5))delete E5[X];VX=""}var E5,VX="";var $2=E(()=>{E5={}});import Z2 from"fs";import Y2 from"path";function J2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function G2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function Q2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function d$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(w)}}return $}function AX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function m$(X,$){let Z=X.headers.get("cookie")||"",Y=d$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",AX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",AX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function l$(){return{get(X){if(typeof document>"u")return;return d$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=AX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=AX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d$(document.cookie)}}}function c$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function RX(X,$){M7.set(X,$)}function p$(X){return M7.get(X)}function w2(X){return M7.has(X)}function q2(){M7.clear()}function W2(){return Array.from(M7.keys())}async function U2(X,$="middleware"){let Z=Y2.resolve(X,$);if(!Z2.existsSync(Z))return;let Y=Z2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=Y2.join(Z,J);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")RX(G,q);else if(typeof q==="function")RX(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function EU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function K2(X,$,Z,Y=""){return{path:X,params:$,query:EU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function z2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?m$(Z,Q):l$(),storage:c$(),state:{},request:Z,responseHeaders:Q}}async function B2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=p$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var M7;var _2=E(()=>{M7=new Map});function T7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function j2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||T7(J)}}function DU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function N7(){if(MX)return MX;return MX=DU(`
242
242
  ;(function(){
243
243
  'use strict';
244
244
  var ROUTER_REV=7;
@@ -1888,7 +1888,7 @@ else {
1888
1888
 
1889
1889
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1890
1890
  })();
1891
- `),FX}var FX;var W2={};a(W2,{setAppUrl:()=>b$,runMiddleware:()=>Q2,route:()=>O7,resolveLayoutChain:()=>jX,resetRoutes:()=>P$,registerMiddleware:()=>OX,patternToRegex:()=>L7,navigateTo:()=>a6,matchRoute:()=>_X,loadMiddlewareFromDirectory:()=>Y2,isNonPageRoutePattern:()=>B7,isNonPageRoutePath:()=>M$,hasMiddleware:()=>X2,getRouterScript:()=>A7,getMiddlewareNames:()=>Z2,getMiddleware:()=>h$,generateRouteTypes:()=>j7,generateRouteManifest:()=>H7,formatRoutes:()=>y$,findErrorPage:()=>D$,filePathToPattern:()=>BX,extractLayoutMetadata:()=>q2,deriveLayoutGroup:()=>V7,defineRoutes:()=>C$,defineRoute:()=>S$,defineMiddleware:()=>e6,createStorageManager:()=>g$,createServerCookieManager:()=>x$,createRouter:()=>i6,createRouteLocation:()=>J2,createMiddlewareContext:()=>G2,createClientCookieManager:()=>f$,clearMiddleware:()=>$2,bracketPathToRegex:()=>c6,abortNavigation:()=>t6,Router:()=>T5,NON_PAGE_DIRS:()=>z7});var r1=E(()=>{n6();N$();r6();w2();I$();T$();zX()});var U2=E(()=>{r1();u$()});async function NU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=A7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var K2;var u$=E(()=>{U2();K2={name:"stxRouter",handler:NU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function z2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...kU,...$};return`
1891
+ `),MX}var MX;var H2={};e(H2,{setAppUrl:()=>f$,runMiddleware:()=>B2,route:()=>R7,resolveLayoutChain:()=>FX,resetRoutes:()=>u$,registerMiddleware:()=>RX,patternToRegex:()=>A7,navigateTo:()=>J2,matchRoute:()=>OX,loadMiddlewareFromDirectory:()=>U2,isNonPageRoutePattern:()=>L7,isNonPageRoutePath:()=>D$,hasMiddleware:()=>w2,getRouterScript:()=>N7,getMiddlewareNames:()=>W2,getMiddleware:()=>p$,generateRouteTypes:()=>F7,generateRouteManifest:()=>V7,formatRoutes:()=>x$,findErrorPage:()=>v$,filePathToPattern:()=>LX,extractLayoutMetadata:()=>j2,deriveLayoutGroup:()=>T7,defineRoutes:()=>h$,defineRoute:()=>g$,defineMiddleware:()=>Q2,createStorageManager:()=>c$,createServerCookieManager:()=>m$,createRouter:()=>e6,createRouteLocation:()=>K2,createMiddlewareContext:()=>z2,createClientCookieManager:()=>l$,clearMiddleware:()=>q2,bracketPathToRegex:()=>a6,abortNavigation:()=>G2,Router:()=>I5,NON_PAGE_DIRS:()=>H7});var X5=E(()=>{X2();b$();$2();_2();C$();y$();HX()});var L2=E(()=>{X5();i$()});async function yU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=N7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var O2;var i$=E(()=>{L2();O2={name:"stxRouter",handler:yU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function F2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...bU,...$};return`
1892
1892
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1893
1893
  <script>
1894
1894
  (function() {
@@ -2271,10 +2271,10 @@ else {
2271
2271
  };
2272
2272
  })();
2273
2273
  </script>
2274
- `}function B2(X,$){let Z=z2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function IU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var kU,_2;var d$=E(()=>{kU={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};_2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=IU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return z2(J)}}});function E1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function j2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function VX(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
2275
- `)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),U=w.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)}G[W]=U}return{data:G,content:J.trim()}}function s1(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(U,K,z)=>{let _=G.length,B=K?` class="language-${E1(K)}"`:"";return G.push(`<pre><code${B}>${E1(z.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),J=J.replace(/`([^`]*)`/g,(U,K)=>`<code>${E1(K)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,K,z)=>{return`<img src="${j2(z)?E1(z):""}" alt="${E1(K)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,K,z)=>{return`<a href="${j2(z)?E1(z):""}">${K}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
2276
- `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,K,z)=>{let B=`<tr>${K.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${E1(H)}</th>`).join("")}</tr>`,j=z.trim().split(`
2277
- `).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${E1(L)}</td>`).join("")}</tr>`}).join(`
2274
+ `}function V2(X,$){let Z=F2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function SU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var bU,A2;var n$=E(()=>{bU={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};A2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=SU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return F2(J)}}});function b1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function R2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function TX(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
2275
+ `)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),U=w.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)}G[W]=U}return{data:G,content:J.trim()}}function $5(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(U,K,z)=>{let _=G.length,B=K?` class="language-${b1(K)}"`:"";return G.push(`<pre><code${B}>${b1(z.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),J=J.replace(/`([^`]*)`/g,(U,K)=>`<code>${b1(K)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,K,z)=>{return`<img src="${R2(z)?b1(z):""}" alt="${b1(K)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,K,z)=>{return`<a href="${R2(z)?b1(z):""}">${K}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
2276
+ `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,K,z)=>{let B=`<tr>${K.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${b1(H)}</th>`).join("")}</tr>`,j=z.trim().split(`
2277
+ `).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${b1(L)}</td>`).join("")}</tr>`}).join(`
2278
2278
  `);return`<table>
2279
2279
  <thead>
2280
2280
  ${B}
@@ -2289,7 +2289,7 @@ ${j}
2289
2289
  `:`
2290
2290
  `)}</p>`);if(J=w.join(`
2291
2291
  `),Y)J=J.replace(/\n/g,`<br />
2292
- `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function k5(X="const",$=[],Z){let Y=$.length?H1.filter((J)=>!$.includes(J)):H1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function m$(X){if(!X)return!1;return DU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function l$(X){if(!X)return!1;let $=R2(X);if(yU.some((Z)=>Z.test($)))return!0;return m$($)}function L2(X){if(!X)return!1;return bU.test(R2(X))||l$(X)}function O2(X){return SU.includes(X.toLowerCase())}function A2(){return`{${F2.map((X)=>`'${X}':1`).join(",")}}`}function R2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var H1,H2,EU,DU,yU,bU,SU,F2,CU,V2;var X1=E(()=>{H1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],H2=["onMount","onDestroy"];EU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],DU=H1.filter((X)=>!EU.includes(X));yU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],bU=/\s@[a-z][\w.:-]*\s*=/i;SU=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];F2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],CU=["x-init","x-transition","x-effect","x-on"],V2=[...F2,...CU]});function N2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(PU.has(Y))$.systemKeys.push(Y);else if(Y in k2)$.mouse=Y;else if(Y in T2||/^[a-z]$/.test(Y))$.keys.push(T2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function I2(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=z.exec(w))!==null){let[,j,H]=_,O=j.split("."),L=O[0];if(!M2.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:N2(O.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(w))!==null){let[,j,H]=_,O=j.split("."),L=O[0];if(!M2.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:N2(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:q,endIndex:W})}return $}function vU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=k2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function xU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function c$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function fU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=vU(X),J=xU(c$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2292
+ `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function D5(X="const",$=[],Z){let Y=$.length?F1.filter((J)=>!$.includes(J)):F1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function r$(X){if(!X)return!1;return PU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function s$(X){if(!X)return!1;let $=D2(X);if(vU.some((Z)=>Z.test($)))return!0;return r$($)}function T2(X){if(!X)return!1;return xU.test(D2(X))||s$(X)}function N2(X){return fU.includes(X.toLowerCase())}function E2(){return`{${k2.map((X)=>`'${X}':1`).join(",")}}`}function D2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var F1,M2,CU,PU,vU,xU,fU,k2,gU,I2;var Z1=E(()=>{F1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],M2=["onMount","onDestroy"];CU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],PU=F1.filter((X)=>!CU.includes(X));vU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],xU=/\s@[a-z][\w.:-]*\s*=/i;fU=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];k2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],gU=["x-init","x-transition","x-effect","x-on"],I2=[...k2,...gU]});function S2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(hU.has(Y))$.systemKeys.push(Y);else if(Y in C2)$.mouse=Y;else if(Y in b2||/^[a-z]$/.test(Y))$.keys.push(b2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function P2(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=z.exec(w))!==null){let[,j,H]=_,O=j.split("."),L=O[0];if(!y2.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:S2(O.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(w))!==null){let[,j,H]=_,O=j.split("."),L=O[0];if(!y2.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:S2(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:q,endIndex:W})}return $}function uU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=C2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function dU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function o$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function mU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=uU(X),J=dU(o$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2293
2293
  (function() {
2294
2294
  var $el = document.getElementById('${Z}');
2295
2295
  if (!$el) return;
@@ -2343,7 +2343,7 @@ else {
2343
2343
  __stx_runHandler('${w}', $event, $el);
2344
2344
  }
2345
2345
  }${Q});
2346
- })();`}function p$(X){if(X.length===0)return"";return`
2346
+ })();`}function a$(X){if(X.length===0)return"";return`
2347
2347
  <script data-stx-events>
2348
2348
  (function() {
2349
2349
  'use strict';
@@ -2398,44 +2398,44 @@ else {
2398
2398
  }
2399
2399
 
2400
2400
  // Event listeners
2401
- ${X.map(fU).join(`
2401
+ ${X.map(mU).join(`
2402
2402
  `)}
2403
2403
  })();
2404
- </script>`}function gU(X){let $=I2(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function E2(X,$,Z){if(l$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:q}=gU(X),W=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...W,...q],w}let Y=I2(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let K of q.events)K.elementId=U[1]}for(let U of q.events){let K=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");W=W.replace(z,""),W=W.replace(_,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=p$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
2405
- `+J.slice(Q);else J+=G;return J}var M2,T2,PU,k2;var i$=E(()=>{X1();M2=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"]),T2={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"},PU=new Set(["ctrl","alt","shift","meta"]),k2={left:0,middle:1,right:2}});function m0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2404
+ </script>`}function lU(X){let $=P2(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function v2(X,$,Z){if(s$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:q}=lU(X),W=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...W,...q],w}let Y=P2(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let K of q.events)K.elementId=U[1]}for(let U of q.events){let K=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");W=W.replace(z,""),W=W.replace(_,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=a$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
2405
+ `+J.slice(Q);else J+=G;return J}var y2,b2,hU,C2;var t$=E(()=>{Z1();y2=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"]),b2={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"},hU=new Set(["ctrl","alt","shift","meta"]),C2={left:0,middle:1,right:2}});function i0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
2406
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
- `}),X}function AX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function hU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function uU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=RX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function RX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=hU(X,Y);continue}if(J==="`"){Y=uU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
2408
- `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function r0(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2407
+ `}),X}function NX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function cU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function pU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=kX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function kX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=cU(X,Y);continue}if(J==="`"){Y=pU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
2408
+ `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function o0(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2409
2409
  `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
2410
2410
  `?`
2411
2411
  `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
2412
2412
  `?`
2413
- `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=RX(X,G);if($+=" ",$+=r0(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2413
+ `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=kX(X,G);if($+=" ",$+=o0(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2414
2414
  `?`
2415
- `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function dU(){let X=globalThis;return X[D2]??=new Map,X[D2]}function t(X,$){let Z=dU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var D2;var R7=E(()=>{D2=Symbol.for("stx.lazy-module-promises")});function I5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(mU,"<\\/$1")}var mU;var n$=E(()=>{mU=/<\/(script)/gi});import lU from"process";function x0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(lU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var D1=()=>{};import M7 from"path";function b2(X){y2=X?.trim()||null}function T7(){return process.env[cU]?.trim()||y2||E5}function N7(X=process.cwd(),...$){let Z=T7();return M7.isAbsolute(Z)?M7.join(Z,...$):M7.join(X,Z,...$)}function k7(X){if(!X||M7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==E5&&!$.startsWith(`${E5}/`))return X;let Z=$.slice(E5.length+1);return Z?M7.join(T7(),Z):T7()}var E5=".stx",cU="STX_DIR",y2=null;var MX=()=>{};function pU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function iU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function r$(X,$){let Z=[];for(let Y of iU(X)){if(pU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function S2(X,$){return r$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
2415
+ `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function iU(){let X=globalThis;return X[x2]??=new Map,X[x2]}function $0(X,$){let Z=iU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var x2;var k7=E(()=>{x2=Symbol.for("stx.lazy-module-promises")});function y5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(nU,"<\\/$1")}var nU;var e$=E(()=>{nU=/<\/(script)/gi});import rU from"process";function d0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(rU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var S1=()=>{};import I7 from"path";function g2(X){f2=X?.trim()||null}function E7(){return process.env[sU]?.trim()||f2||b5}function D7(X=process.cwd(),...$){let Z=E7();return I7.isAbsolute(Z)?I7.join(Z,...$):I7.join(X,Z,...$)}function y7(X){if(!X||I7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==b5&&!$.startsWith(`${b5}/`))return X;let Z=$.slice(b5.length+1);return Z?I7.join(E7(),Z):E7()}var b5=".stx",sU="STX_DIR",f2=null;var IX=()=>{};function oU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function aU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function EX(X,$){let Z=[];for(let Y of aU(X)){if(oU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function h2(X,$){return EX(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
2416
2416
  ${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
2417
- `)}var I7={};a(I7,{shouldLogBundlerDiagnostics:()=>x2,setBundlerFallbackMode:()=>oU,resolveBundlerFallback:()=>g2,recordBundleFailure:()=>f2,queueClientBundleBuild:()=>h2,hasUserImports:()=>aU,getBundleFailures:()=>rU,clearBundleFailures:()=>sU,bundleClientScript:()=>eU});import O0 from"path";import f0 from"fs";function x2(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function o1(...X){if(x2())console.log("[stx:bundler]",...X)}function f2(X,$,Z){a$.push({filePath:X||"<inline>",message:$,details:Z})}function rU(){return a$.slice()}function sU(){a$.length=0}function oU(X){o$=X}function g2(){if(o$)return o$;try{let X=D7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function aU(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!C2.some((Q)=>Q.test(J)))return o1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!C2.some((Q)=>Q.test(J)))return o1("detected side-effect import:",J),!0}return!1}function tU(X,$,Z,Y){let J=(G,Q)=>{let w=G===Z?$:O0.dirname(G),q=O0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,O0.join(q,"index.ts"),O0.join(q,"index.tsx"),O0.join(q,"index.js"),O0.join(q,"index.mjs")];for(let U of W)try{if(f0.existsSync(U)&&f0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(f0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=O0.resolve(X,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,O0.join(w,"index.ts"),O0.join(w,"index.tsx"),O0.join(w,"index.js"),O0.join(w,"index.mjs")];for(let W of q)if(f0.existsSync(W)&&f0.statSync(W,{throwIfNoEntry:!1})?.isFile())return o1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),Y.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=O0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:f0.readFileSync(Q.path,"utf8"),loader:q}})}}}function h2(X){let $=globalThis,Y=($[P2]??Promise.resolve()).then(X,X);return $[P2]=Y.then(()=>{return},()=>{return}),Y}async function eU(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||N7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${nU}\x00${X}\x00${$}`);let w=Q.digest("hex").slice(0,12),q=O0.join(G,`${w}.js`),W=O0.join(G,`${w}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let j=JSON.parse(await _.text());if(j.metadataVersion!==v2||!Array.isArray(j.files))B=!1;for(let H of Array.isArray(j.files)?j.files:[])try{if(f0.statSync(H.path).mtimeMs!==H.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return o1("cache hit:",w),await U.text();o1("cache invalidated by dep change:",w)}let K=s$.get(w);if(K)return await K;let z=h2(()=>XK(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:q,depsPath:W}));s$.set(w,z);try{return await z}finally{s$.delete(w)}}async function XK(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=N7(Y,"bundle-tmp"),U=O0.join(W,`${Q}.ts`),K=O0.join(W,"out",Q);f0.mkdirSync(W,{recursive:!0}),f0.mkdirSync(K,{recursive:!0});let z=O0.dirname($),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,j=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=B.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)_.push(V)});else if(H[3])_.push(H[3])}while((H=j.exec(X))!==null){if(H[1])continue;_.push(H[2])}let O=_.length>0?`
2418
- export { ${_.join(", ")} }`:"";await Bun.write(U,X+O),o1("bundling:",Q,"from:",O0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[U],outdir:K,target:"browser",format:"esm",minify:J,plugins:[tU(Y,z,U,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...x0()},root:Y});if(!F.success){let I=F.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ");return console.warn("[stx:bundler] build failed:",I),X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of I[1].split(",")){let b=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${Q}`,T=A.map(([I,C])=>`${JSON.stringify(I)}: ${C}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
2419
- `),N=A.map(([I])=>`${I} = ${M}[${JSON.stringify(I)}];`).join(`
2417
+ `)}var b7={};e(b7,{shouldLogBundlerDiagnostics:()=>l2,setBundlerFallbackMode:()=>$K,resolveBundlerFallback:()=>Y9,recordBundleFailure:()=>$9,queueClientBundleBuild:()=>c2,hasUserImports:()=>ZK,getBundleFailures:()=>eU,clearBundleFailures:()=>XK,bundleClientScript:()=>JK});import H0 from"path";import m0 from"fs";function l2(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function Z5(...X){if(l2())console.log("[stx:bundler]",...X)}function $9(X,$,Z){J9.push({filePath:X||"<inline>",message:$,details:Z})}function eU(){return J9.slice()}function XK(){J9.length=0}function $K(X){Z9=X}function Y9(){if(Z9)return Z9;try{let X=C7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function ZK(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!u2.some((Q)=>Q.test(J)))return Z5("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!u2.some((Q)=>Q.test(J)))return Z5("detected side-effect import:",J),!0}return!1}function YK(X,$,Z,Y){let J=(G,Q)=>{let w=G===Z?$:H0.dirname(G),q=H0.resolve(w,Q),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(m0.existsSync(U)&&m0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(m0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=H0.resolve(X,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,H0.join(w,"index.ts"),H0.join(w,"index.tsx"),H0.join(w,"index.js"),H0.join(w,"index.mjs")];for(let W of q)if(m0.existsSync(W)&&m0.statSync(W,{throwIfNoEntry:!1})?.isFile())return Z5(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),Y.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=H0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:m0.readFileSync(Q.path,"utf8"),loader:q}})}}}function c2(X){let $=globalThis,Y=($[d2]??Promise.resolve()).then(X,X);return $[d2]=Y.then(()=>{return},()=>{return}),Y}async function JK(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||D7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${tU}\x00${X}\x00${$}`);let w=Q.digest("hex").slice(0,12),q=H0.join(G,`${w}.js`),W=H0.join(G,`${w}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let j=JSON.parse(await _.text());if(j.metadataVersion!==m2||!Array.isArray(j.files))B=!1;for(let H of Array.isArray(j.files)?j.files:[])try{if(m0.statSync(H.path).mtimeMs!==H.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return Z5("cache hit:",w),await U.text();Z5("cache invalidated by dep change:",w)}let K=X9.get(w);if(K)return await K;let z=c2(()=>GK(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:q,depsPath:W}));X9.set(w,z);try{return await z}finally{X9.delete(w)}}async function GK(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=D7(Y,"bundle-tmp"),U=H0.join(W,`${Q}.ts`),K=H0.join(W,"out",Q);m0.mkdirSync(W,{recursive:!0}),m0.mkdirSync(K,{recursive:!0});let z=H0.dirname($),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,j=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=B.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)_.push(V)});else if(H[3])_.push(H[3])}while((H=j.exec(X))!==null){if(H[1])continue;_.push(H[2])}let O=_.length>0?`
2418
+ export { ${_.join(", ")} }`:"";await Bun.write(U,X+O),Z5("bundling:",Q,"from:",H0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[U],outdir:K,target:"browser",format:"esm",minify:J,plugins:[YK(Y,z,U,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...d0()},root:Y});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${H0.basename($)}`,b=EX(F.logs,$||void 0);if(console.warn("[stx:bundler] build failed:",S),$9($||"",S,b),Y9()==="error")throw Error(S);return X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of I[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),N=A.map(([I])=>`var ${I} = undefined;`).join(`
2419
+ `),k=A.map(([I])=>`${I} = ${M}[${JSON.stringify(I)}];`).join(`
2420
2420
  `);if(V=`${R.join(`
2421
2421
  `)}
2422
- ${k}
2422
+ ${N}
2423
2423
  var ${M} = (function() {
2424
2424
  ${V}
2425
2425
  return { ${T} };
2426
2426
  })();
2427
- ${N}`.trim(),o1("bundled:",Q,"output:",V.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${O0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;f0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:f0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:v2,files:D})),V}catch(F){let V=r$(F,$||void 0),A=S2(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),f2($||"",A,V),g2()==="error")throw F;return X}finally{try{f0.rmSync(U,{force:!0}),f0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var nU=5,v2=1,a$,o$,C2,s$,P2;var E7=E(()=>{D1();MX();L1();a$=[];C2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];s$=new Map,P2=Symbol.for("stx.client-bundle-build-queue")});var n2={};a(n2,{stripCommentsAndLiterals:()=>r0,renderVendorStyleTags:()=>NX,processClientScript:()=>e1,injectBrowserCoreAutoImports:()=>D5,generateServerDataBridge:()=>kX,generateBrowserAutoImportDestructuring:()=>WK,generateAutoImportDestructuring:()=>t$,findInterpolationEnd:()=>RX,extractBridgeData:()=>t1,extractAndStripCssImports:()=>TX,STX_AUTO_IMPORTS:()=>l2});import a1 from"path";import y7 from"fs";function ZK(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function YK(X,$){let Z=$;while(!0){let Y=a1.join(Z,"node_modules",X,"package.json");if(y7.existsSync(Y))return a1.dirname(Y);let J=a1.dirname(Z);if(J===Z)return null;Z=J}}function JK(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function GK(X,$){let Z=ZK(X);if(!Z||!Z.subpath)return null;let Y=YK(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(y7.readFileSync(a1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=JK(J.exports,G);if(!Q)return null;let w=a1.resolve(Y,Q);return y7.existsSync(w)?w:null}function TX(X,$){let Z=$.filePath?a1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace($K,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:a1.resolve(Z,q),!y7.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,Y)}catch{U=GK(q,Y)}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 ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(W))return"";J.add(W);try{let U=y7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:G}}function QK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${QK($.source)}" data-stx-layer="vendor">
2427
+ ${k}`.trim(),Z5("bundled:",Q,"output:",V.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${H0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;m0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:m0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:m2,files:D})),V}catch(F){let V=EX(F,$||void 0),A=h2(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),$9($||"",A,V),Y9()==="error")throw F;return X}finally{try{m0.rmSync(U,{force:!0}),m0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var tU=5,m2=1,J9,Z9,u2,X9,d2;var S7=E(()=>{S1();IX();V1();J9=[];u2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];X9=new Map,d2=Symbol.for("stx.client-bundle-build-queue")});var t2={};e(t2,{stripCommentsAndLiterals:()=>o0,renderVendorStyleTags:()=>yX,processClientScript:()=>G5,injectBrowserCoreAutoImports:()=>S5,generateServerDataBridge:()=>bX,generateBrowserAutoImportDestructuring:()=>_K,generateAutoImportDestructuring:()=>G9,findInterpolationEnd:()=>kX,extractBridgeData:()=>J5,extractAndStripCssImports:()=>DX,STX_AUTO_IMPORTS:()=>r2});import Y5 from"path";import P7 from"fs";function wK(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function qK(X,$){let Z=$;while(!0){let Y=Y5.join(Z,"node_modules",X,"package.json");if(P7.existsSync(Y))return Y5.dirname(Y);let J=Y5.dirname(Z);if(J===Z)return null;Z=J}}function WK(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function UK(X,$){let Z=wK(X);if(!Z||!Z.subpath)return null;let Y=qK(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(P7.readFileSync(Y5.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=WK(J.exports,G);if(!Q)return null;let w=Y5.resolve(Y,Q);return P7.existsSync(w)?w:null}function DX(X,$){let Z=$.filePath?Y5.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(QK,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:Y5.resolve(Z,q),!P7.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,Y)}catch{U=UK(q,Y)}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 ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(W))return"";J.add(W);try{let U=P7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:G}}function KK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${KK($.source)}" data-stx-layer="vendor">
2428
2428
  @layer vendor {
2429
2429
  ${$.contents}
2430
2430
  }
2431
2431
  </style>`}).join(`
2432
2432
  `)}
2433
- `}function D5(X){let $=r0(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=c2.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=p2($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2433
+ `}function S5(X){let $=o0(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=s2.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=o2($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2434
2434
  `)}
2435
- ${X}`,imports:J,models:G}}function p2(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!wK.has(Y[1]))$.add(Y[1]);return Array.from($)}function qK(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function i2(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let W=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let K=[];for(let _ of W.split(",")){let B=_.trim();if(!B||B.startsWith("type "))continue;let j=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let H=j[1],O=j[2]||H;if(J.add(H),J.add(O),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)K.push(`${O} = ${H}`)}let z=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=qK(Y);for(let W of l2){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(W)}for(let W of c2){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=p2(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function t$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2435
+ ${X}`,imports:J,models:G}}function o2(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!zK.has(Y[1]))$.add(Y[1]);return Array.from($)}function BK(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function a2(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let W=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let K=[];for(let _ of W.split(",")){let B=_.trim();if(!B||B.startsWith("type "))continue;let j=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let H=j[1],O=j[2]||H;if(J.add(H),J.add(O),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)K.push(`${O} = ${H}`)}let z=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=BK(Y);for(let W of r2){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(W)}for(let W of s2){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=o2(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function G9(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2436
2436
  ${Z.join(`
2437
2437
  `)}
2438
- ${UK(X,$)}`;return""}function WK(X,$=[]){let{browserImports:Z}=i2(X),Y=new Set($);return t$([],Z.filter((J)=>!Y.has(J)))}function UK(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2438
+ ${jK(X,$)}`;return""}function _K(X,$=[]){let{browserImports:Z}=a2(X),Y=new Set($);return G9([],Z.filter((J)=>!Y.has(J)))}function jK(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2439
2439
  [${Z.join(", ")}].forEach(function (e) {
2440
2440
  if (e[1] !== 'undefined') return;
2441
2441
  console.error(
@@ -2444,10 +2444,10 @@ ${UK(X,$)}`;return""}function WK(X,$=[]){let{browserImports:Z}=i2(X),Y=new Set($
2444
2444
  + 'or it should be imported from a relative path so the bundler includes it.'
2445
2445
  );
2446
2446
  });
2447
- `}function t1(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function u2(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function KK(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u2(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u2(Z[1],!1).has($))return!0;return!1}function zK(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function _K(X,$){let Z=BK.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(d2.has(X))return;if(d2.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kX(X,$){if(!$)return"";let Z=r0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!zK(Z,G))continue;if(KK(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;_K(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2447
+ `}function J5(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function p2(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function HK(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(p2(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(p2(Z[1],!1).has($))return!0;return!1}function LK(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function FK(X,$){let Z=OK.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(i2.has(X))return;if(i2.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function bX(X,$){if(!$)return"";let Z=o0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!LK(Z,G))continue;if(HK(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;FK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
2448
  ${J.join(`
2449
2449
  `)}
2450
- `}function HK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=jK[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function LK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=c$(X.handler),Q=HK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
2450
+ `}function AK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=VK[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function RK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=o$(X.handler),Q=AK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
2451
2451
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2452
2452
  };`;function z(_){if(/\$emit\s*\(/.test(_))return`${K}
2453
2453
  ${_}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -2490,25 +2490,25 @@ else {
2490
2490
  else {
2491
2491
  ${G}
2492
2492
  }
2493
- }${q})`}function OK(X){if(X.length===0)return"";return`
2493
+ }${q})`}function MK(X){if(X.length===0)return"";return`
2494
2494
  // STX: auto-generated event bindings
2495
- ${X.map((Z,Y)=>LK(Z,Y)).join(`
2496
- `)}`}function m2(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&W===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){W++,Q+=2;continue}if(Y[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===q){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
2497
- `)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let z=W[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((z)=>{let _=z.trim(),B=_.indexOf(":"),j=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!Z.has(j))$.push(j),Z.add(j)}),Q+=U[0].length;continue}let K=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let z=K[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=K[0].length;continue}}Q++}return $}function VK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let _;while((_=Z.exec(z))!==null){let B=_[0];if(!FK.has(B))$.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);return $}async function e1(X,$={}){let Z=X,Y="",J=!1,G=[],Q=TX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let w=NX(Q.styles),q=D5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (E7(),I7)));if(W(Z))Z=await U(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=i2(Z);Z=L.code,Y=t$(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${kX(Z,$.serverData)}${Y}`,Z=m0(Z),!J&&X5($.attrs||""))Z=$5(Z);let K=OK($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${w}<script ${F}>
2498
- ${I5(`${Y}${Z}
2495
+ ${X.map((Z,Y)=>RK(Z,Y)).join(`
2496
+ `)}`}function n2(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&W===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){W++,Q+=2;continue}if(Y[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===q){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
2497
+ `)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let z=W[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((z)=>{let _=z.trim(),B=_.indexOf(":"),j=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!Z.has(j))$.push(j),Z.add(j)}),Q+=U[0].length;continue}let K=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let z=K[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=K[0].length;continue}}Q++}return $}function NK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let _;while((_=Z.exec(z))!==null){let B=_[0];if(!TK.has(B))$.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);return $}async function G5(X,$={}){let Z=X,Y="",J=!1,G=[],Q=DX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let w=yX(Q.styles),q=S5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (S7(),b7)));if(W(Z))Z=await U(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=a2(Z);Z=L.code,Y=G9(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${bX(Z,$.serverData)}${Y}`,Z=i0(Z),!J&&Q5($.attrs||""))Z=w5(Z);let K=MK($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${w}<script ${F}>
2498
+ ${y5(`${Y}${Z}
2499
2499
  ${K}`)}
2500
- </script>`}let B=m$(X),j=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function O(L){let F=L.length>0?`
2500
+ </script>`}let B=r$(X),j=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function O(L){let F=L.length>0?`
2501
2501
  return { ${L.join(", ")} };`:"";return`${w}<script data-stx-scoped data-stx-run="always">
2502
2502
  window.stx.mount(function() {
2503
2503
  'use strict';
2504
- ${I5(`${Y}${Z}
2504
+ ${y5(`${Y}${Z}
2505
2505
  ${K}${F}`)}
2506
- })</script>`}if(!H&&!j){if(B)return O(m2(X));if($.templateContent){let L=m2(X);if(L.length>0){let F=VK($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2506
+ })</script>`}if(!H&&!j){if(B)return O(n2(X));if($.templateContent){let L=n2(X);if(L.length>0){let F=NK($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2507
2507
  ;(function() {
2508
2508
  'use strict';
2509
- ${I5(`${Y}${Z}
2509
+ ${y5(`${Y}${Z}
2510
2510
  ${K}`)}
2511
- })()</script>`}var $K,l2,c2,wK,BK,d2,jK,FK;var y5=E(()=>{i$();T0();R7();X1();n$();$K=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;l2=H1,c2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];wK=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"]);BK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,d2=new Set;jK={left:0,middle:1,right:2};FK=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 AK}from"crypto";function r2(X){let $=X[IX];return $ instanceof Map?$:null}function s2(X){X[IX]=new Map}function o2(X,$){let Z=r2(X);if(!Z)return null;let Y=AK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function a2(X,$){let Z=r2($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2511
+ })()</script>`}var QK,r2,s2,zK,OK,i2,VK,TK;var C5=E(()=>{t$();L0();k7();Z1();e$();QK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;r2=F1,s2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];zK=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"]);OK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,i2=new Set;VK={left:0,middle:1,right:2};TK=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 kK}from"crypto";function e2(X){let $=X[SX];return $ instanceof Map?$:null}function XZ(X){X[SX]=new Map}function $Z(X,$){let Z=e2(X);if(!Z)return null;let Y=kK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function ZZ(X,$){let Z=e2($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2512
2512
  (function() {
2513
2513
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2514
2514
  ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2517,7 +2517,7 @@ ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
2517
2517
  })();
2518
2518
  </script>`,w=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(w<0)return`${Q}
2519
2519
  ${Y}`;return`${Y.slice(0,w)}${Q}
2520
- ${Y.slice(w)}`}var IX="__stx_component_client_factories";var e$=()=>{};function NK(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function kK(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(MK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&$Z.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function IK(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!$Z.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function EX(X){let $=X.trim(),Z=NK($);kK(Z,$),IK($);for(let Y of XZ)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!e2.allowBracketNotation&&TK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function EK(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||XZ.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=X9(Y);else $[Z]=Y}return $}function X9(X,$=0){if($>=e2.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>X9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=X9(J,$+1);else Z[Y]=J}return Z}function J0(X,$){try{let Z=EK($),Y=Object.keys(Z),J=Object.values(Z);return q0(X,Y)(...J)}catch{return}}function w0(X){try{return EX(X),!0}catch{return!1}}function V0(X,$){try{let Z=J0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function q0(X,$){let Z=EX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let W=0;W<$.length;W++){let U=$[W];if(!Y.test(U))continue;if(ZZ.has(U))continue;J.push(W),G.push(U)}let Q=(W)=>Function(...G,...W,`
2520
+ ${Y.slice(w)}`}var SX="__stx_component_client_factories";var Q9=()=>{};function yK(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function bK(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(EK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&QZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function SK(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!QZ.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function CX(X){let $=X.trim(),Z=yK($);bK(Z,$),SK($);for(let Y of GZ)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!JZ.allowBracketNotation&&DK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function CK(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||GZ.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=w9(Y);else $[Z]=Y}return $}function w9(X,$=0){if($>=JZ.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>w9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=w9(J,$+1);else Z[Y]=J}return Z}function Q0(X,$){try{let Z=CK($),Y=Object.keys(Z),J=Object.values(Z);return W0(X,Y)(...J)}catch{return}}function q0(X){try{return CX(X),!0}catch{return!1}}function M0(X,$){try{let Z=Q0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function W0(X,$){let Z=CX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let W=0;W<$.length;W++){let U=$[W];if(!Y.test(U))continue;if(wZ.has(U))continue;J.push(W),G.push(U)}let Q=(W)=>Function(...G,...W,`
2521
2521
  'use strict';
2522
2522
  try {
2523
2523
  return ${Z};
@@ -2528,7 +2528,7 @@ catch (e) {
2528
2528
  }
2529
2529
  throw e;
2530
2530
  }
2531
- `),w=Q([]);if(G.length===$.length)return t2(w,G,Q);return t2((...W)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=W[J[K]];return w(...U)},G,Q,(W)=>{w=Q(W)})}function t2(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let U=0;U<=8;U++)try{return Q(...W)}catch(K){let z=K instanceof Error?K.message:"",_=G.exec(z);if(!(K instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||ZZ.has(B))return;q.add(B),w.push(B),Q=Z(w),Y?.(w)}return}}function DX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var RK,e2,XZ,MK,$Z,TK,ZZ;var A0=E(()=>{RK={maxSanitizeDepth:10,allowBracketNotation:!1},e2={...RK},XZ=[/\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/],MK=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"]),$Z=new Set(["__proto__","constructor","prototype"]),TK=/[\w)\]]\s*\[\s*['"]/;ZZ=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 yX(X,$){let Z=DK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return yK.set(Y,{type:X,expression:$}),Y}var DK=0,yK;var YZ=E(()=>{yK=new Map});function qZ(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function y1(X,$){return qZ(X,$,JZ,GZ)}function b5(X,$){return qZ(X,$,QZ,wZ)}function b7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function bK(X,$){if(X.startsWith("<!--",$)){let Z=b7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[JZ,GZ],[QZ,wZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function bX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=bK(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Q1(X,$,Z){let Y=bX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function b1(X){let{output:$,tokens:Z}=Q1(X,y1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function S7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var JZ,GZ,QZ,wZ;var Z5=E(()=>{JZ=/<script\b[^>]*>/iy,GZ=/<\/script\s*>/ig,QZ=/<style\b[^>]*>/iy,wZ=/<\/style\s*>/ig});var jZ={};a(jZ,{usesSignalsInScript:()=>O1,unescapeHtml:()=>uK,registerFilters:()=>CK,registerFilter:()=>KZ,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>xK,interpolateScriptExpressions:()=>SX,interpolateScriptAttributes:()=>BZ,getAllFilters:()=>zZ,evaluateExpression:()=>g0,escapeHtml:()=>$1,defaultFilters:()=>P7,clearCustomFilters:()=>PK,applyFilters:()=>_Z});function SK(X){let $=WZ.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),WZ.set(X,$)}return $.lastIndex=0,$}function KZ(X,$){if(X in P7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);C7[X]=$}function CK(X){for(let[$,Z]of Object.entries(X))KZ($,Z)}function zZ(){return{...P7,...C7}}function PK(){for(let X of Object.keys(C7))delete C7[X]}function $1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function O1(X){let{scripts:$}=b1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function UZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function vK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=r0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function SX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=g0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=g0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function BZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=g0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=g0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function xK(X,$,Z={}){let{output:Y,scripts:J}=b1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let _=`<script${BZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return _+K+Q.slice(W);return _+SX(K,$)+Q.slice(W)});return S7(Y,G)}function S1(X,$,Z){let Y=X,J=(K,z)=>{let _=b5(K,z);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,_))?-1:_},G=(K,z,_,B)=>{let j=_.length,{output:H,tokens:O}=Q1(K,z,(L,F)=>B(j+F));return _.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,y1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let q=$?.__stx_signals_gate===!0||O1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,_)=>{try{let B=g0(z,$);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,_,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,_)=>{try{let B=g0(z,$);if(B===void 0&&$.__stx_buildMode==="compile")return yX("raw",z.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if($.__stx_buildMode==="compile")return yX("raw",z.trim());let j=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,_,K)}}),Y=G(Y,y1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,_)=>{let B=z.trim();if(U.has(B))return K;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),M=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(B))return"";try{let T=g0(z,$);if(V)return K;if(q&&!UZ(B,$))return K;if($.__stx_buildMode==="compile"&&!q&&(T===void 0||vK(B,$)))return yX("expr",B);return T!==void 0&&T!==null?$1(String(T)):""}catch(T){if(V)return K;if(q&&!UZ(B,$))return K;if(M)return K;let k=T instanceof Error?T.message:String(T);return z0("Expression",`Error evaluating: {{ ${B} }}: ${k}`,Z,X,_,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function _Z(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=C7[Q]||P7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(zZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let K=Number(U);q=[Number.isNaN(K)?U:K]}catch{q=[U]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,U=1;while(W>0&&U<J.length){if(J[U]==="(")W++;if(J[U]===")")W--;U++}if(W===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))q=[g0(`(${K})`,Z,!0)];else{let z=[],_="",B=null,j=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){_+=V,L=!1;continue}if(V==="\\"){_+=V,L=!0;continue}if(B){if(_+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,_+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(_),_="";continue}_+=V}if(_)z.push(_);q=z.map((F)=>{let V=F.trim();return g0(V,Z,!0)})}}catch{q=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function fK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function g0(X,$,Z=!1){try{let Y=X.trim(),J=fK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=g0(G,$,!0);return _Z(w,Q,$)}if(!w0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return J0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return q0(Y,G)(...Q)}catch{return J0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=gK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function gK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=hK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function hK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function uK(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var C7,WZ,P7;var w1=E(()=>{A0();T0();YZ();Z5();C7={},WZ=new Map;P7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return $1(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(SK(q),String(W))}),w},t:(X,$,Z={})=>{return P7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class Y5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function C5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!S5.has(Z)){if(S5.size>=dK){let Y=S5.keys().next().value;if(Y)S5.delete(Y)}S5.set(Z,new RegExp(X,$))}return S5.get(Z)}class HZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,U=J.get(W);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
2531
+ `),w=Q([]);if(G.length===$.length)return YZ(w,G,Q);return YZ((...W)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=W[J[K]];return w(...U)},G,Q,(W)=>{w=Q(W)})}function YZ(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let U=0;U<=8;U++)try{return Q(...W)}catch(K){let z=K instanceof Error?K.message:"",_=G.exec(z);if(!(K instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||wZ.has(B))return;q.add(B),w.push(B),Q=Z(w),Y?.(w)}return}}function PX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var IK,JZ,GZ,EK,QZ,DK,wZ;var T0=E(()=>{IK={maxSanitizeDepth:10,allowBracketNotation:!1},JZ={...IK},GZ=[/\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/],EK=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"]),QZ=new Set(["__proto__","constructor","prototype"]),DK=/[\w)\]]\s*\[\s*['"]/;wZ=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 vX(X,$){let Z=PK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return vK.set(Y,{type:X,expression:$}),Y}var PK=0,vK;var qZ=E(()=>{vK=new Map});function BZ(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function C1(X,$){return BZ(X,$,WZ,UZ)}function P5(X,$){return BZ(X,$,KZ,zZ)}function v7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function xK(X,$){if(X.startsWith("<!--",$)){let Z=v7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[WZ,UZ],[KZ,zZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function xX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=xK(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function W1(X,$,Z){let Y=xX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function U1(X){let{output:$,tokens:Z}=W1(X,C1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function v5(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var WZ,UZ,KZ,zZ;var P1=E(()=>{WZ=/<script\b[^>]*>/iy,UZ=/<\/script\s*>/ig,KZ=/<style\b[^>]*>/iy,zZ=/<\/style\s*>/ig});var VZ={};e(VZ,{usesSignalsInScript:()=>A1,unescapeHtml:()=>pK,registerFilters:()=>gK,registerFilter:()=>HZ,processExpressions:()=>v1,interpolateScriptsInTemplate:()=>dK,interpolateScriptExpressions:()=>fX,interpolateScriptAttributes:()=>OZ,getAllFilters:()=>LZ,evaluateExpression:()=>l0,escapeHtml:()=>Y1,defaultFilters:()=>f7,clearCustomFilters:()=>hK,applyFilters:()=>FZ});function fK(X){let $=_Z.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),_Z.set(X,$)}return $.lastIndex=0,$}function HZ(X,$){if(X in f7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);x7[X]=$}function gK(X){for(let[$,Z]of Object.entries(X))HZ($,Z)}function LZ(){return{...f7,...x7}}function hK(){for(let X of Object.keys(x7))delete x7[X]}function Y1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A1(X){let{scripts:$}=U1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function jZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function uK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=o0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function fX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=l0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=l0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function OZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=l0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=l0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function dK(X,$,Z={}){let{output:Y,scripts:J}=U1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let _=`<script${OZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return _+K+Q.slice(W);return _+fX(K,$)+Q.slice(W)});return v5(Y,G)}function v1(X,$,Z){let Y=X,J=(K,z)=>{let _=P5(K,z);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,_))?-1:_},G=(K,z,_,B)=>{let j=_.length,{output:H,tokens:O}=W1(K,z,(L,F)=>B(j+F));return _.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,C1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let q=$?.__stx_signals_gate===!0||A1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,_)=>{try{let B=l0(z,$);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,_,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,_)=>{try{let B=l0(z,$);if(B===void 0&&$.__stx_buildMode==="compile")return vX("raw",z.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if($.__stx_buildMode==="compile")return vX("raw",z.trim());let j=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,_,K)}}),Y=G(Y,C1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,_)=>{let B=z.trim();if(U.has(B))return K;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),M=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(B))return"";try{let T=l0(z,$);if(V)return K;if(q&&!jZ(B,$))return K;if($.__stx_buildMode==="compile"&&!q&&(T===void 0||uK(B,$)))return vX("expr",B);return T!==void 0&&T!==null?Y1(String(T)):""}catch(T){if(V)return K;if(q&&!jZ(B,$))return K;if(M)return K;let N=T instanceof Error?T.message:String(T);return _0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,Z,X,_,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function FZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=x7[Q]||f7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(LZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let K=Number(U);q=[Number.isNaN(K)?U:K]}catch{q=[U]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,U=1;while(W>0&&U<J.length){if(J[U]==="(")W++;if(J[U]===")")W--;U++}if(W===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))q=[l0(`(${K})`,Z,!0)];else{let z=[],_="",B=null,j=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){_+=V,L=!1;continue}if(V==="\\"){_+=V,L=!0;continue}if(B){if(_+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,_+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(_),_="";continue}_+=V}if(_)z.push(_);q=z.map((F)=>{let V=F.trim();return l0(V,Z,!0)})}}catch{q=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function mK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function l0(X,$,Z=!1){try{let Y=X.trim(),J=mK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=l0(G,$,!0);return FZ(w,Q,$)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Q0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return W0(Y,G)(...Q)}catch{return Q0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=lK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function lK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=cK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function cK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function pK(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var x7,_Z,f7;var K1=E(()=>{T0();L0();qZ();P1();x7={},_Z=new Map;f7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return Y1(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(fK(q),String(W))}),w},t:(X,$,Z={})=>{return f7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class q5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function f5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!x5.has(Z)){if(x5.size>=iK){let Y=x5.keys().next().value;if(Y)x5.delete(Y)}x5.set(Z,new RegExp(X,$))}return x5.get(Z)}class AZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,U=J.get(W);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
2532
2532
  'use strict';
2533
2533
  try {
2534
2534
  return ${q};
@@ -2539,15 +2539,15 @@ catch (e) {
2539
2539
  }
2540
2540
  throw e;
2541
2541
  }
2542
- `),J.set(W,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class LZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}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 mK(){if(!$9)$9=new LZ;return $9}var S5,dK=500,LR,$9=null,OZ;var P5=E(()=>{S5=new Map;LR=new HZ;OZ=new Proxy({},{get(X,$){return mK()[$]}})});function Z9(X){return`--stx-${X}`}function Y9(X,$){let Z=$.lastIndexOf("-");if(Z===-1)return typeof X[$]==="string"?X[$]:void 0;let Y=X[$.slice(0,Z)];if(!Y||typeof Y!=="object")return;let J=Y[$.slice(Z+1)];return typeof J==="string"?J:void 0}function VZ(X){let $={};for(let[Z,Y]of Object.entries(FZ)){let J=Y9(X,Y.light);if(J===void 0)continue;$[Z]=`var(${Z9(Z)}, ${J})`}return $}function AZ(X){let $=[],Z=[];for(let[Y,J]of Object.entries(FZ)){let G=Y9(X,J.light),Q=Y9(X,J.dark);if(G===void 0)continue;if($.push(` ${Z9(Y)}: ${G};`),Q!==void 0)Z.push(` ${Z9(Y)}: ${Q};`)}if($.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...$,"}",".dark {",...Z,"}",""].join(`
2543
- `)}var FZ;var RZ=E(()=>{FZ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function MZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function J9(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=MZ(J)&&MZ(Z[Y])?J9(Z[Y],J):J;return Z}function TZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=w.colors||{};w.colors={...q,...VZ(q)};let W=J9(w,G),U=J9(Q||{},J||{});if(Object.keys(U).length>0)W.extend=U;let K=[...X.safelist||[],...$.safelist||[]],z={...X.shortcuts||{},...$.shortcuts||{}},_=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:W,safelist:K,shortcuts:z,..._.length>0?{preflights:_}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:AZ(q)}}var NZ=E(()=>{RZ()});var _0;var kZ=E(()=>{_0={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 SZ={};a(SZ,{resetCssCache:()=>oK,resetCrosswindCache:()=>aK,rebuildCrosswindCSS:()=>tK,loadCrosswindConfig:()=>q9,loadCrosswind:()=>w9,injectCrosswindCSS:()=>W9,getCrosswindServeAsset:()=>pK,getCachedCSS:()=>eK,generateCrosswindCSS:()=>bZ,extractClassNames:()=>yZ,buildCrosswindCSS:()=>DZ});import G0 from"path";import{hasLocalConfig as lK}from"bunfig";function PX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function G9(X,$){if(F1.has(X))F1.delete(X);else if(F1.size>=EZ)F1.delete(F1.keys().next().value);F1.set(X,$)}function cK(X){let $=PX(X);if(Z1.has($))Z1.delete($);else if(Z1.size>=EZ)Z1.delete(Z1.keys().next().value);return Z1.set($,X),$}function pK(X){let $=Z1.get(X);if($===void 0)return;return Z1.delete(X),Z1.set(X,$),$}async function iK(X){if(!C1)return null;try{let $=Bun.file(G0.join(C1,`cw-${PX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function nK(X,$){if(!C1)return;try{if(!fs.existsSync(C1))fs.mkdirSync(C1,{recursive:!0});await Bun.write(G0.join(C1,`cw-${PX(X)}.css`),$)}catch{}}async function IZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function rK(){let X=[],$=process.cwd();while($!==G0.dirname($))X.push(G0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(G0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(G0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(G0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(G0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(G0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=G0.dirname($);return X}function sK(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[G0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function w9(){if(Q9)return q1;Q9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await IZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=G0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return q1=G,q1}let $=await X(rK());if($)return q1=$,q1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await IZ(J);if(G){if(q1=G,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return q1}}let Y=await X(sK());if(Y)return q1=Y,q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}function oK(){F1.clear(),Z1.clear()}function aK(){q1=null,Q9=!1,Y1=null,v7="",F1.clear(),Z1.clear(),CX=null}async function q9(X){try{if(!lK({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=G0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function DZ(X){if(v5)return v7;v5=!0;try{let $=await w9();if(!$||!$.build)return v5=!1,"";if(!Y1)Y1=await q9(X);if(!Y1)return v5=!1,"";let Z=$.defaultConfig?.theme||{},Y=Y1.theme||{},J={...$.defaultConfig,...Y1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(v7=Q.css,console.log(`${_0.cyan}[Crosswind]${_0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=G0.isAbsolute(J.output)?J.output:G0.join(X,J.output),W=G0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch($){return console.error(`${_0.red}[Crosswind]${_0.reset} Build error:`,$),v5=!1,v7}}async function tK(X){Y1=null,await DZ(X)}function eK(){return v7}function yZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function bZ(X,$){try{let Z=await w9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):yZ(X);if(Y.size===0)return"";let J=$?G0.resolve($):process.cwd();if(!C1)C1=N7(J,"cache");let G=[...Y].sort().join(" "),Q=`${CX||"default"}::${G}`,w=F1.get(Q);if(w!==void 0)return G9(Q,w),w;let q=await iK(Q);if(q!==null)return G9(Q,q),q;if(!Y1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (L1(),CZ)),M=await R(J);if(M.css)if(typeof M.css==="string"){let T=G0.isAbsolute(M.css)?M.css:G0.resolve(J,M.css);if(await Bun.file(T).exists()){let k=await import(T);A=k.default||k,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${M.css}`)}}else{if(A={...M.css,content:M.css.content||[],preflight:M.css.preflight??!0,minify:M.css.minify??!1},M.css.config){let T=G0.isAbsolute(M.css.config)?M.css.config:G0.resolve(J,M.css.config);if(await Bun.file(T).exists()){let k=await import(T);A={...k.default||k,...A}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=A||await q9(J);try{CX=PX(JSON.stringify(Y1??{}))}catch{CX="unhashable"}}let W=Z.defaultConfig||Z.config,U=Y1||{},K=TZ(W,U),{safelist:z,includePreflight:_,minify:B,tokenCSS:j}=K,H=K.config,O=new Z.CSSGenerator(H);for(let A of z)O.generate(A);for(let A of Y)O.generate(A);let L=O.toCSS(_,B),F=H.shortcuts||U.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean);for(let T of M)O.generate(T)}L=O.toCSS(_,B);let V=L.split(`
2544
- `);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean),T=[],k=[];for(let N of M){let D=N.startsWith("dark:"),b=`.${(D?N.slice(5):N).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let v=V[y].trim();if(v===`${b} {`||v.startsWith(`${b} {`)){let x=y,g="";while(x<V.length){if(g+=V[x],V[x].includes("}"))break;x++}let c=g.match(/\{([^}]+)\}/);if(c)if(D)k.push(c[1].trim());else T.push(c[1].trim());break}}}if(T.length)L+=`
2545
- .${A} { ${T.join(" ")} }`;if(k.length)L+=`
2546
- @media (prefers-color-scheme: dark) { .dark .${A} { ${k.join(" ")} } }`}return L=j+L,G9(Q,L),nK(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function W9(X,$,Z=!1){let Y=await bZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${cK(Y)}.css">`:`<style data-crosswind="generated">
2542
+ `),J.set(W,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class RZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}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 nK(){if(!q9)q9=new RZ;return q9}var x5,iK=500,RR,q9=null,MZ;var g5=E(()=>{x5=new Map;RR=new AZ;MZ=new Proxy({},{get(X,$){return nK()[$]}})});function W9(X){return`--stx-${X}`}function U9(X,$){let Z=$.lastIndexOf("-");if(Z===-1)return typeof X[$]==="string"?X[$]:void 0;let Y=X[$.slice(0,Z)];if(!Y||typeof Y!=="object")return;let J=Y[$.slice(Z+1)];return typeof J==="string"?J:void 0}function NZ(X){let $={};for(let[Z,Y]of Object.entries(TZ)){let J=U9(X,Y.light);if(J===void 0)continue;$[Z]=`var(${W9(Z)}, ${J})`}return $}function kZ(X){let $=[],Z=[];for(let[Y,J]of Object.entries(TZ)){let G=U9(X,J.light),Q=U9(X,J.dark);if(G===void 0)continue;if($.push(` ${W9(Y)}: ${G};`),Q!==void 0)Z.push(` ${W9(Y)}: ${Q};`)}if($.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...$,"}",".dark {",...Z,"}",""].join(`
2543
+ `)}var TZ;var IZ=E(()=>{TZ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function EZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function K9(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=EZ(J)&&EZ(Z[Y])?K9(Z[Y],J):J;return Z}function DZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=w.colors||{};w.colors={...q,...NZ(q)};let W=K9(w,G),U=K9(Q||{},J||{});if(Object.keys(U).length>0)W.extend=U;let K=[...X.safelist||[],...$.safelist||[]],z={...X.shortcuts||{},...$.shortcuts||{}},_=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:W,safelist:K,shortcuts:z,..._.length>0?{preflights:_}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:kZ(q)}}var yZ=E(()=>{IZ()});var O0;var bZ=E(()=>{O0={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 fZ={};e(fZ,{resetCssCache:()=>$z,resetCrosswindCache:()=>Zz,rebuildCrosswindCSS:()=>Yz,loadCrosswindConfig:()=>j9,loadCrosswind:()=>_9,injectCrosswindCSS:()=>H9,getCrosswindServeAsset:()=>oK,getCachedCSS:()=>Jz,generateCrosswindCSS:()=>xZ,extractClassNames:()=>vZ,buildCrosswindCSS:()=>PZ});import w0 from"path";import{hasLocalConfig as rK}from"bunfig";function hX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function z9(X,$){if(R1.has(X))R1.delete(X);else if(R1.size>=CZ)R1.delete(R1.keys().next().value);R1.set(X,$)}function sK(X){let $=hX(X);if(J1.has($))J1.delete($);else if(J1.size>=CZ)J1.delete(J1.keys().next().value);return J1.set($,X),$}function oK(X){let $=J1.get(X);if($===void 0)return;return J1.delete(X),J1.set(X,$),$}async function aK(X){if(!x1)return null;try{let $=Bun.file(w0.join(x1,`cw-${hX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function tK(X,$){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(w0.join(x1,`cw-${hX(X)}.css`),$)}catch{}}async function SZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function eK(){let X=[],$=process.cwd();while($!==w0.dirname($))X.push(w0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(w0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(w0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=w0.dirname($);return X}function Xz(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[w0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),w0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),w0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),w0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function _9(){if(B9)return z1;B9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await SZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${w0.dirname(w0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=w0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return z1=G,z1}let $=await X(eK());if($)return z1=$,z1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await SZ(J);if(G){if(z1=G,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return z1}}let Y=await X(Xz());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function $z(){R1.clear(),J1.clear()}function Zz(){z1=null,B9=!1,G1=null,g7="",R1.clear(),J1.clear(),gX=null}async function j9(X){try{if(!rK({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=w0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function PZ(X){if(h5)return g7;h5=!0;try{let $=await _9();if(!$||!$.build)return h5=!1,"";if(!G1)G1=await j9(X);if(!G1)return h5=!1,"";let Z=$.defaultConfig?.theme||{},Y=G1.theme||{},J={...$.defaultConfig,...G1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(g7=Q.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=w0.isAbsolute(J.output)?J.output:w0.join(X,J.output),W=w0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return h5=!1,Q.css}catch($){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,$),h5=!1,g7}}async function Yz(X){G1=null,await PZ(X)}function Jz(){return g7}function vZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function xZ(X,$){try{let Z=await _9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):vZ(X);if(Y.size===0)return"";let J=$?w0.resolve($):process.cwd();if(!x1)x1=D7(J,"cache");let G=[...Y].sort().join(" "),Q=`${gX||"default"}::${G}`,w=R1.get(Q);if(w!==void 0)return z9(Q,w),w;let q=await aK(Q);if(q!==null)return z9(Q,q),q;if(!G1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (V1(),gZ)),M=await R(J);if(M.css)if(typeof M.css==="string"){let T=w0.isAbsolute(M.css)?M.css:w0.resolve(J,M.css);if(await Bun.file(T).exists()){let N=await import(T);A=N.default||N,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${M.css}`)}}else{if(A={...M.css,content:M.css.content||[],preflight:M.css.preflight??!0,minify:M.css.minify??!1},M.css.config){let T=w0.isAbsolute(M.css.config)?M.css.config:w0.resolve(J,M.css.config);if(await Bun.file(T).exists()){let N=await import(T);A={...N.default||N,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}G1=A||await j9(J);try{gX=hX(JSON.stringify(G1??{}))}catch{gX="unhashable"}}let W=Z.defaultConfig||Z.config,U=G1||{},K=DZ(W,U),{safelist:z,includePreflight:_,minify:B,tokenCSS:j}=K,H=K.config,O=new Z.CSSGenerator(H);for(let A of z)O.generate(A);for(let A of Y)O.generate(A);let L=O.toCSS(_,B),F=H.shortcuts||U.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean);for(let T of M)O.generate(T)}L=O.toCSS(_,B);let V=L.split(`
2544
+ `);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!z.includes(A))continue;let M=R.split(/\s+/).filter(Boolean),T=[],N=[];for(let k of M){let D=k.startsWith("dark:"),b=`.${(D?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let x=y,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let i=f.match(/\{([^}]+)\}/);if(i)if(D)N.push(i[1].trim());else T.push(i[1].trim());break}}}if(T.length)L+=`
2545
+ .${A} { ${T.join(" ")} }`;if(N.length)L+=`
2546
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${N.join(" ")} } }`}return L=j+L,z9(Q,L),tK(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function H9(X,$,Z=!1){let Y=await xZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${sK(Y)}.css">`:`<style data-crosswind="generated">
2547
2547
  ${Y}
2548
2548
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
2549
2549
  </head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
2550
- ${J}`);return J+X}var q1=null,Q9=!1,Y1=null,v7="",v5=!1,EZ=256,F1,Z1,C1=null,CX=null;var U9=E(()=>{NZ();MX();kZ();F1=new Map,Z1=new Map});function x7(X){let $=0,Z,Y=K9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)PZ.lastIndex=$,Z=PZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let q=0;q<K9.length;q++){let W=K9[q],U=Y[q];if(U===void 0||U!==null&&U.index<$)W.open.lastIndex=$,U=W.open.exec(X),Y[q]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=W.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function vX(X,$){let Z=x7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var K9,PZ;var z9=E(()=>{K9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],PZ=/<body\b([^>]*)>/gi});function vZ(){return`
2550
+ ${J}`);return J+X}var z1=null,B9=!1,G1=null,g7="",h5=!1,CZ=256,R1,J1,x1=null,gX=null;var L9=E(()=>{yZ();IX();bZ();R1=new Map,J1=new Map});function h7(X){let $=0,Z,Y=O9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)hZ.lastIndex=$,Z=hZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let q=0;q<O9.length;q++){let W=O9[q],U=Y[q];if(U===void 0||U!==null&&U.index<$)W.open.lastIndex=$,U=W.open.exec(X),Y[q]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=W.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function uX(X,$){let Z=h7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var O9,hZ;var F9=E(()=>{O9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],hZ=/<body\b([^>]*)>/gi});function uZ(){return`
2551
2551
  // STX Lifecycle Runtime
2552
2552
  (function() {
2553
2553
  if (typeof window === 'undefined') return;
@@ -2892,7 +2892,7 @@ else {
2892
2892
 
2893
2893
  console.log('[stx] Lifecycle runtime initialized');
2894
2894
  })();
2895
- `}function B9(X){return Symbol(X)}var DR,yR,bR;var xZ=E(()=>{DR=B9("theme"),yR=B9("router"),bR=B9("i18n")});import*as gZ from"crypto";function fZ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function Xz(){return`stx-${gZ.randomBytes(4).toString("hex")}`}function $z(X){return/\$\w+\./.test(X)}function Zz(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],U=!1,K=w,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...w.matchAll(z)];for(let H of _){let O=H[0],L=H[1],F=H[2];if($z(F)){U=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:L,expr:A,fullMatch:O,originalAttr:L}),fZ(A).forEach((M)=>Z.add(M)),L==="text")K=K.replace(O,"");else if(L==="class")K=K.replace(O,'class=""');else if(L==="disabled"||L==="hidden")K=K.replace(O,"");else K=K.replace(O,`${L}=""`)}}}if(!U)return G;let B=K.match(/\bid\s*=\s*"([^"]+)"/),j;if(B)j=B[1];else j=Xz(),K=` id="${j}"${K}`;for(let H of W)$.push({elementId:j,attribute:H.attr,expression:H.expr,stores:fZ(H.expr)});return`<${Q}${K}${q}`}),{html:J,bindings:$,stores:Z}}function Yz(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
2895
+ `}function V9(X){return Symbol(X)}var PR,vR,xR;var dZ=E(()=>{PR=V9("theme"),vR=V9("router"),xR=V9("i18n")});import*as lZ from"crypto";function mZ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function Gz(){return`stx-${lZ.randomBytes(4).toString("hex")}`}function Qz(X){return/\$\w+\./.test(X)}function wz(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],U=!1,K=w,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...w.matchAll(z)];for(let H of _){let O=H[0],L=H[1],F=H[2];if(Qz(F)){U=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:L,expr:A,fullMatch:O,originalAttr:L}),mZ(A).forEach((M)=>Z.add(M)),L==="text")K=K.replace(O,"");else if(L==="class")K=K.replace(O,'class=""');else if(L==="disabled"||L==="hidden")K=K.replace(O,"");else K=K.replace(O,`${L}=""`)}}}if(!U)return G;let B=K.match(/\bid\s*=\s*"([^"]+)"/),j;if(B)j=B[1];else j=Gz(),K=` id="${j}"${K}`;for(let H of W)$.push({elementId:j,attribute:H.attr,expression:H.expr,stores:mZ(H.expr)});return`<${Q}${K}${q}`}),{html:J,bindings:$,stores:Z}}function qz(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
2896
2896
  <script>
2897
2897
  (function() {
2898
2898
  'use strict';
@@ -3050,10 +3050,10 @@ else {
3050
3050
  }
3051
3051
  })();
3052
3052
  </script>
3053
- `,Y}function hZ(X){let{html:$,bindings:Z,stores:Y}=Zz(X);if(Z.length===0)return X;let J=Yz(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var uZ=()=>{};function Jz(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return Gz($);case"google-analytics":return Qz($);case"plausible":return wz($);case"self-hosted":return qz($);case"custom":return Wz($);default:return""}}function Gz(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${l0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${l0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
3053
+ `,Y}function cZ(X){let{html:$,bindings:Z,stores:Y}=wz(X);if(Z.length===0)return X;let J=qz(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var pZ=()=>{};function Wz(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return Uz($);case"google-analytics":return Kz($);case"plausible":return zz($);case"self-hosted":return Bz($);case"custom":return _z($);default:return""}}function Uz(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${n0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${n0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
3054
3054
  <!-- Fathom Analytics -->
3055
- <script src="${l0(Z)}" ${J.join(" ")}${Y}></script>
3056
- `}function Qz(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=l0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3055
+ <script src="${n0(Z)}" ${J.join(" ")}${Y}></script>
3056
+ `}function Kz(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=n0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3057
3057
  <!-- Google Analytics -->
3058
3058
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
3059
3059
  <script>
@@ -3063,10 +3063,10 @@ else {
3063
3063
  gtag('config', '${Z}');
3064
3064
  ${Y}
3065
3065
  </script>
3066
- `}function wz(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${l0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
3066
+ `}function zz(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${n0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
3067
3067
  <!-- Plausible Analytics -->
3068
- <script defer data-domain="${l0($.domain)}" src="${l0(J)}"></script>
3069
- `}function qz(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=l0($.siteId),Y=l0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
3068
+ <script defer data-domain="${n0($.domain)}" src="${n0(J)}"></script>
3069
+ `}function Bz(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=n0($.siteId),Y=n0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
3070
3070
  d.addEventListener('click',function(e){
3071
3071
  var a=e.target.closest('a');
3072
3072
  if(a&&a.hostname!==location.hostname){
@@ -3099,15 +3099,15 @@ else {
3099
3099
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
3100
3100
  })();
3101
3101
  </script>
3102
- `}function Wz(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
3102
+ `}function _z(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
3103
3103
  <!-- Custom Analytics -->
3104
3104
  <script>
3105
3105
  ${$.inlineScript}
3106
3106
  </script>
3107
- `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${l0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${l0(J)}="${l0(G)}"`);return`
3107
+ `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${n0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${n0(J)}="${n0(G)}"`);return`
3108
3108
  <!-- Custom Analytics -->
3109
- <script${Z.length>0?` ${Z.join(" ")}`:""} src="${l0($.scriptUrl)}" defer></script>
3110
- `}function dZ(X,$){let Z=Jz($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function l0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var mZ=()=>{};function lZ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function cZ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function pZ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function zz(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,w=Y.index,q=pZ(Q,"x-data");if(!q)continue;let W=`__stx_scope_${Uz++}`,U=pZ(Q,"x-init"),K=Bz(X,G,w+J.length),z=X.slice(w,K.endIndex),_=_z(z);$.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return $}function Bz(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),w=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let q=G.exec(X),W=Q.exec(X),U=w.exec(X);if(U&&U.index<(q?.index??1/0)){J=U.index+U[0].length;continue}if(!W)return{endIndex:X.length};if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:X.length}}function _z(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=jz(G);$.set(Q,w)}return $}function jz(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${Kz++}`}function Hz(){return`
3109
+ <script${Z.length>0?` ${Z.join(" ")}`:""} src="${n0($.scriptUrl)}" defer></script>
3110
+ `}function iZ(X,$){let Z=Wz($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function n0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var nZ=()=>{};function rZ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function sZ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function oZ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function Lz(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,w=Y.index,q=oZ(Q,"x-data");if(!q)continue;let W=`__stx_scope_${jz++}`,U=oZ(Q,"x-init"),K=Oz(X,G,w+J.length),z=X.slice(w,K.endIndex),_=Fz(z);$.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return $}function Oz(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),w=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let q=G.exec(X),W=Q.exec(X),U=w.exec(X);if(U&&U.index<(q?.index??1/0)){J=U.index+U[0].length;continue}if(!W)return{endIndex:X.length};if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:X.length}}function Fz(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=Vz(G);$.set(Q,w)}return $}function Vz(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${Hz++}`}function Az(){return`
3111
3111
  // STX Reactive Runtime - x-cloak and transition CSS
3112
3112
  (function() {
3113
3113
  var style = document.createElement('style');
@@ -3314,7 +3314,7 @@ window.__stx_reactive = (function() {
3314
3314
 
3315
3315
  return { initScope: initScope, reactive: reactive };
3316
3316
  })();
3317
- `}function iZ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=g0(q,$,!0);if(W===void 0)return w;return String(W)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let q=Z.indexOf("}}",J+2);if(q!==-1){let W=Z.slice(J,q+2);Y+=Q(Z.slice(J+2,q),W,G),J=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,q,W){let U;try{U=g0(w,$,!0)}catch{return q}if(U===void 0)return q;if(W){let K=String(U).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof U==="string"){let K=U.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(U)}}function Lz(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=iZ(Y.stateExpr,$),Q=Y.initExpr?iZ(Y.initExpr,$):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
3317
+ `}function aZ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=l0(q,$,!0);if(W===void 0)return w;return String(W)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let q=Z.indexOf("}}",J+2);if(q!==-1){let W=Z.slice(J,q+2);Y+=Q(Z.slice(J+2,q),W,G),J=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,q,W){let U;try{U=l0(w,$,!0)}catch{return q}if(U===void 0)return q;if(W){let K=String(U).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof U==="string"){let K=U.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(U)}}function Rz(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=aZ(Y.stateExpr,$),Q=Y.initExpr?aZ(Y.initExpr,$):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
3318
3318
  (function() {
3319
3319
  var scopeEl = document.querySelector('${Y.selector}');
3320
3320
  if (!scopeEl) return;
@@ -3323,44 +3323,44 @@ window.__stx_reactive = (function() {
3323
3323
  })();`}).join(`
3324
3324
  `);return`
3325
3325
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
3326
- ${Hz()}
3326
+ ${Az()}
3327
3327
  ${Z}
3328
- </script>`}function nZ(X,$,Z){if(!Fz(X))return X;let Y=zz(X);if(Y.length===0)return X;let J=Oz(X,Y),G=Lz(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3329
- `+J.slice(Q);else J+=G;return J}function Oz(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function Fz(X){return/x-data\s*=\s*["']/.test(X)}var Uz=0,Kz=0;var rZ=E(()=>{w1()});import Vz from"fs";import _9 from"path";import{createHighlighter as Az}from"ts-syntax-highlighter";async function Rz(X,$={}){try{if(!await n(X))throw Error(`Markdown file not found: ${X}`);let Y=(await Vz.promises.stat(X)).mtime.getTime();if($.cache&&j9.has(X)){let K=j9.get(X);if(K.updatedAt>=Y)return{content:K.content,data:K.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=VX(J),w=$.markdown||D7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=s1(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await Mz(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:G||{}};if($.cache)j9.set(X,{...U,updatedAt:Y});return U}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function Mz(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!xX)try{xX=await Az({theme:$||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),X}let J=async(w,q,W,U)=>{let K=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=W||(Z?"text":"");if(!z)return w;try{if(!xX.getSupportedLanguages().includes(z))return w;return(await xX.highlight(K,z,{theme:$})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return w},G=X,Q=X.matchAll(Y);for(let w of Q){let[q,W,U,K]=w,z=await J(q,W,U,K);G=G.replace(q,z)}return G}async function sZ(X,$,Z="",Y={}){return await Tz(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let U=w;if(!_9.isAbsolute(w))U=_9.resolve(_9.dirname(Z),w);let K={};if(q)try{try{K=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);K[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:z,data:_}=await Rz(U,Y),B={...$,..._,...K},j=z,H=/\{\{([^}]+)\}\}/g;return j=j.replace(H,(O,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):O}),j}catch(U){let K=U instanceof Error?U.message:String(U);return z0("Markdown File",`Error including markdown file: ${K}`,Z,X,W,Q)}})}async function Tz(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((U)=>({match:w,replacement:U,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=X;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var j9,xX=null;var oZ=E(()=>{L1();T0();j9=new Map});function P1(X,$){try{let Z=X.trim();if(w0(Z))return q0(Z,Object.keys($))(...Object.values($));else return J0(Z,$)}catch{return!1}}var aZ=E(()=>{A0()});function H9(X){for(let[$,Z]of Object.entries(o))if(Z===X)return $;return}var o;var fX=E(()=>{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 f7(){return!1}function g7(){return!f7()||process.env.STX_DEBUG==="true"}function gX(){return!1}import Nz from"path";function hX(){return{...L9}}function uX(X){if(!L9.showRelativePaths||!X)return X;let $=L9.baseDir||process.cwd();try{let Z=Nz.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var kz,L9,dX,J5,mX;var lX=E(()=>{fX();kz={showRelativePaths:!1,enableAutoRecovery:g7(),logRecoveryWarnings:!0},L9={...kz};dX=class dX extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=uX(this.filePath)}};J5=class J5 extends dX{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};mX=class mX extends dX{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function eZ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:U,format:K="text"}=X,z=G,_=Q;if(!z&&w&&q!==void 0){let L=Sz(w,q);z=L.line,_=L.column}let B=J?uX(J):void 0,j=Y?H9(Y):void 0,H={type:$,code:Y,codeName:j,message:Z,filePath:B,line:z,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},O;switch(K){case"html":O=Ez(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=Dz(H,w,q);break;case"text":default:O=Iz(H,w,q);break}return{formatted:O,data:H}}function Iz(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
3330
- ${X.message}`),$&&X.line){let G=yz($,X.line,2);if(G)Y.push(`
3328
+ </script>`}function tZ(X,$,Z){if(!Tz(X))return X;let Y=Lz(X);if(Y.length===0)return X;let J=Mz(X,Y),G=Rz(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3329
+ `+J.slice(Q);else J+=G;return J}function Mz(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function Tz(X){return/x-data\s*=\s*["']/.test(X)}var jz=0,Hz=0;var eZ=E(()=>{K1()});import Nz from"fs";import A9 from"path";import{createHighlighter as kz}from"ts-syntax-highlighter";async function Iz(X,$={}){try{if(!await n(X))throw Error(`Markdown file not found: ${X}`);let Y=(await Nz.promises.stat(X)).mtime.getTime();if($.cache&&R9.has(X)){let K=R9.get(X);if(K.updatedAt>=Y)return{content:K.content,data:K.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=TX(J),w=$.markdown||C7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=$5(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await Ez(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:G||{}};if($.cache)R9.set(X,{...U,updatedAt:Y});return U}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function Ez(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!dX)try{dX=await kz({theme:$||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),X}let J=async(w,q,W,U)=>{let K=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=W||(Z?"text":"");if(!z)return w;try{if(!dX.getSupportedLanguages().includes(z))return w;return(await dX.highlight(K,z,{theme:$})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return w},G=X,Q=X.matchAll(Y);for(let w of Q){let[q,W,U,K]=w,z=await J(q,W,U,K);G=G.replace(q,z)}return G}async function XY(X,$,Z="",Y={}){return await Dz(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let U=w;if(!A9.isAbsolute(w))U=A9.resolve(A9.dirname(Z),w);let K={};if(q)try{try{K=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),M=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(M||T)R=R.substring(1,R.length-1);K[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:z,data:_}=await Iz(U,Y),B={...$,..._,...K},j=z,H=/\{\{([^}]+)\}\}/g;return j=j.replace(H,(O,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):O}),j}catch(U){let K=U instanceof Error?U.message:String(U);return _0("Markdown File",`Error including markdown file: ${K}`,Z,X,W,Q)}})}async function Dz(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((U)=>({match:w,replacement:U,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=X;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var R9,dX=null;var $Y=E(()=>{V1();L0();R9=new Map});function f1(X,$){try{let Z=X.trim();if(q0(Z))return W0(Z,Object.keys($))(...Object.values($));else return Q0(Z,$)}catch{return!1}}var ZY=E(()=>{T0()});function M9(X){for(let[$,Z]of Object.entries(o))if(Z===X)return $;return}var o;var mX=E(()=>{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 u7(){return!1}function d7(){return!u7()||process.env.STX_DEBUG==="true"}function lX(){return!1}import yz from"path";function cX(){return{...T9}}function pX(X){if(!T9.showRelativePaths||!X)return X;let $=T9.baseDir||process.cwd();try{let Z=yz.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var bz,T9,iX,W5,nX;var rX=E(()=>{mX();bz={showRelativePaths:!1,enableAutoRecovery:d7(),logRecoveryWarnings:!0},T9={...bz};iX=class iX extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=pX(this.filePath)}};W5=class W5 extends iX{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};nX=class nX extends iX{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function JY(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:U,format:K="text"}=X,z=G,_=Q;if(!z&&w&&q!==void 0){let L=fz(w,q);z=L.line,_=L.column}let B=J?pX(J):void 0,j=Y?M9(Y):void 0,H={type:$,code:Y,codeName:j,message:Z,filePath:B,line:z,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},O;switch(K){case"html":O=Cz(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=Pz(H,w,q);break;case"text":default:O=Sz(H,w,q);break}return{formatted:O,data:H}}function Sz(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
3330
+ ${X.message}`),$&&X.line){let G=vz($,X.line,2);if(G)Y.push(`
3331
3331
  ${G}`)}if(X.snippet)Y.push(`
3332
3332
  Snippet: ${X.snippet}`);if(X.suggestion)Y.push(`
3333
- Suggestion: ${X.suggestion}`);return Y.join(" ")}function Ez(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${tZ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${tZ(X.suggestion)}`;return Y+=" -->",Y}function Dz(X,$,Z){let W=[],U=X.code?` [${X.codeName||X.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let K=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(K+=`\x1B[90m:${X.line}\x1B[0m`,X.column)K+=`\x1B[90m:${X.column}\x1B[0m`}W.push(`
3333
+ Suggestion: ${X.suggestion}`);return Y.join(" ")}function Cz(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${YY(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${YY(X.suggestion)}`;return Y+=" -->",Y}function Pz(X,$,Z){let W=[],U=X.code?` [${X.codeName||X.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let K=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(K+=`\x1B[90m:${X.line}\x1B[0m`,X.column)K+=`\x1B[90m:${X.column}\x1B[0m`}W.push(`
3334
3334
  \x1B[90mat\x1B[0m ${K}`)}if(W.push(`
3335
3335
 
3336
- ${X.message}`),$&&X.line){let K=bz($,X.line,2);if(K)W.push(`
3336
+ ${X.message}`),$&&X.line){let K=xz($,X.line,2);if(K)W.push(`
3337
3337
 
3338
3338
  \x1B[90mContext:\x1B[0m
3339
3339
  ${K}`)}if(X.suggestion)W.push(`
3340
3340
 
3341
3341
  \x1B[33mSuggestion:\x1B[0m ${X.suggestion}`);return W.push(`
3342
- ${"\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 yz(X,$,Z){let Y=X.split(`
3342
+ ${"\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 vz(X,$,Z){let Y=X.split(`
3343
3343
  `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q=[];for(let w=J;w<=G;w++){let q=(w+1).toString().padStart(4),W=w===$-1?">":" ";Q.push(`${W}${q} | ${Y[w]}`)}return Q.join(`
3344
- `)}function bz(X,$,Z){let Y=X.split(`
3344
+ `)}function xz(X,$,Z){let Y=X.split(`
3345
3345
  `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",w="\x1B[31m",q="\x1B[0m",W=[];for(let U=J;U<=G;U++){let K=(U+1).toString().padStart(4),z=U===$-1,_=z?"\x1B[31m>\x1B[0m":" ",B=z?`\x1B[31m${Y[U]}\x1B[0m`:`\x1B[90m${Y[U]}\x1B[0m`;W.push(`${_}\x1B[90m${K}\x1B[0m | ${B}`)}return W.join(`
3346
- `)}function tZ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Sz(X,$){let Y=X.substring(0,$).split(`
3347
- `);return{line:Y.length,column:Y[Y.length-1].length}}function Z0(X,$,Z){return eZ({type:X,message:$,code:Z,format:"html"}).formatted}async function x5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var XY=E(()=>{fX();lX()});class F9{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
3346
+ `)}function YY(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function fz(X,$){let Y=X.substring(0,$).split(`
3347
+ `);return{line:Y.length,column:Y[Y.length-1].length}}function J0(X,$,Z){return JY({type:X,message:$,code:Z,format:"html"}).formatted}async function u5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var GY=E(()=>{mX();rX()});class k9{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
3348
3348
  `).slice(1).join(`
3349
3349
  `)}`);if(X.context)$.push(` Context: ${JSON.stringify(X.context)}`);return $.join(`
3350
3350
  `)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
3351
3351
  `;$.appendFileSync(this.logFilePath,J,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(X){try{if(!X.existsSync(this.logFilePath))return;if(X.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if(X.existsSync(Y))if(Z>=this.maxLogFiles-1)X.unlinkSync(Y);else X.renameSync(Y,J)}if(this.maxLogFiles<=1)X.writeFileSync(this.logFilePath,"");else X.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(X=10){return this.errors.slice(-X)}getErrorsByType(X){return this.errors.filter(($)=>$.error.constructor.name===X)}getErrorsByLevel(X){return this.errors.filter(($)=>$.level===X)}clear(){this.errors.length=0}async clearLogFile(){try{let X=await import("fs");if(X.existsSync(this.logFilePath))X.writeFileSync(this.logFilePath,"","utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",X)}}getStats(){let X={},$={error:0,warning:0,info:0};for(let Z of this.errors){let Y=Z.error.constructor.name;X[Y]=(X[Y]||0)+1;let J=Z.level||"error";$[J]=($[J]||0)+1}return{total:this.errors.length,byType:X,byLevel:$}}async exportToFile(X,$="json"){let Z=await import("fs"),J=(await import("path")).dirname(X);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});if($==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync(X,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync(X,G.join(`
3352
3352
 
3353
- `),"utf-8")}}async flush(){await this.writeQueue}}var O9,J1,V9;var $Y=E(()=>{lX();O9={isEnabled(){return hX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=hX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let K=0;K<U;K++)Z+=`
3354
- @end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(g7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};J1=new F9,V9={isDevelopment(){return g7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3355
- `)}}});var ZY=()=>{};var YY=E(()=>{fX();XY();$Y();ZY();lX()});var V1=E(()=>{YY()});function k0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,q=!1;while(G<X.length){let W=X[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===$)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}function v1(X,$){let Z=Cz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Cz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=k0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function Pz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function G5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec(X),W=w.exec(X),U=q?q.index:1/0,K=W?W.index:1/0;if(U<K)J++,G=U+q[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+W[0].length}else break}return-1}function JY(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=v1(X,Y);if(!J)return null;let G=J.endPos,Q=G5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U="if",K=J.expression,z=0,_=0;while(W<w.length){let B=w.indexOf("@",W);if(B===-1)break;W=B;let j=w.substring(B);if(Pz(w,B)){W++;continue}if(/^@if\s*\(/.test(j)){_++,W++;continue}if(/^@endif(?![a-z])/.test(j)){_--,W+=6;continue}if(_===0){let H=j.match(/^@elseif\s*/);if(H){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W});let O=W+H[0].length,L=v1(w,O);if(!L){W++;continue}U="elseif",K=L.expression,W=L.endPos,z=W;continue}else if(/^@else(?![a-z])/.test(j)){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W}),U="else",K=void 0,W+=5,z=W;continue}}W++}return q.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:q,start:$,end:Q+6}}function h7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=JY(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function cX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((j)=>G.index>j.start&&G.index<j.end)){G=J.exec(X);continue}let w=G.index,q=w+G[0].length-1,W=k0(X,"(",")",q);if(W===-1){G=J.exec(X);continue}let U=X.slice(q+1,W),K=W+1,z=G5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let _=X.slice(K,z),B=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,B),name:$,params:U,content:_,start:w,end:B}),J.lastIndex=B,G=J.exec(X)}return Y}function A9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=v1(X,Y);if(!J)return null;let G=J.endPos,Q=G5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U=null,K=0;while(W<w.length){let z=w.slice(W),_=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(_){if(K++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(K--,U)U.content+=B[0];W+=B[0].length;continue}if(K>0){if(U)U.content+=w[W];W++;continue}let j=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(j&&z.startsWith("@case")){if(U)q.push(U);let L=W+j[0].length,F=v1(w,L);if(!F){W++;continue}U={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&z.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=H[0].length}else if(O&&z.startsWith("@break"))W+=O[0].length;else{if(U)U.content+=w[W];W++}}if(U)q.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:q,start:$,end:Q+10}}var GY=()=>{};var QY=()=>{};var pX=E(()=>{GY();QY()});function gz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=A9(Y,Q);if(!w)break;try{let q;if(w0(w.expression))q=q0(w.expression,Object.keys($))(...Object.values($));else q=J0(w.expression,$);let W="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)W=K.content.trim()}else try{let z;if(K.value&&w0(K.value))z=q0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=J0(K.value,$);if(q===z){W=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=Z0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function hz(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function uz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function A1(X,$,Z){let{masked:Y,scripts:J}=hz(X);return uz(dz(Y,$,Z),J)}function dz(X,$,Z){let Y=X;Y=gz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=v1(Y,w+7);if(!q)break;let W=q.endPos,U=G5(Y,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(W,U),z=q.expression,_=-1;{let j=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")j++;else if(A.type==="close")j--;else if(A.type==="else"&&j===0){_=A.pos;break}}let B;if(_!==-1){let j=K.slice(0,_),H=K.slice(_+5);B=`@if (${z})${H}@else ${j}@endif`}else B=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+B+Y.substring(U+10),G=!0}}Y=M9(Y,$,Z),Y=T9(Y,$,Z),Y=R9(Y,$);let J=()=>{let G=h7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let U of w.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let K;if(U.condition&&w0(U.condition))K=q0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=J0(U.condition,$);if(K)q=U.content,W=!0}catch(K){q=Z0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=Z0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function wY(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function R9(X,$){let Z=X;function Y(w,q,W,U){let K=1,z=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(z<w.length&&K>0){_.lastIndex=z,B.lastIndex=z;let j=_.exec(w),H=B.exec(w),O=j?j.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+j[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,q,W){let U=0,K=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],j;while((j=K.exec(w))!==null)B.push({pos:j.index,type:"open"});while((j=z.exec(w))!==null)B.push({pos:j.index,type:"close"});while((j=_.exec(w))!==null)B.push({pos:j.index,type:"else"});B.sort((H,O)=>H.pos-O.pos);for(let H of B)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+5),_=wY(z);if(_)U=_.value,K=W+5+_.consumed;else K=W+5;let B=Y(Z,"auth","endauth",K);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let j=Z.slice(K,B),H=J(j,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?P1(`auth?.check && auth?.user?.[${U}]`,$):P1("auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(B+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+6),_=wY(z);if(_)U=_.value,K=W+6+_.consumed;else K=W+6;let B=Y(Z,"guest","endguest",K);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let j=Z.slice(K,B),H=J(j,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?P1(`!auth?.check || !auth?.user?.[${U}]`,$):P1("!auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(B+9),w=!0}}function G(w,q,W){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(q)U.push(q);if(W){let K=P1(W,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let q=w.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 w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,_=Z.slice(z+`@${w}`.length),B=Q(_);if(!B)break;let j=z+`@${w}`.length+B.paramsEnd,H=Y(Z,w,q,j);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let O=Z.slice(j,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],k;while((k=V.exec(O))!==null)T.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)T.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)T.push({pos:k.index,type:"elseDirective"});while((k=M.exec(O))!==null)T.push({pos:k.index,type:"else"});T.sort((y,v)=>y.pos-v.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)L.push(y)}let N=[],D=0;for(let y=0;y<L.length;y++){let v=L[y];if(N.push({content:O.slice(D,v.pos),ability:void 0}),v.type==="elseDirective"){let x=O.slice(v.pos+`@${W}`.length),g=Q(x);if(g){N[N.length-1]={content:O.slice(D,v.pos)},D=v.pos+`@${W}`.length+g.paramsEnd,N.push({content:"",ability:g.ability,type:g.type,id:g.id}),N.pop();let c=L[y+1],p=c?c.pos:O.length;N.push({content:O.slice(D,p),ability:g.ability,type:g.type,id:g.id}),D=p}}else D=v.pos+5}if(D<O.length){let y=N[N.length-1];if(L.length>0&&L[L.length-1].type==="else")N.push({content:O.slice(D),isFinalElse:!0});else if(N.length===0)N.push({content:O.slice(D)})}let I=G(B.ability,B.type,B.id),C=w==="can"?I:!I,b="";if(C)b=N[0]?.content||"";else{let y=!1;for(let v=1;v<N.length;v++){let x=N[v];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let g=G(x.ability,x.type,x.id);if(w==="can"?g:!g){b=x.content,y=!0;break}}}if(!y&&N.length>0){let v=N[N.length-1];if(v.isFinalElse)b=v.content}}Z=Z.substring(0,z)+b+Z.substring(H+`@${q}`.length),U=!0}}return Z}function M9(X,$,Z){let Y=X;function J(G,Q,w,q,W){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let _=z.index,B=v1(G,_+`@${Q}`.length);if(!B)break;let j=B.endPos,H=G5(G,Q,w,j);if(H===-1){console.warn(`[stx] @${Q} directive at position ${_} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(j,H),L=B.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(M)){F=R;break}A=R+1}try{let R=q(L.trim()),M;if(F!==-1){let T=O.slice(0,F),k=O.slice(F+5);M=R?T:k}else M=R?O:"";G=G.substring(0,_)+M+G.substring(H+`@${w}`.length),U=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=Z0(W,`Error processing @${Q} directive: ${M}`,o.EVALUATION_ERROR);G=G.substring(0,_)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=P1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=P1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function T9(X,$,Z){let Y=X,J="development";function G(Q,w,q,W){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=Q,j=!0;while(j){j=!1,U.lastIndex=0;let H=U.exec(B);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let I=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,W=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<B.length){U.lastIndex=V,K.lastIndex=V;let I=U.exec(B),C=K.exec(B),b=I?I.index:1/0,y=C?C.index:1/0;if(b<y)F++,V=b+I[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+C[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${q} \u2014 the block was skipped.`);break}let R=B.substring(L,A),M=-1,T=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){T++,k=I+1;continue}if(_.test(C)){T--,k=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){M=I;break}k=I+1}let N;if(M!==-1){let I=R.slice(0,M),C=R.slice(M+5);N=W?I:C}else N=W?R:"";let D=`@${q}`.length;B=B.substring(0,O)+N+B.substring(A+D),j=!0}return B}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var u7=E(()=>{aZ();V1();pX();A0()});function WY(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function iX(X,$){if(!X)return $?.nonceGenerator?.()??WY();let Z=qY.get(X);if(!Z)Z=$?.nonceGenerator?.()??WY(),qY.set(X,Z);return Z}function mz(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function UY(X,$){return`<meta http-equiv="Content-Security-Policy" content="${mz(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function KY(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?iX(Z,$):void 0,J=UY($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
3356
- ${J}`)}function zY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function BY(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?iX($,G):void 0;return UY(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return iX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=iX($,G);return J}var qY;var _Y=E(()=>{qY=new WeakMap});import lz from"crypto";function pz(X=cz){let $=lz.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return N9=$,$}function iz(){if(!N9)pz();return N9}function nz(X=jY){let $=iz();return`<input type="hidden" name="${X}" value="${$}">`}function HY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return nz(Y||jY)})}var cz=40,jY="_token",N9=null;var LY=()=>{};async function OY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await rz(J,G,$,Z,Y);else J=await sz(J,G,$,Z,Y)}return J}async function rz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,q=`@end${G}`,W=X,U=C5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),K=[],z=U.exec(W);while(z!==null){let[_,B="",j=""]=z,H=z.index||0;try{let O=B?FY(B):[],L=j.trim(),F=await Q(L,O,Z,Y);K.push({original:_,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:_,processed:Z0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=U.exec(W)}for(let _=K.length-1;_>=0;_--){let{original:B,processed:j}=K[_];W=W.replace(B,j)}return W}async function sz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,q=C5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(w);while(U!==null){let[_,B=""]=U,j=U.index||0;try{let H=FY(B),O=await Q("",H,Z,Y);W.push({original:_,processed:O,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:_,processed:Z0("CustomDirective",`Error in @${G}(${B}): ${O}`,o.EVALUATION_ERROR),startIndex:j})}U=q.exec(w)}let K=C5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[_]=z,B=z.index||0;try{let j=await Q("",[],Z,Y);W.push({original:_,processed:j,startIndex:B})}catch(j){let H=j instanceof Error?j.message:String(j);if(J.debug)console.error(`Error processing custom directive @${G}:`,j);W.push({original:_,processed:Z0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:B})}z=K.exec(w)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:j}=W[_];w=w.replace(B,j)}return w}function FY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var VY=E(()=>{V1();P5()});function Q5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function az(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Q5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Z.key,"appearance.key"),Q5(Z.attribute,"appearance.attribute"),Q5(Z.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!RY.test(Z.key)||!RY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!AY.test(Z.attribute)||!AY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!oz.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function tz(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ez(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${tz(X)};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 XB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function MY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=XB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=J0(`(${w})`,$),W=ez(az(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var AY,RY,oz;var TY=E(()=>{A0();AY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,RY=/^[A-Za-z_$][\w$]*$/,oz=new Set(["light","dark","system"])});var E9={};a(E9,{useTitle:()=>GB,useSeoMeta:()=>NY,usePageTitle:()=>GB,useHead:()=>I9,seoMetaToHeadConfig:()=>rX,resetHead:()=>YB,renderHtmlAttrs:()=>wB,renderHead:()=>QB,renderBodyAttrs:()=>qB,processTitleDirective:()=>KB,processMetaDirective:()=>zB,processHeadDirective:()=>UB,mergeHeadConfigs:()=>f5,getPageMeta:()=>ZB,getHead:()=>k9,definePageMeta:()=>JB,applyHead:()=>WB});function k9(){return x1}function ZB(){return nX}function YB(){x1={},$B.length=0,nX={}}function I9(X){x1=f5(x1,X)}function f5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function NY(X){I9(rX(X))}function rX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let q=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:q})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let q of X.articleTags)$.push({property:"article:tag",content:q});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function JB(X){if(nX={...nX,...X},X.title||X.description)NY({title:X.title,description:X.description})}function GB(X){let $=typeof X==="function"?X():X;I9({title:$})}function QB(X=x1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${w5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${w5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${w5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${w5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${w5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3357
- `)}function wB(X=x1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function qB(X=x1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function w5(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function WB(X=x1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function UB(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3358
- `,""}),headContent:$.trim()}}function KB(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(w,{title:Q}),""})}function zB(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,K=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(z,{meta:[K]}),""})}var x1,$B,nX;var d7=E(()=>{x1={},$B=[],nX={}});import BB from"crypto";function H0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function sX(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function s0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${H0($)}"`}function D9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${H0(`${s0(X)}-error`)}"`;return Y}function _B(){return BB.randomUUID()}function oX(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=_B();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${H0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${H0(G)}">`;return Y}),Z}function EY(X,$,Z=IY){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"POST",K=w||q||"",z=f1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",j=`<form method="${H0(B)}" action="${H0(K)}"${z?` ${z}`:""}>`;if(j+=`
3359
- ${oX("@csrf",$)}`,!["GET","POST"].includes(_))j+=`
3360
- ${oX(`@method('${_}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"",K=w||q||"",z=f1(W),_=m7(U,$),B=_!==void 0&&_!==null?_:K||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=l7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=sX(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(H)}" name="${H0(U)}"${g5(z,s0(U))} value="${H0(B)}" class="${F}"${D9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=f1(Q),W=m7(G,$)||w.trim(),U=l7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=sX(K?K[1]:"",Z.input,U,Z.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(G)}"${g5(q,s0(G))} class="${z}"${D9(G,U,q)}${_?` ${_}`:""}>${H0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=f1(Q),W=m7(G,$),U=l7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=sX(K?K[1]:"",Z.input,U,Z.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=w;if(W!==void 0)B=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${H0(G)}"${g5(q,s0(G))} class="${z}"${D9(G,U,q)}${_?` ${_}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?s0(G):`${s0(G)}-${s0(q)}`,U=f1(w),K=m7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===q):K===!0||String(K)===q),_=U.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Z.checkInput,j=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(G)}"${g5(U,W)} value="${H0(q)}" class="${B}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=f1(w),W=m7(G,$),U=W!==void 0&&W===Q,K=q.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(G)}"${g5(q,`${s0(G)}-${s0(Q)}`)} value="${H0(Q)}" class="${z}"${U?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=f1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=w.includes("multiple"),K=l7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),_=sX(z?z[1]:"",Z.input,K,Z.inputError),B=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${H0(G)}"${g5(w,s0(G))}`,`class="${_}"`];if(W)j.push(`accept="${H0(W)}"`);if(U)j.push("multiple");if(B)j.push(B);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=f1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Z.label,K=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(s0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function DY(X,$,Z=IY){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(l7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return kY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return kY(J,$)}let W=q.trim();if(w0(W)){let U=J0(W,$);return U!==void 0?String(U):W}return W}catch{return q}});return`<div id="${H0(`${s0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function l7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function kY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function m7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function f1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var IY;var yY=E(()=>{A0();IY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import S9 from"path";async function jB(){if(c7!==void 0)return c7;try{c7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{c7=null}return c7}function HB(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function LB(X,$){if({...v9,...$.i18n}.cache&&C9[X]){let J=C9[X],G=$.i18n?.cacheMaxAge??0;if(!HB(J,G))return J.translations}if(p7[X]?.state==="loading")return p7[X].promise;y9[X]="loading";let Y=P9(X,$).then((J)=>{return y9[X]="loaded",delete p7[X],J}).catch((J)=>{throw y9[X]="error",p7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return p7[X]={promise:Y,state:"loading"},Y}async function P9(X,$){let Z={...v9,...$.i18n},Y=S9.isAbsolute(Z.translationsDir)?Z.translationsDir:S9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await jB(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:RB(Z.format)}):await OB(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return P9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)C9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return P9(Z.defaultLocale,$);return{}}}async function OB(X,$,Z){let Y=S9.join(Z,`${X}${FB($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return VB(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function FB(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function VB(X){let $={},Z=X.split(`
3361
- `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,K=W.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=AB(z)}}return $}function AB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function RB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function MB(X,$){return LB(X,$)}function TB(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function NB(X,$={}){return CY(X,$)}function CY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=kB(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=IB(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function kB(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function IB(X,$){let Z=EB(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return DB(J,Z.slice(2).join(","),$);case"select":return bB(J,Z.slice(2).join(","));case"selectordinal":return SB(J,Z.slice(2).join(","));case"number":return PB(J,Z[2]?.trim());case"date":return vB(J,Z[2]?.trim());case"time":return xB(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function EB(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function DB(X,$,Z){let Y=Number(X)||0,J=x9($),G=`=${Y}`;if(J[G])return b9(J[G],Y,Z);let Q=yB(Y);if(J[Q])return b9(J[Q],Y,Z);if(J.other)return b9(J.other,Y,Z);return String(Y)}function b9(X,$,Z){let Y=X.replace(/#/g,String($));return CY(Y,Z)}function yB(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function bB(X,$){let Z=String(X||""),Y=x9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function SB(X,$){let Z=Number(X)||0,Y=x9($),J=CB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function CB(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function x9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function PB(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function vB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function xB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function fB(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function bY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(fB(Q))return NB(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=TB(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function PY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...v9,...Y.i18n},w=await MB(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await SY(J,G,async(U,K,z,_,B)=>{try{let j={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return V0(z,$)}];for(let L of O)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return bY(K,w,Q.fallbackToKey,j)||_.trim()}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return Z0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...J.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((K,z)=>console.warn(`Match ${z}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return J=await SY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,K,z,_)=>{try{let B={};if(z)try{let j=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return V0(z,$)}];for(let H of j)try{if(B=H(),Object.keys(B).length>0)break}catch{}}catch(j){if(Y.debug)console.error("Error parsing parameters for @translate directive:",j)}return bY(K,w,Q.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return Z0("Translate",`Error in @translate('${K}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),J}async function SY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var c7,v9,C9,p7,y9;var vY=E(()=>{V1();A0();v9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},C9={},p7={},y9={}});function hB(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return gB.test($)}function h5(X){i7.lastIndex=0;let $;while(($=i7.exec(X))!==null){if($[0].startsWith("</")||hB($[0]))continue;let Z=$.index,Y=i7.lastIndex,J=1,G;while((G=i7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:i7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var i7,gB;var aX=E(()=>{i7=/<\/?template\b[^>]*>/gi,gB=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var h9={};a(h9,{streamingSuspenseDirective:()=>gY,streamToResponse:()=>aB,streamTemplateSimple:()=>nB,streamTemplate:()=>dB,renderStreamingPage:()=>lB,registerStreamingDirectives:()=>sB,processStreamDirectives:()=>pB,processSectionDirectives:()=>oB,islandDirective:()=>hY,generateHydrationRuntime:()=>tB,extractStreamBoundaries:()=>iB,createStreamRenderer:()=>rB,buildSuspenseResolveScript:()=>g9,SUSPENSE_RESOLVER_RUNTIME:()=>fY});import tX from"path";function uB(X){let $=[],Z=0,Y;xY.lastIndex=0;while((Y=xY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function dB(X,$={},Z={}){let Y={...M1,...Z,streaming:{...f9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:tX.dirname(X)};if(q.trim())await R1(q,U,X);let K=uB(W),z=new Set;if(!K.some((B)=>B.type==="suspense")){let B=Y.streaming?.strategy||"auto",j=new RegExp(q5.source,"g");if(!(B!=="manual"&&j.test(W))){let O=await R0(W,U,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(q5.source,"g"),F;while((F=L.exec(W))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let M=W.slice(V,A.start);if(M.trim()){let T=await R0(M,U,X,Y,z);G.enqueue(T),await new Promise((k)=>setTimeout(k,0))}}let R=await R0(A.content,U,X,Y,z);G.enqueue(R),await new Promise((M)=>setTimeout(M,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await R0(A,U,X,Y,z);G.enqueue(R)}}}}else{let B=new Map;for(let H of K)if(H.type==="shell"||H.type==="content"){let O=await R0(H.content,U,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
3353
+ `),"utf-8")}}async flush(){await this.writeQueue}}var N9,Q1,I9;var QY=E(()=>{rX();N9={isEnabled(){return cX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=cX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let K=0;K<U;K++)Z+=`
3354
+ @end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(d7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};Q1=new k9,I9={isDevelopment(){return d7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3355
+ `)}}});var wY=()=>{};var qY=E(()=>{mX();GY();QY();wY();rX()});var M1=E(()=>{qY()});function y0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,q=!1;while(G<X.length){let W=X[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===$)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}function g1(X,$){let Z=gz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function gz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=y0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function hz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function U5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec(X),W=w.exec(X),U=q?q.index:1/0,K=W?W.index:1/0;if(U<K)J++,G=U+q[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+W[0].length}else break}return-1}function WY(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=g1(X,Y);if(!J)return null;let G=J.endPos,Q=U5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U="if",K=J.expression,z=0,_=0;while(W<w.length){let B=w.indexOf("@",W);if(B===-1)break;W=B;let j=w.substring(B);if(hz(w,B)){W++;continue}if(/^@if\s*\(/.test(j)){_++,W++;continue}if(/^@endif(?![a-z])/.test(j)){_--,W+=6;continue}if(_===0){let H=j.match(/^@elseif\s*/);if(H){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W});let O=W+H[0].length,L=g1(w,O);if(!L){W++;continue}U="elseif",K=L.expression,W=L.endPos,z=W;continue}else if(/^@else(?![a-z])/.test(j)){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W}),U="else",K=void 0,W+=5,z=W;continue}}W++}return q.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:q,start:$,end:Q+6}}function m7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=WY(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function sX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((j)=>G.index>j.start&&G.index<j.end)){G=J.exec(X);continue}let w=G.index,q=w+G[0].length-1,W=y0(X,"(",")",q);if(W===-1){G=J.exec(X);continue}let U=X.slice(q+1,W),K=W+1,z=U5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let _=X.slice(K,z),B=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,B),name:$,params:U,content:_,start:w,end:B}),J.lastIndex=B,G=J.exec(X)}return Y}function E9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=g1(X,Y);if(!J)return null;let G=J.endPos,Q=U5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U=null,K=0;while(W<w.length){let z=w.slice(W),_=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(_){if(K++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(K--,U)U.content+=B[0];W+=B[0].length;continue}if(K>0){if(U)U.content+=w[W];W++;continue}let j=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(j&&z.startsWith("@case")){if(U)q.push(U);let L=W+j[0].length,F=g1(w,L);if(!F){W++;continue}U={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&z.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=H[0].length}else if(O&&z.startsWith("@break"))W+=O[0].length;else{if(U)U.content+=w[W];W++}}if(U)q.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:q,start:$,end:Q+10}}var UY=()=>{};var KY=()=>{};var oX=E(()=>{UY();KY()});function lz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=E9(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys($))(...Object.values($));else q=Q0(w.expression,$);let W="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)W=K.content.trim()}else try{let z;if(K.value&&q0(K.value))z=W0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=Q0(K.value,$);if(q===z){W=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=J0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function cz(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function pz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function T1(X,$,Z){let{masked:Y,scripts:J}=cz(X);return pz(iz(Y,$,Z),J)}function iz(X,$,Z){let Y=X;Y=lz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=g1(Y,w+7);if(!q)break;let W=q.endPos,U=U5(Y,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(W,U),z=q.expression,_=-1;{let j=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")j++;else if(A.type==="close")j--;else if(A.type==="else"&&j===0){_=A.pos;break}}let B;if(_!==-1){let j=K.slice(0,_),H=K.slice(_+5);B=`@if (${z})${H}@else ${j}@endif`}else B=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+B+Y.substring(U+10),G=!0}}Y=y9(Y,$,Z),Y=b9(Y,$,Z),Y=D9(Y,$);let J=()=>{let G=m7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let U of w.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let K;if(U.condition&&q0(U.condition))K=W0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=Q0(U.condition,$);if(K)q=U.content,W=!0}catch(K){q=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=J0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function zY(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function D9(X,$){let Z=X;function Y(w,q,W,U){let K=1,z=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(z<w.length&&K>0){_.lastIndex=z,B.lastIndex=z;let j=_.exec(w),H=B.exec(w),O=j?j.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+j[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,q,W){let U=0,K=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],j;while((j=K.exec(w))!==null)B.push({pos:j.index,type:"open"});while((j=z.exec(w))!==null)B.push({pos:j.index,type:"close"});while((j=_.exec(w))!==null)B.push({pos:j.index,type:"else"});B.sort((H,O)=>H.pos-O.pos);for(let H of B)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+5),_=zY(z);if(_)U=_.value,K=W+5+_.consumed;else K=W+5;let B=Y(Z,"auth","endauth",K);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let j=Z.slice(K,B),H=J(j,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?f1(`auth?.check && auth?.user?.[${U}]`,$):f1("auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(B+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+6),_=zY(z);if(_)U=_.value,K=W+6+_.consumed;else K=W+6;let B=Y(Z,"guest","endguest",K);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let j=Z.slice(K,B),H=J(j,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?f1(`!auth?.check || !auth?.user?.[${U}]`,$):f1("!auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(B+9),w=!0}}function G(w,q,W){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(q)U.push(q);if(W){let K=f1(W,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let q=w.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 w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,_=Z.slice(z+`@${w}`.length),B=Q(_);if(!B)break;let j=z+`@${w}`.length+B.paramsEnd,H=Y(Z,w,q,j);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let O=Z.slice(j,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),M=/@else(?![a-z])/g,T=[],N;while((N=V.exec(O))!==null)T.push({pos:N.index,type:"open"});while((N=A.exec(O))!==null)T.push({pos:N.index,type:"close"});while((N=R.exec(O))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=M.exec(O))!==null)T.push({pos:N.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)L.push(y)}let k=[],D=0;for(let y=0;y<L.length;y++){let P=L[y];if(k.push({content:O.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${W}`.length),f=Q(x);if(f){k[k.length-1]={content:O.slice(D,P.pos)},D=P.pos+`@${W}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let i=L[y+1],c=i?i.pos:O.length;k.push({content:O.slice(D,c),ability:f.ability,type:f.type,id:f.id}),D=c}}else D=P.pos+5}if(D<O.length){let y=k[k.length-1];if(L.length>0&&L[L.length-1].type==="else")k.push({content:O.slice(D),isFinalElse:!0});else if(k.length===0)k.push({content:O.slice(D)})}let I=G(B.ability,B.type,B.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let y=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,y=!0;break}}}if(!y&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,z)+b+Z.substring(H+`@${q}`.length),U=!0}}return Z}function y9(X,$,Z){let Y=X;function J(G,Q,w,q,W){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let _=z.index,B=g1(G,_+`@${Q}`.length);if(!B)break;let j=B.endPos,H=U5(G,Q,w,j);if(H===-1){console.warn(`[stx] @${Q} directive at position ${_} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(j,H),L=B.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let M=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(M)){F=R;break}A=R+1}try{let R=q(L.trim()),M;if(F!==-1){let T=O.slice(0,F),N=O.slice(F+5);M=R?T:N}else M=R?O:"";G=G.substring(0,_)+M+G.substring(H+`@${w}`.length),U=!0}catch(R){let M=R instanceof Error?R.message:String(R),T=J0(W,`Error processing @${Q} directive: ${M}`,o.EVALUATION_ERROR);G=G.substring(0,_)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=f1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=f1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function b9(X,$,Z){let Y=X,J="development";function G(Q,w,q,W){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=Q,j=!0;while(j){j=!1,U.lastIndex=0;let H=U.exec(B);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let I=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,W=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<B.length){U.lastIndex=V,K.lastIndex=V;let I=U.exec(B),S=K.exec(B),b=I?I.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+I[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${q} \u2014 the block was skipped.`);break}let R=B.substring(L,A),M=-1,T=0,N=0;while(N<R.length){let I=R.indexOf("@",N);if(I===-1)break;let S=R.substring(I);if(z.test(S)){T++,N=I+1;continue}if(_.test(S)){T--,N=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){M=I;break}N=I+1}let k;if(M!==-1){let I=R.slice(0,M),S=R.slice(M+5);k=W?I:S}else k=W?R:"";let D=`@${q}`.length;B=B.substring(0,O)+k+B.substring(A+D),j=!0}return B}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var l7=E(()=>{ZY();M1();oX();T0()});function _Y(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function aX(X,$){if(!X)return $?.nonceGenerator?.()??_Y();let Z=BY.get(X);if(!Z)Z=$?.nonceGenerator?.()??_Y(),BY.set(X,Z);return Z}function nz(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function jY(X,$){return`<meta http-equiv="Content-Security-Policy" content="${nz(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function HY(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?aX(Z,$):void 0,J=jY($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
3356
+ ${J}`)}function LY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function OY(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?aX($,G):void 0;return jY(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return aX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=aX($,G);return J}var BY;var FY=E(()=>{BY=new WeakMap});import rz from"crypto";function oz(X=sz){let $=rz.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return S9=$,$}function az(){if(!S9)oz();return S9}function tz(X=VY){let $=az();return`<input type="hidden" name="${X}" value="${$}">`}function AY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return tz(Y||VY)})}var sz=40,VY="_token",S9=null;var RY=()=>{};async function MY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await ez(J,G,$,Z,Y);else J=await XB(J,G,$,Z,Y)}return J}async function ez(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,q=`@end${G}`,W=X,U=f5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),K=[],z=U.exec(W);while(z!==null){let[_,B="",j=""]=z,H=z.index||0;try{let O=B?TY(B):[],L=j.trim(),F=await Q(L,O,Z,Y);K.push({original:_,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:_,processed:J0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=U.exec(W)}for(let _=K.length-1;_>=0;_--){let{original:B,processed:j}=K[_];W=W.replace(B,j)}return W}async function XB(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,q=f5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(w);while(U!==null){let[_,B=""]=U,j=U.index||0;try{let H=TY(B),O=await Q("",H,Z,Y);W.push({original:_,processed:O,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:_,processed:J0("CustomDirective",`Error in @${G}(${B}): ${O}`,o.EVALUATION_ERROR),startIndex:j})}U=q.exec(w)}let K=f5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[_]=z,B=z.index||0;try{let j=await Q("",[],Z,Y);W.push({original:_,processed:j,startIndex:B})}catch(j){let H=j instanceof Error?j.message:String(j);if(J.debug)console.error(`Error processing custom directive @${G}:`,j);W.push({original:_,processed:J0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:B})}z=K.exec(w)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:j}=W[_];w=w.replace(B,j)}return w}function TY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var NY=E(()=>{M1();g5()});function K5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function ZB(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(K5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(K5(Z.key,"appearance.key"),K5(Z.attribute,"appearance.attribute"),K5(Z.default,"appearance.default"),K5(Y.key,"colorMode.key"),K5(Y.attribute,"colorMode.attribute"),K5(Y.default,"colorMode.default"),!IY.test(Z.key)||!IY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kY.test(Z.attribute)||!kY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!$B.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function YB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function JB(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YB(X)};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 GB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function EY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=GB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=Q0(`(${w})`,$),W=JB(ZB(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var kY,IY,$B;var DY=E(()=>{T0();kY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,IY=/^[A-Za-z_$][\w$]*$/,$B=new Set(["light","dark","system"])});var v9={};e(v9,{useTitle:()=>UB,useSeoMeta:()=>yY,usePageTitle:()=>UB,useHead:()=>P9,seoMetaToHeadConfig:()=>eX,resetHead:()=>qB,renderHtmlAttrs:()=>zB,renderHead:()=>KB,renderBodyAttrs:()=>BB,processTitleDirective:()=>HB,processMetaDirective:()=>LB,processHeadDirective:()=>jB,mergeHeadConfigs:()=>d5,getPageMeta:()=>wB,getHead:()=>C9,definePageMeta:()=>WB,applyHead:()=>_B});function C9(){return h1}function wB(){return tX}function qB(){h1={},QB.length=0,tX={}}function P9(X){h1=d5(h1,X)}function d5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function yY(X){P9(eX(X))}function eX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let q=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:q})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let q of X.articleTags)$.push({property:"article:tag",content:q});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function WB(X){if(tX={...tX,...X},X.title||X.description)yY({title:X.title,description:X.description})}function UB(X){let $=typeof X==="function"?X():X;P9({title:$})}function KB(X=h1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${z5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${z5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${z5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${z5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${z5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3357
+ `)}function zB(X=h1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${z5(Z)}"`).join(" ")}function BB(X=h1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${z5(Z)}"`).join(" ")}function z5(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function _B(X=h1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function jB(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3358
+ `,""}),headContent:$.trim()}}function HB(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=d5(w,{title:Q}),""})}function LB(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,K=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=d5(z,{meta:[K]}),""})}var h1,QB,tX;var c7=E(()=>{h1={},QB=[],tX={}});import OB from"crypto";function F0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function X8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function a0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${F0($)}"`}function x9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${F0(`${a0(X)}-error`)}"`;return Y}function FB(){return OB.randomUUID()}function $8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=FB();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${F0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${F0(G)}">`;return Y}),Z}function CY(X,$,Z=SY){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"POST",K=w||q||"",z=u1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",j=`<form method="${F0(B)}" action="${F0(K)}"${z?` ${z}`:""}>`;if(j+=`
3359
+ ${$8("@csrf",$)}`,!["GET","POST"].includes(_))j+=`
3360
+ ${$8(`@method('${_}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"",K=w||q||"",z=u1(W),_=p7(U,$),B=_!==void 0&&_!==null?_:K||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=i7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=X8(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${F0(H)}" name="${F0(U)}"${m5(z,a0(U))} value="${F0(B)}" class="${F}"${x9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=u1(Q),W=p7(G,$)||w.trim(),U=i7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=X8(K?K[1]:"",Z.input,U,Z.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${F0(G)}"${m5(q,a0(G))} class="${z}"${x9(G,U,q)}${_?` ${_}`:""}>${F0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=u1(Q),W=p7(G,$),U=i7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=X8(K?K[1]:"",Z.input,U,Z.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=w;if(W!==void 0)B=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${F0(G)}"${m5(q,a0(G))} class="${z}"${x9(G,U,q)}${_?` ${_}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?a0(G):`${a0(G)}-${a0(q)}`,U=u1(w),K=p7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===q):K===!0||String(K)===q),_=U.match(/class=['"]([^'"]+)['"]/i),B=_?_[1]:Z.checkInput,j=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${F0(G)}"${m5(U,W)} value="${F0(q)}" class="${B}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=u1(w),W=p7(G,$),U=W!==void 0&&W===Q,K=q.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${F0(G)}"${m5(q,`${a0(G)}-${a0(Q)}`)} value="${F0(Q)}" class="${z}"${U?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=u1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=w.includes("multiple"),K=i7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),_=X8(z?z[1]:"",Z.input,K,Z.inputError),B=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${F0(G)}"${m5(w,a0(G))}`,`class="${_}"`];if(W)j.push(`accept="${F0(W)}"`);if(U)j.push("multiple");if(B)j.push(B);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=u1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Z.label,K=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${F0(a0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function PY(X,$,Z=SY){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(i7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return bY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return bY(J,$)}let W=q.trim();if(q0(W)){let U=Q0(W,$);return U!==void 0?String(U):W}return W}catch{return q}});return`<div id="${F0(`${a0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function i7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function bY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function p7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function u1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var SY;var vY=E(()=>{T0();SY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h9 from"path";async function VB(){if(n7!==void 0)return n7;try{n7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{n7=null}return n7}function AB(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function RB(X,$){if({...m9,...$.i18n}.cache&&u9[X]){let J=u9[X],G=$.i18n?.cacheMaxAge??0;if(!AB(J,G))return J.translations}if(r7[X]?.state==="loading")return r7[X].promise;f9[X]="loading";let Y=d9(X,$).then((J)=>{return f9[X]="loaded",delete r7[X],J}).catch((J)=>{throw f9[X]="error",r7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return r7[X]={promise:Y,state:"loading"},Y}async function d9(X,$){let Z={...m9,...$.i18n},Y=h9.isAbsolute(Z.translationsDir)?Z.translationsDir:h9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await VB(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:IB(Z.format)}):await MB(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return d9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)u9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return d9(Z.defaultLocale,$);return{}}}async function MB(X,$,Z){let Y=h9.join(Z,`${X}${TB($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return NB(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function TB(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function NB(X){let $={},Z=X.split(`
3361
+ `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,K=W.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=kB(z)}}return $}function kB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function IB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function EB(X,$){return RB(X,$)}function DB(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function yB(X,$={}){return gY(X,$)}function gY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=bB(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=SB(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function bB(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function SB(X,$){let Z=CB(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return PB(J,Z.slice(2).join(","),$);case"select":return xB(J,Z.slice(2).join(","));case"selectordinal":return fB(J,Z.slice(2).join(","));case"number":return hB(J,Z[2]?.trim());case"date":return uB(J,Z[2]?.trim());case"time":return dB(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function CB(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function PB(X,$,Z){let Y=Number(X)||0,J=l9($),G=`=${Y}`;if(J[G])return g9(J[G],Y,Z);let Q=vB(Y);if(J[Q])return g9(J[Q],Y,Z);if(J.other)return g9(J.other,Y,Z);return String(Y)}function g9(X,$,Z){let Y=X.replace(/#/g,String($));return gY(Y,Z)}function vB(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function xB(X,$){let Z=String(X||""),Y=l9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function fB(X,$){let Z=Number(X)||0,Y=l9($),J=gB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function gB(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function l9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function hB(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function uB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function dB(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function mB(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function xY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(mB(Q))return yB(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=DB(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function hY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...m9,...Y.i18n},w=await EB(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await fY(J,G,async(U,K,z,_,B)=>{try{let j={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return M0(z,$)}];for(let L of O)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return xY(K,w,Q.fallbackToKey,j)||_.trim()}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return J0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...J.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((K,z)=>console.warn(`Match ${z}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return J=await fY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,K,z,_)=>{try{let B={};if(z)try{let j=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return M0(z,$)}];for(let H of j)try{if(B=H(),Object.keys(B).length>0)break}catch{}}catch(j){if(Y.debug)console.error("Error parsing parameters for @translate directive:",j)}return xY(K,w,Q.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${K}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),J}async function fY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var n7,m9,u9,r7,f9;var uY=E(()=>{M1();T0();m9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},u9={},r7={},f9={}});function cB(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return lB.test($)}function l5(X){s7.lastIndex=0;let $;while(($=s7.exec(X))!==null){if($[0].startsWith("</")||cB($[0]))continue;let Z=$.index,Y=s7.lastIndex,J=1,G;while((G=s7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:s7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var s7,lB;var Z8=E(()=>{s7=/<\/?template\b[^>]*>/gi,lB=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var i9={};e(i9,{streamingSuspenseDirective:()=>lY,streamToResponse:()=>Z_,streamTemplateSimple:()=>tB,streamTemplate:()=>iB,renderStreamingPage:()=>rB,registerStreamingDirectives:()=>X_,processStreamDirectives:()=>oB,processSectionDirectives:()=>$_,islandDirective:()=>cY,generateHydrationRuntime:()=>Y_,extractStreamBoundaries:()=>aB,createStreamRenderer:()=>eB,buildSuspenseResolveScript:()=>p9,SUSPENSE_RESOLVER_RUNTIME:()=>mY});import Y8 from"path";function pB(X){let $=[],Z=0,Y;dY.lastIndex=0;while((Y=dY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function iB(X,$={},Z={}){let Y={...k1,...Z,streaming:{...c9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:Y8.dirname(X)};if(q.trim())await N1(q,U,X);let K=pB(W),z=new Set;if(!K.some((B)=>B.type==="suspense")){let B=Y.streaming?.strategy||"auto",j=new RegExp(B5.source,"g");if(!(B!=="manual"&&j.test(W))){let O=await N0(W,U,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(B5.source,"g"),F;while((F=L.exec(W))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let M=W.slice(V,A.start);if(M.trim()){let T=await N0(M,U,X,Y,z);G.enqueue(T),await new Promise((N)=>setTimeout(N,0))}}let R=await N0(A.content,U,X,Y,z);G.enqueue(R),await new Promise((M)=>setTimeout(M,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await N0(A,U,X,Y,z);G.enqueue(R)}}}}else{let B=new Map;for(let H of K)if(H.type==="shell"||H.type==="content"){let O=await N0(H.content,U,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
3362
3362
  <template data-suspense-fallback>Loading...</template>
3363
- </div>`),B.set(H.name,R0(H.content,U,X,Y,z))}G.enqueue(`
3363
+ </div>`),B.set(H.name,N0(H.content,U,X,Y,z))}G.enqueue(`
3364
3364
  <script>
3365
3365
  (function() {
3366
3366
  window.__stxSuspense = window.__stxSuspense || {
@@ -3376,13 +3376,13 @@ ${J}`)}function zY(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
3376
3376
  }
3377
3377
  };
3378
3378
  })();
3379
- </script>`);let j=Array.from(B.entries()).map(async([H,O])=>{G.enqueue(await g9(H,O))});await Promise.all(j)}G.close()}catch(Q){G.error(Q)}}})}async function g9(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3379
+ </script>`);let j=Array.from(B.entries()).map(async([H,O])=>{G.enqueue(await p9(H,O))});await Promise.all(j)}G.close()}catch(Q){G.error(Q)}}})}async function p9(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3380
3380
  <script>
3381
3381
  window.__stxSuspense.resolve('${X}', \`${Y}\`);
3382
3382
  </script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
3383
3383
  <script>
3384
- window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${$1(Y)}</div>');
3385
- </script>`}}function mB(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function lB(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(fY),await Promise.all($.map(async(G)=>{let Q=mB(G.render(),Y,G.id);J.enqueue(await g9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function pB(X,$){return X.replace(cB,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function iB(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function nB(X,$={},Z={}){let Y={...M1,...Z,streaming:{...f9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:tX.dirname(X)};if(q.trim())await R1(q,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",_=new RegExp(q5.source,"g");if(!(z!=="manual"&&_.test(W))){let j=await R0(W,U,X,Y,K);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(q5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await R0(A,U,X,Y,K);G.enqueue(R)}}let V=await R0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await R0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function rB(X,$={}){let Z={...M1,...$,streaming:{...f9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let z=W[1],_=W[2];q[z]=_}let U=Q.replace(q5,"");return{renderShell:async(z={})=>{let _={...z,__filename:X,__dirname:tX.dirname(X)};return await R1(G,_,X),R0(U,_,X,Z,new Set)},renderSection:async(z,_={})=>{try{if(!q[z])return`<div class="error-message">Section "${$1(z)}" not found in template "${$1(X)}"</div>`;let B={..._,__filename:X,__dirname:tX.dirname(X)};await R1(G,B,X);let j=new Set;return await R0(q[z],B,X,Z,j)}catch(B){let j=B instanceof Error?B.message:String(B);return z0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function sB(X={}){let $=[];if(X.streaming?.enabled)$.push(gY);if(X.hydration?.enabled)$.push(hY);return $}async function oB(X,$,Z,Y={}){return X}function aB(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function tB(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3384
+ window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${Y1(Y)}</div>');
3385
+ </script>`}}function nB(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function rB(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(mY),await Promise.all($.map(async(G)=>{let Q=nB(G.render(),Y,G.id);J.enqueue(await p9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function oB(X,$){return X.replace(sB,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function aB(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function tB(X,$={},Z={}){let Y={...k1,...Z,streaming:{...c9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:Y8.dirname(X)};if(q.trim())await N1(q,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",_=new RegExp(B5.source,"g");if(!(z!=="manual"&&_.test(W))){let j=await N0(W,U,X,Y,K);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(B5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await N0(A,U,X,Y,K);G.enqueue(R)}}let V=await N0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await N0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function eB(X,$={}){let Z={...k1,...$,streaming:{...c9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;B5.lastIndex=0;while((W=B5.exec(Q))!==null){let z=W[1],_=W[2];q[z]=_}let U=Q.replace(B5,"");return{renderShell:async(z={})=>{let _={...z,__filename:X,__dirname:Y8.dirname(X)};return await N1(G,_,X),N0(U,_,X,Z,new Set)},renderSection:async(z,_={})=>{try{if(!q[z])return`<div class="error-message">Section "${Y1(z)}" not found in template "${Y1(X)}"</div>`;let B={..._,__filename:X,__dirname:Y8.dirname(X)};await N1(G,B,X);let j=new Set;return await N0(q[z],B,X,Z,j)}catch(B){let j=B instanceof Error?B.message:String(B);return _0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function X_(X={}){let $=[];if(X.streaming?.enabled)$.push(lY);if(X.hydration?.enabled)$.push(cY);return $}async function $_(X,$,Z,Y={}){return X}function Z_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function Y_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3386
3386
  `);if($==="loader")return`
3387
3387
  (function() {
3388
3388
  window.__stx = window.__stx || {};
@@ -3524,7 +3524,7 @@ else {
3524
3524
  else {
3525
3525
  stx.hydrate();
3526
3526
  }
3527
- })();`}var f9,q5,xY,fY=`
3527
+ })();`}var c9,B5,dY,mY=`
3528
3528
  <script>
3529
3529
  (function(){
3530
3530
  window.__stxSuspense = window.__stxSuspense || {
@@ -3544,25 +3544,25 @@ else {
3544
3544
  }
3545
3545
  };
3546
3546
  })();
3547
- </script>`,cB,gY,hY;var u9=E(()=>{L1();w1();eX();T0();f9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,xY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;cB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;gY={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},hY={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,w=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?X.replace(w[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
3547
+ </script>`,sB,lY,cY;var n9=E(()=>{V1();K1();J8();L0();c9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},B5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,dY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;sB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;lY={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},cY={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,w=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?X.replace(w[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
3548
3548
  ${W}
3549
3549
  <script type="application/json" data-island-props="${Q}">
3550
3550
  ${q?`{${q}}`:"{}"}
3551
3551
  </script>
3552
- </div>`}}});var mY={};a(mY,{warnUnbalancedTags:()=>d9,findUnbalancedTags:()=>dY});function u5(X){return X.replace(/[^\n]/g," ")}function dY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,u5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,u5).replace(/<!--[\s\S]*?-->/g,u5).replace(/\{\{\{[\s\S]*?\}\}\}/g,u5).replace(/\{\{[\s\S]*?\}\}/g,u5).replace(/\{!![\s\S]*?!!\}/g,u5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(eB.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let U=Z.get(q);if(U)U.count++;else{let K=$.slice(0,G.index).split(`
3553
- `).length;Z.set(q,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(X_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function d9(X,$){let Z;try{Z=dY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(uY.has(Y))return;uY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var eB,X_,uY;var m9=E(()=>{eB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),X_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);uY=new Set});import o0 from"path";import l9 from"fs";function lY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function cY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class pY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let _=[J,J.toLowerCase(),lY(J),cY(J)];for(let B of _)if(G.has(B))return G.get(B)}let Q=[...new Set([`${J}.stx`,`${lY(J)}.stx`,`${cY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let _=o0.resolve(o0.dirname($),`${J}.stx`);if(await n(_))return _;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(o0.join(o0.dirname(W),"components"));if(q)w.push(q);let U=o0.join(o0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[o0.resolve(K,"src/components"),o0.resolve(K,"components"),o0.resolve(import.meta.dir,"components")];for(let _ of z)if(!w.includes(_))w.push(_);for(let _ of w){if(!_)continue;for(let B of Q){let j=o0.join(_,B);if(await n(j))return j}try{if(!l9.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let j=l9.readdirSync(_,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=o0.join(_,H.name);for(let L of Q){let F=o0.join(O,L);if(await n(F))return F}}}catch{}}return null}}var h0;var c9=E(()=>{T0();h0=new pY});function F0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p9(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(F0(G));continue}if(J===W5){Z.push(F0(G));continue}Z.push(`${F0(G)}="${F0(p9(String(J)))}"`)}return Z}function m5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.serverDynamic??{})){if($.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let G=X.serverDynamicNames?.[Y]??Y;if(J===!0){Z.push(F0(G));continue}if(typeof J==="object")continue;Z.push(`${F0(G)}="${F0(p9(String(J)))}"`)}return Z}var X8=()=>{};function n7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var i9;var n9=E(()=>{X8();i9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=$_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${n7(Y.value)}"`);else q.push(`href="${n7(Y.value)}"`);if(J)q.push(`class="${n7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${n7(G)}"`),q.push(`data-stx-exact-active-class="${n7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...d5(X,W)),q.push(...m5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function s9(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function iY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=Z_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function o9(X,$,Z,Y){return $.map((J)=>`${r7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function Y_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${r7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function r7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function J_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var Z_,r9,a9;var t9=E(()=>{X8();Z_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},r9=[320,640,768,1024,1280,1536,1920];a9={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=C0(X,"src")||"",J=C0(X,"alt")||"",G=C0(X,"width"),Q=C0(X,"height"),w=C0(X,"sizes"),q=C0(X,"srcset"),W=C0(X,"densities"),U=C0(X,"format"),K=C0(X,"placeholder"),z=C0(X,"placeholderColor")||"#e5e7eb",_=C0(X,"provider"),B=C0(X,"class")||C0(X,"className")||"",j=C0(X,"style")||"",H=C0(X,"quality"),O=s9(X,"lazy",!0),L=s9(X,"preload",!1),F=s9(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",M="";if(!R&&w)R=o9(Y,r9,_,U),M=iY(w);else if(!R&&W){let b=W.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=Y_(Y,b,V,_,U)}else if(w)M=iY(w);let T=[];if(j)T.push(j);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let b=J_(V||16,A||9,z);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")T.push(`background-image:url(${I0(K)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let k=r7(Y,V,A,_,U),N=[];if(N.push(`src="${I0(k)}"`),N.push(`alt="${I0(J)}"`),G)N.push(`width="${I0(G)}"`);if(Q)N.push(`height="${I0(Q)}"`);if(O)N.push('loading="lazy"');if(N.push('decoding="async"'),B)N.push(`class="${I0(B)}"`);if(T.length>0)N.push(`style="${I0(T.join(";"))}"`);if(R)N.push(`srcset="${I0(R)}"`);if(M)N.push(`sizes="${I0(M)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);N.push(...d5(X,D)),N.push(...m5(X,D));let I=`<img ${N.join(" ")} />`,C="";if(L){let y=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${y?` type="${y}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${M?` imagesizes="${I0(M)}"`:""} />
3554
- `}if(F){let b=[];if(U==="avif"||U==="auto"){let y=r7(Y,V,A,_,"avif"),v=R?o9(Y,r9,_,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${I0(v)}"${M?` sizes="${I0(M)}"`:""} />`)}if(U==="webp"||U==="auto"){let y=r7(Y,V,A,_,"webp"),v=R?o9(Y,r9,_,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${I0(v)}"${M?` sizes="${I0(M)}"`:""} />`)}return`${C}<picture>
3552
+ </div>`}}});var nY={};e(nY,{warnUnbalancedTags:()=>r9,findUnbalancedTags:()=>iY});function c5(X){return X.replace(/[^\n]/g," ")}function iY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,c5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,c5).replace(/<!--[\s\S]*?-->/g,c5).replace(/\{\{\{[\s\S]*?\}\}\}/g,c5).replace(/\{\{[\s\S]*?\}\}/g,c5).replace(/\{!![\s\S]*?!!\}/g,c5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(J_.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let U=Z.get(q);if(U)U.count++;else{let K=$.slice(0,G.index).split(`
3553
+ `).length;Z.set(q,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(G_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function r9(X,$){let Z;try{Z=iY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(pY.has(Y))return;pY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var J_,G_,pY;var s9=E(()=>{J_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),G_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);pY=new Set});import t0 from"path";import o9 from"fs";function rY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function sY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class oY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let _=[J,J.toLowerCase(),rY(J),sY(J)];for(let B of _)if(G.has(B))return G.get(B)}let Q=[...new Set([`${J}.stx`,`${rY(J)}.stx`,`${sY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let _=t0.resolve(t0.dirname($),`${J}.stx`);if(await n(_))return _;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(t0.join(t0.dirname(W),"components"));if(q)w.push(q);let U=t0.join(t0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[t0.resolve(K,"src/components"),t0.resolve(K,"components"),t0.resolve(import.meta.dir,"components")];for(let _ of z)if(!w.includes(_))w.push(_);for(let _ of w){if(!_)continue;for(let B of Q){let j=t0.join(_,B);if(await n(j))return j}try{if(!o9.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let j=o9.readdirSync(_,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=t0.join(_,H.name);for(let L of Q){let F=t0.join(O,L);if(await n(F))return F}}}catch{}}return null}}var c0;var a9=E(()=>{L0();c0=new oY});function V0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t9(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var _5="\x00stx-boolean-attribute";function p5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(V0(G));continue}if(J===_5){Z.push(V0(G));continue}Z.push(`${V0(G)}="${V0(t9(String(J)))}"`)}return Z}function i5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.serverDynamic??{})){if($.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let G=X.serverDynamicNames?.[Y]??Y;if(J===!0){Z.push(V0(G));continue}if(typeof J==="object")continue;Z.push(`${V0(G)}="${V0(t9(String(J)))}"`)}return Z}var G8=()=>{};function o7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Q_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var e9;var X4=E(()=>{G8();e9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=Q_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${o7(Y.value)}"`);else q.push(`href="${o7(Y.value)}"`);if(J)q.push(`class="${o7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${o7(G)}"`),q.push(`data-stx-exact-active-class="${o7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...p5(X,W)),q.push(...i5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function b0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function v0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Z4(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function aY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=w_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function Y4(X,$,Z,Y){return $.map((J)=>`${a7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function q_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${a7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function a7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function W_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var w_,$4,J4;var G4=E(()=>{G8();w_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$4=[320,640,768,1024,1280,1536,1920];J4={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=v0(X,"src")||"",J=v0(X,"alt")||"",G=v0(X,"width"),Q=v0(X,"height"),w=v0(X,"sizes"),q=v0(X,"srcset"),W=v0(X,"densities"),U=v0(X,"format"),K=v0(X,"placeholder"),z=v0(X,"placeholderColor")||"#e5e7eb",_=v0(X,"provider"),B=v0(X,"class")||v0(X,"className")||"",j=v0(X,"style")||"",H=v0(X,"quality"),O=Z4(X,"lazy",!0),L=Z4(X,"preload",!1),F=Z4(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",M="";if(!R&&w)R=Y4(Y,$4,_,U),M=aY(w);else if(!R&&W){let b=W.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=q_(Y,b,V,_,U)}else if(w)M=aY(w);let T=[];if(j)T.push(j);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let b=W_(V||16,A||9,z);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")T.push(`background-image:url(${b0(K)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let N=a7(Y,V,A,_,U),k=[];if(k.push(`src="${b0(N)}"`),k.push(`alt="${b0(J)}"`),G)k.push(`width="${b0(G)}"`);if(Q)k.push(`height="${b0(Q)}"`);if(O)k.push('loading="lazy"');if(k.push('decoding="async"'),B)k.push(`class="${b0(B)}"`);if(T.length>0)k.push(`style="${b0(T.join(";"))}"`);if(R)k.push(`srcset="${b0(R)}"`);if(M)k.push(`sizes="${b0(M)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...p5(X,D)),k.push(...i5(X,D));let I=`<img ${k.join(" ")} />`,S="";if(L){let y=U==="webp"?"image/webp":U==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${b0(N)}"${y?` type="${y}"`:""}${R?` imagesrcset="${b0(R)}"`:""}${M?` imagesizes="${b0(M)}"`:""} />
3554
+ `}if(F){let b=[];if(U==="avif"||U==="auto"){let y=a7(Y,V,A,_,"avif"),P=R?Y4(Y,$4,_,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${b0(P)}"${M?` sizes="${b0(M)}"`:""} />`)}if(U==="webp"||U==="auto"){let y=a7(Y,V,A,_,"webp"),P=R?Y4(Y,$4,_,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${b0(P)}"${M?` sizes="${b0(M)}"`:""} />`)}return`${S}<picture>
3555
3555
  ${b.join(`
3556
3556
  `)}
3557
3557
  ${I}
3558
- </picture>`}return`${C}${I}`}}});function s7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function l5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var nY="/images/safe-image-default.svg",G_,e9;var X4=E(()=>{X8();G_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${nY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,e9={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=l5(X,"src")||"",J=l5(X,"alt")||"",G=l5(X,"fallback")||nY,Q=l5(X,"class")||l5(X,"className")||"",w=l5(X,"fallbackClassName")||"",q=[];if(q.push(`src="${s7(Y)}"`),q.push(`alt="${s7(J)}"`),Q)q.push(`class="${s7(Q)}"`);if(q.push(`data-fallback="${s7(G)}"`),w)q.push(`data-fallback-class="${s7(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...d5(X,W)),q.push(...m5(X,W));let U=`<img ${q.join(" ")} />`,K=Z.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${G_}${U}`;return U}}});function $4(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function o7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function $8(X,$,Z){let Y=o7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var Z4;var Y4=E(()=>{Z4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=$4(o7(X,"color")||"#6366f1"),J=$4(o7(X,"initialColor")||o7(X,"initial-color")||""),G=$4(o7(X,"height")||"3px"),Q=$8(X,"duration",2000),w=$8(X,"throttle",200),q=$8(X,"zIndex",999999)||$8(X,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
3558
+ </picture>`}return`${S}${I}`}}});function t7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var tY="/images/safe-image-default.svg",U_,Q4;var w4=E(()=>{G8();U_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${tY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Q4={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=n5(X,"src")||"",J=n5(X,"alt")||"",G=n5(X,"fallback")||tY,Q=n5(X,"class")||n5(X,"className")||"",w=n5(X,"fallbackClassName")||"",q=[];if(q.push(`src="${t7(Y)}"`),q.push(`alt="${t7(J)}"`),Q)q.push(`class="${t7(Q)}"`);if(q.push(`data-fallback="${t7(G)}"`),w)q.push(`data-fallback-class="${t7(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...p5(X,W)),q.push(...i5(X,W));let U=`<img ${q.join(" ")} />`,K=Z.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${U_}${U}`;return U}}});function q4(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function e7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Q8(X,$,Z){let Y=e7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var W4;var U4=E(()=>{W4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=q4(e7(X,"color")||"#6366f1"),J=q4(e7(X,"initialColor")||e7(X,"initial-color")||""),G=q4(e7(X,"height")||"3px"),Q=Q8(X,"duration",2000),w=Q8(X,"throttle",200),q=Q8(X,"zIndex",999999)||Q8(X,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
3559
3559
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};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">
3560
3560
  <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>
3561
3561
  </div>
3562
3562
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3563
3563
  <script>
3564
3564
  (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)},${w})},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()})})();
3565
- </script>`}}});function sY(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function Q_(X,$,Z){let Y=sY(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var rY,J4;var G4=E(()=>{rY={"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%)"},J4={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=F0(sY(X,"position")||"top-right"),J=Q_(X,"max",5),G=rY[Y]||rY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3565
+ </script>`}}});function XJ(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function K_(X,$,Z){let Y=XJ(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var eY,K4;var z4=E(()=>{eY={"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%)"},K4={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=V0(XJ(X,"position")||"top-right"),J=K_(X,"max",5),G=eY[Y]||eY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3566
3566
  <style>
3567
3567
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3568
3568
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3570,7 +3570,7 @@ ${I}
3570
3570
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3571
3571
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3572
3572
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3573
- </style>`}}});function Z8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var oY,Q4;var w4=E(()=>{oY={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)"},Q4={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=Z8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=F0(Y),G=Z8(X,"size")||"md",Q=Z8(X,"closeOnBackdrop")!=="false",w=Z8(X,"closeOnEscape")!=="false",q=oY[G]||oY.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" 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">
3573
+ </style>`}}});function w8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var $J,B4;var _4=E(()=>{$J={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)"},B4={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=w8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=V0(Y),G=w8(X,"size")||"md",Q=w8(X,"closeOnBackdrop")!=="false",w=w8(X,"closeOnEscape")!=="false",q=$J[G]||$J.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" 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">
3574
3574
  <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)">
3575
3575
  <div style="padding:1.5rem">${$}</div>
3576
3576
  </div>
@@ -3579,7 +3579,7 @@ ${I}
3579
3579
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3580
3580
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3581
3581
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3582
- </style>`}}});function c5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var aY,q4;var W4=E(()=>{aY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},q4={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=c5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=F0(Y),G=c5(X,"side")||"right",Q=c5(X,"size")||"md",w=c5(X,"closeOnBackdrop")!=="false",q=c5(X,"closeOnEscape")!=="false",W=c5(X,"overlay")!=="false",U=aY[Q]||aY.md,K=G==="left",z=K?"left:0":"right:0",_=K?"translateX(-100%)":"translateX(100%)",B=K?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" 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">
3582
+ </style>`}}});function r5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var ZJ,j4;var H4=E(()=>{ZJ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},j4={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=r5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=V0(Y),G=r5(X,"side")||"right",Q=r5(X,"size")||"md",w=r5(X,"closeOnBackdrop")!=="false",q=r5(X,"closeOnEscape")!=="false",W=r5(X,"overlay")!=="false",U=ZJ[Q]||ZJ.md,K=G==="left",z=K?"left:0":"right:0",_=K?"translateX(-100%)":"translateX(100%)",B=K?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" 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">
3583
3583
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${U};max-width:100vw;transform:${_};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
3584
3584
  <div style="padding:1.5rem">${$}</div>
3585
3585
  </div>
@@ -3588,7 +3588,7 @@ ${I}
3588
3588
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3589
3589
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3590
3590
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3591
- </style>`}}});import{existsSync as w_,readFileSync as q_}from"fs";function W_(X){if(tY.has(X))return;tY.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function U_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(w_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return X0.resolve(Z)}catch{}return null}function K_(X){if(Y8.has(X))return Y8.get(X);let $=U_(X);if(!$)return W_(X),null;try{let Z=JSON.parse(q_($,"utf8"));return Y8.set(X,Z.icons),Z.icons}catch{return null}}function p5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var Y8,tY,U4;var K4=E(()=>{Y8=new Map,tY=new Set;U4={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=p5(X,"name")??p5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=F0(p5(X,"size")||"24"),w=F0(p5(X,"color")||"currentColor"),q=F0(p5(X,"class")||""),W=F0(p5(X,"style")||""),U=Y8.get(J)??K_(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let K=U[G];if(!K)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=K.width||24,_=K.height||24,B=`0 0 ${z} ${_}`,j=K.body;if(w!=="currentColor")j=j.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${H}${O}>${j}</svg>`}}});function z4(){return`
3591
+ </style>`}}});import{existsSync as z_,readFileSync as B_}from"fs";function __(X){if(YJ.has(X))return;YJ.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function j_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(z_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return Z0.resolve(Z)}catch{}return null}function H_(X){if(q8.has(X))return q8.get(X);let $=j_(X);if(!$)return __(X),null;try{let Z=JSON.parse(B_($,"utf8"));return q8.set(X,Z.icons),Z.icons}catch{return null}}function s5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var q8,YJ,L4;var O4=E(()=>{q8=new Map,YJ=new Set;L4={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=s5(X,"name")??s5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=V0(s5(X,"size")||"24"),w=V0(s5(X,"color")||"currentColor"),q=V0(s5(X,"class")||""),W=V0(s5(X,"style")||""),U=q8.get(J)??H_(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let K=U[G];if(!K)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=K.width||24,_=K.height||24,B=`0 0 ${z} ${_}`,j=K.body;if(w!=="currentColor")j=j.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${H}${O}>${j}</svg>`}}});function F4(){return`
3592
3592
  (function(){
3593
3593
  var tip=null,hideTimer=null,currentEl=null;
3594
3594
 
@@ -3691,37 +3691,37 @@ document.addEventListener("focusout",function(e){
3691
3691
  if(el) hideTip();
3692
3692
  });
3693
3693
  })();
3694
- `}function eY(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function XJ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var B4;var _4=E(()=>{B4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=XJ($,"fallback"),J=Y.rest,G=XJ(J,"error"),Q=G.rest,w=Y.region??eY(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??eY(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function J8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var j4;var H4=E(()=>{j4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(J8(X,"name")||"v").replace(/["'<>]/g,""),J=(J8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=J8(X,"class"),Q=J8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function $J(){h0.registerBuiltin(i9),h0.registerBuiltin(a9),h0.registerBuiltin(e9),h0.registerBuiltin(Z4),h0.registerBuiltin(J4),h0.registerBuiltin(Q4),h0.registerBuiltin(q4),h0.registerBuiltin(U4),h0.registerBuiltin(B4),h0.registerBuiltin(j4)}var ZJ=E(()=>{n9();t9();X4();Y4();G4();w4();W4();K4();_4();H4();c9();n9();t9();X4();Y4();G4();w4();W4();K4();_4();H4()});function G8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function YJ(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let j=G+1+q.length;while(j<X.length&&X[j]!==">")j++;J=j+1;continue}let W=G+1+q.length,U=null,K=W,z=-1,_=!1;while(W<X.length){let j=X[W];if(U){if(j==="\\"&&W+1<X.length){W+=2;continue}if(j===U)U=null;W++;continue}if(j==='"'||j==="'"){U=j,W++;continue}if(j==="/"&&W+1<X.length&&X[W+1]===">"){z=W+2,_=!0;break}if(j===">"){z=W+1;break}W++}if(z===-1){J=G+1;continue}let B=X.slice(K,_?z-2:z-1).trim();if(_)Y.push({fullMatch:X.slice(G,z),tagName:q,attributes:B,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let j=`<${q}`,H=`</${q}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(j,L),M=X.indexOf(H,L);if(M===-1)break;if(R!==-1&&R<M){let T=X[R+j.length];if(T===" "||T===">"||T==="/"||T===`
3695
- `||T==="\t")O++;L=R+j.length}else{if(O--,O===0){F=M;break}L=M+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function JJ(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function GJ(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var QJ=E(()=>{A0();T0();Z5()});var BJ={};a(BJ,{processESImports:()=>KJ,processComponents:()=>q8});import w8 from"fs";import c0 from"path";function B_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(W)=>{if(J.size===0)return!1;let U=r0(W),K=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&J.has(K))return!0;for(let z of J){let _=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${_}\\s*\\(`).test(U))return!0}return!1},Q=new Set(V2),w=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,K)=>K.toUpperCase())},q=(W,U)=>{let K=w(W);if(Y.static[K]=U,K!==W)Y.staticNames[K]=W};for(let[W,U]of Object.entries(X)){let K=W.startsWith("x-")&&!Q.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){Y.events[K]=U;continue}if(K.startsWith("__stx_")){let z=w(K.slice(6));Y.serverDynamic[z]=GJ(U,Z);continue}if(K.startsWith(":")){let z=w(K.slice(1)),_=U===W5?z:U;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=_;continue}if(G(_)){Y.clientReactive[z]=_;continue}try{if(!w0(_)){if(Z.debug)console.error(`Unsafe expression in :${z} binding: ${_}`);Y.clientReactive[z]=_;continue}let B=Object.keys($),H=q0(_,B)(...Object.values($));if(H===void 0){let O=_.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(O.some((V)=>!L.has(V)&&!B.includes(V))){Y.clientReactive[z]=_;continue}}if(Y.serverDynamic[z]=H,z!==K.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[z]=K.slice(1)}catch{Y.clientReactive[z]=_}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let z=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let _=z[1];if(w0(_)){let j=q0(_,Object.keys($))(...Object.values($));q(K,j!=null?String(j):"")}else{if(Z.debug)console.error(`Unsafe expression in ${K}: ${_}`);q(K,U)}}catch(_){if(Z.debug)console.error(`Error evaluating expression for ${K}:`,_);q(K,U)}else{let _=U,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,j;while((j=B.exec(U))!==null)try{let H=j[1];if(!w0(H)){if(Z.debug)console.error(`Unsafe expression in ${K}: ${H}`);continue}let L=q0(H,Object.keys($))(...Object.values($));_=_.replace(j[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${K}:`,H)}q(K,_)}continue}q(K,U===W5?"true":JJ(U))}return Y}function j_(X,$,Z){if(!X.includes("@"))return X;if(!__.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return A1(X,$,Z)}catch{return X}}function H_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=W5}return $}function qJ(X){return Object.entries(X).map(([$,Z])=>Z===W5?$:`${$}="${L_(Z)}"`).join(" ")}function L_(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O_(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(h0.isBuiltin(J))$.add(J)}return[...$].sort()}function F_(X){let $=WJ.get(X);if($)return $;let Z=new Map,Y=[c0.join(X,"src"),c0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=w8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=c0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Z.has(U))Z.set(U,W);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,W);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return WJ.set(X,Z),Z}function V_(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=c0.join(Z,"node_modules",X);try{if(w8.statSync(Y).isDirectory())return Y}catch{}let J=c0.dirname(Z);if(J===Z)return null;Z=J}}async function KJ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=c0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=K,B,j=[];while((B=z.exec(K))!==null){let[H,O,L,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=c0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let k=`${T}.stx`;try{if(w8.statSync(k).isFile())A=k}catch{try{if(w8.statSync(T).isDirectory())V=T}catch{}}}}else V=V_(F,Q);if(!V&&!A)continue;let R=!1,M=(T,k)=>{G.set(T,k),G.set(T.toLowerCase(),k);let N=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(N,k),J.add(k)};if(L&&A)M(L,A),R=!0;else if(O){let T=O.slice(1,-1).split(",").map((N)=>N.trim()).filter(Boolean).map((N)=>{let D=N.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:N,local:N}}),k=V?F_(V):null;for(let{source:N,local:D}of T){let I=null;if(A)I=A;else if(k)I=k.get(N)??k.get(N.toLowerCase())??k.get(N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)M(D,I),R=!0}}if(R)j.push({start:B.index,end:B.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)_=_.slice(0,j[H].start)+_.slice(j[H].end);return`<script${U}>${_}</script>`}),w}async function A_(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,U]=q,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let _=z.split("/"),j=_[_.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[c0.resolve(c0.dirname(Z),`${z}.stx`),c0.resolve(c0.dirname(Z),z),c0.resolve(Y.componentsDir||"components",`${z}.stx`),c0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function R_(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let U=W.index,K=U+W[0].length-1,z=1,_=K+1;while(_<G.length&&z>0){if(G[_]==="(")z++;else if(G[_]===")"){if(z--,z===0)break}_++}if(z!==0)break;let B=G.substring(K+1,_),j=_+1,H=B.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=B.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=V0(L,$)}catch(D){let I=D instanceof Error?D.message:String(D);G=G.replace(G.substring(U,j),`[Error parsing component props: ${I}]`);continue}let R="",M=j,k=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),M=j+k[0].length;let N=await U5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+N+G.substring(M),q.lastIndex=0}return G}async function M_(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=b1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,z_),G=S7(G,q.scripts),G;async function z(_,B,j,H){if(!_)return _;let O=_,L=YJ(O,B,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?G8(V.tagName):V.tagName,R=H_(j_(V.attributes,$,Z)),M=B_(R,$,Y),T=h0.getBuiltin(V.tagName),k=T?await Q8(A,Q,$,Z,Y):!1;if(T&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(M,V.content,C);if(Object.keys(M.clientReactive).length>0)b=UJ(b,M.clientReactive);if(Object.keys(M.events).length>0){let y=qJ(M.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}O=O.substring(0,V.startIndex)+b+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await Q8(A,Q,$,Z,Y))continue;let N={};for(let[C,b]of Object.entries(M.static))N[C]=b;for(let[C,b]of Object.entries(M.serverDynamic))N[C]=b;let I=await U5(A,N,V.content,Q,$,Z,Y,w,J);if(Object.keys(M.clientReactive).length>0)I=UJ(I,M.clientReactive);if(Object.keys(M.events).length>0){let C=zJ(I);if(C){let b=qJ(M.events),y=Object.keys(M.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${y}" ${b}`+I.substring(C.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function UJ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>G8(U)).join(" "),Q=X,w=J.length>0?zJ(Q):null;if(w){let U=J.map(([z,_])=>`:${G8(z)}="${_.replace(/"/g,"&quot;")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function zJ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function q8(X,$,Z,Y,J){if(!wJ)$J(),wJ=!0;let G=await KJ(X,$,Z,Y,J);G=await A_(G,$,Z,Y,J),G=await R_(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=Q1(G,b7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...q.tokens);let W=G;if(G=await M_(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=O_(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var wJ=!1,z_,__,WJ;var L4=E(()=>{c9();u7();ZJ();QJ();Z5();T0();A0();X1();z_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);__=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];WJ=new Map});var W8={};a(W8,{stripTypeScript:()=>VJ,splitDeclaration:()=>kJ,isModuleResolutionFailure:()=>AJ,isMissingBindingFailure:()=>RJ,isCompleteImport:()=>MJ,hasVariables:()=>yJ,extractVariables:()=>R1,extractScriptFromTemplate:()=>DJ,convertToCommonJS:()=>V4,STX_ENGINE_BINDING_NAMES:()=>F4});import g1 from"path";import i5 from"process";function N_(X){let $=[],Z=0,Y=X.split(`
3696
- `);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)$.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)$.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((z)=>{let _=z.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...K)}}}}return[...new Set($)]}function VJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let U=Y[W];if(q){if(G+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")w++;else if(U===")")w--;if(U===","&&Q===0&&w===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((W)=>{let U=W.trim(),K=U.startsWith("..."),z=K?U.slice(3):U,_=-1,B=0;for(let A=0;A<z.length;A++)if(z[A]==="<")B++;else if(z[A]===">")B--;else if(z[A]===":"&&B===0){_=A;break}if(_===-1)return W;let H=z.substring(0,_).trim().replace(/\?$/,""),O=z.substring(_+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=K?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,q=Q+1,W=0,U=null;while(q<$.length&&w>0){let _=$[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")w++;else if(_===")")w--}if(w>0)q++}if(w!==0)continue;let K=$.substring(Q+1,q);if(!K.includes(":"))continue;let z=Z(K);G.push({start:Q+1,end:q,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];$=$.substring(0,w)+W+$.substring(q)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3697
-
3698
- `),$}function AJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function RJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function R1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}),S=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");S=S.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=P.transformSync(S)}catch{J=VJ(X)}let G={exports:{}},Q=G.exports,w=i5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of W)try{let S=g1.resolve(w,"node_modules",P),f=g1.join(S,"package.json"),l=JSON.parse(X0("fs").readFileSync(f,"utf8")),d=l.main||"index.js";if(l.exports){let Q0=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof Q0==="string")d=Q0;else if(Q0?.bun)d=Q0.bun;else if(Q0?.import)d=Q0.import;else if(Q0?.default)d=Q0.default}q[P]=await import(g1.resolve(S,d))}catch{}let U=(P)=>{if(q[P])return q[P];return X0(P)},K=$.props||{},z=(P)=>{if(!P)return K;let S={};for(let[f,l]of Object.entries(P)){let d=K[f];if(d!==void 0)S[f]=d;else if(typeof l==="function")S[f]=l();else S[f]=l}return S};for(let[P,S]of Object.entries(K))Object.defineProperty(z,P,{value:S,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(K,P))continue;try{Object.defineProperty(z,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(P)=>{if(!P)return K;let S={...K};for(let[f,l]of Object.entries(P)){let d=l&&typeof l==="object"&&!Array.isArray(l)?l:{type:l};if(S[f]===void 0&&d.default!==void 0)S[f]=typeof d.default==="function"?d.default():d.default}return S},B=()=>$.slots||{},j=(P,S)=>{let f={...P};for(let[l,d]of Object.entries(S))if(f[l]===void 0)if(typeof d==="function")f[l]=d();else f[l]=d;return f},H=(P)=>{let S=()=>P;return S.set=(f)=>{},S.update=(f)=>{},S},O=(P)=>{let S,f=!1;return()=>{if(!f)try{S=P(),f=!0}catch{S=void 0}return S}},L=(P)=>{},F=(P)=>P(),V=(P)=>{},A=(P)=>{};function R(P){let S=P||{};if(S.title!==void 0||S.description!==void 0)D({title:S.title,description:S.description})}function M(P){if(!P||typeof P!=="object")return;let S=$.__stxClientPayload??{};Object.assign(S,P),$.__stxClientPayload=S}let T=()=>{let P=$.__stxServeContext,S=$.__stxServeSearch??P?.search??"",f=P?.path??"",l=Object.fromEntries(new URLSearchParams(S)),d=$.query,Q0=Object.keys(l).length>0?l:d??{},L0=S||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:$.params??{},query:Q0,path:f,name:"",fullPath:f+L0,hash:"",matched:[]}},k=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),N=(P)=>{let S=$.__stx_runtime_head||{};$.__stx_runtime_head=f5(S,P||{})},D=(P)=>{N(rX(P||{}))},I=(P)=>({value:P}),C=(P)=>P,b=(P)=>({value:typeof P==="function"?P():P}),y=(P,S)=>{},v=(P)=>{},x=(P)=>{},g=(P)=>P?P():Promise.resolve(),c=(P)=>(S,...f)=>{},p=(P)=>{},y0=(P,S)=>{},b0=(P,S)=>S,i0=()=>({value:"light"}),K0=()=>H(!1),$0=(P)=>H(!1),N0=()=>H(!1),t0=()=>$0("(prefers-color-scheme: dark)"),k1=()=>$0("(prefers-color-scheme: light)"),O5=()=>$0("(prefers-reduced-motion: reduce)"),r=()=>$0("(prefers-contrast: more)"),e={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:{}},W0=new Proxy(e,{get(P,S){if(S in P)return P[S];return},set(P,S,f){return P[S]=f,!0}}),S0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},j0=console;try{let P=V4(J,Z),S=new Set(Object.keys(K)),f=(s)=>/^[a-z_$][\w$]*$/i.test(s),l=Object.keys($).filter((s)=>!S.has(s)&&s!=="props"&&f(s)),d=l.map((s)=>$[s]);if(!l.includes("__stxServeContext"))l.push("__stxServeContext"),d.push(void 0);let Q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),L0=[],z1=[];for(let[s,u0]of Object.entries(K)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s))continue;if(Q0.has(s))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${s}\\b`).test(P))continue;L0.push(s),z1.push(u0)}let v0=N_(P).map((s)=>`module.exports.${s} = typeof ${s} !== 'undefined' ? ${s} : module.exports.${s};`).join(`
3699
- `),e0=$.params??{},n1=[],I1=[];for(let s=0;s<l.length;s++){if(l[s]==="params")continue;n1.push(l[s]),I1.push(d[s])}let U0=await Function(...F4,...L0,...n1,`return (async () => {
3700
- ${P}
3701
- ${v0}
3694
+ `}function JJ(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function GJ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var V4;var A4=E(()=>{V4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=GJ($,"fallback"),J=Y.rest,G=GJ(J,"error"),Q=G.rest,w=Y.region??JJ(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??JJ(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function W8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var R4;var M4=E(()=>{R4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(W8(X,"name")||"v").replace(/["'<>]/g,""),J=(W8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=W8(X,"class"),Q=W8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function QJ(){c0.registerBuiltin(e9),c0.registerBuiltin(J4),c0.registerBuiltin(Q4),c0.registerBuiltin(W4),c0.registerBuiltin(K4),c0.registerBuiltin(B4),c0.registerBuiltin(j4),c0.registerBuiltin(L4),c0.registerBuiltin(V4),c0.registerBuiltin(R4)}var wJ=E(()=>{X4();G4();w4();U4();z4();_4();H4();O4();A4();M4();a9();X4();G4();w4();U4();z4();_4();H4();O4();A4();M4()});function U8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function qJ(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let j=G+1+q.length;while(j<X.length&&X[j]!==">")j++;J=j+1;continue}let W=G+1+q.length,U=null,K=W,z=-1,_=!1;while(W<X.length){let j=X[W];if(U){if(j==="\\"&&W+1<X.length){W+=2;continue}if(j===U)U=null;W++;continue}if(j==='"'||j==="'"){U=j,W++;continue}if(j==="/"&&W+1<X.length&&X[W+1]===">"){z=W+2,_=!0;break}if(j===">"){z=W+1;break}W++}if(z===-1){J=G+1;continue}let B=X.slice(K,_?z-2:z-1).trim();if(_)Y.push({fullMatch:X.slice(G,z),tagName:q,attributes:B,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let j=`<${q}`,H=`</${q}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(j,L),M=X.indexOf(H,L);if(M===-1)break;if(R!==-1&&R<M){let T=X[R+j.length];if(T===" "||T===">"||T==="/"||T===`
3695
+ `||T==="\t")O++;L=R+j.length}else{if(O--,O===0){F=M;break}L=M+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function WJ(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function UJ(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var KJ=E(()=>{T0();L0();P1()});var OJ={};e(OJ,{processESImports:()=>HJ,processComponents:()=>B8});import z8 from"fs";import r0 from"path";function O_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(W)=>{if(J.size===0)return!1;let U=o0(W),K=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&J.has(K))return!0;for(let z of J){let _=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${_}\\s*\\(`).test(U))return!0}return!1},Q=new Set(I2),w=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,K)=>K.toUpperCase())},q=(W,U)=>{let K=w(W);if(Y.static[K]=U,K!==W)Y.staticNames[K]=W};for(let[W,U]of Object.entries(X)){let K=W.startsWith("x-")&&!Q.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){Y.events[K]=U;continue}if(K.startsWith("__stx_")){let z=w(K.slice(6));Y.serverDynamic[z]=UJ(U,Z);continue}if(K.startsWith(":")){let z=w(K.slice(1)),_=U===_5?z:U;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=_;continue}if(G(_)){Y.clientReactive[z]=_;continue}try{if(!q0(_)){if(Z.debug)console.error(`Unsafe expression in :${z} binding: ${_}`);Y.clientReactive[z]=_;continue}let B=Object.keys($),H=W0(_,B)(...Object.values($));if(H===void 0){let O=_.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(O.some((V)=>!L.has(V)&&!B.includes(V))){Y.clientReactive[z]=_;continue}}if(Y.serverDynamic[z]=H,z!==K.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[z]=K.slice(1)}catch{Y.clientReactive[z]=_}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let z=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let _=z[1];if(q0(_)){let j=W0(_,Object.keys($))(...Object.values($));q(K,j!=null?String(j):"")}else{if(Z.debug)console.error(`Unsafe expression in ${K}: ${_}`);q(K,U)}}catch(_){if(Z.debug)console.error(`Error evaluating expression for ${K}:`,_);q(K,U)}else{let _=U,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,j;while((j=B.exec(U))!==null)try{let H=j[1];if(!q0(H)){if(Z.debug)console.error(`Unsafe expression in ${K}: ${H}`);continue}let L=W0(H,Object.keys($))(...Object.values($));_=_.replace(j[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${K}:`,H)}q(K,_)}continue}q(K,U===_5?"true":WJ(U))}return Y}function V_(X,$,Z){if(!X.includes("@"))return X;if(!F_.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return T1(X,$,Z)}catch{return X}}function A_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=_5}return $}function BJ(X){return Object.entries(X).map(([$,Z])=>Z===_5?$:`${$}="${R_(Z)}"`).join(" ")}function R_(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M_(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(c0.isBuiltin(J))$.add(J)}return[...$].sort()}function T_(X){let $=_J.get(X);if($)return $;let Z=new Map,Y=[r0.join(X,"src"),r0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=z8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=r0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Z.has(U))Z.set(U,W);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,W);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return _J.set(X,Z),Z}function N_(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=r0.join(Z,"node_modules",X);try{if(z8.statSync(Y).isDirectory())return Y}catch{}let J=r0.dirname(Z);if(J===Z)return null;Z=J}}async function HJ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=r0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=K,B,j=[];while((B=z.exec(K))!==null){let[H,O,L,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=r0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let N=`${T}.stx`;try{if(z8.statSync(N).isFile())A=N}catch{try{if(z8.statSync(T).isDirectory())V=T}catch{}}}}else V=N_(F,Q);if(!V&&!A)continue;let R=!1,M=(T,N)=>{G.set(T,N),G.set(T.toLowerCase(),N);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,N),J.add(N)};if(L&&A)M(L,A),R=!0;else if(O){let T=O.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let D=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:k,local:k}}),N=V?T_(V):null;for(let{source:k,local:D}of T){let I=null;if(A)I=A;else if(N)I=N.get(k)??N.get(k.toLowerCase())??N.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)M(D,I),R=!0}}if(R)j.push({start:B.index,end:B.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)_=_.slice(0,j[H].start)+_.slice(j[H].end);return`<script${U}>${_}</script>`}),w}async function k_(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,U]=q,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let _=z.split("/"),j=_[_.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[r0.resolve(r0.dirname(Z),`${z}.stx`),r0.resolve(r0.dirname(Z),z),r0.resolve(Y.componentsDir||"components",`${z}.stx`),r0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function I_(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let U=W.index,K=U+W[0].length-1,z=1,_=K+1;while(_<G.length&&z>0){if(G[_]==="(")z++;else if(G[_]===")"){if(z--,z===0)break}_++}if(z!==0)break;let B=G.substring(K+1,_),j=_+1,H=B.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=B.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=M0(L,$)}catch(D){let I=D instanceof Error?D.message:String(D);G=G.replace(G.substring(U,j),`[Error parsing component props: ${I}]`);continue}let R="",M=j,N=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(N)R=N[1].trim(),M=j+N[0].length;let k=await j5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+k+G.substring(M),q.lastIndex=0}return G}async function E_(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=U1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,L_),G=v5(G,q.scripts),G;async function z(_,B,j,H){if(!_)return _;let O=_,L=qJ(O,B,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?U8(V.tagName):V.tagName,R=A_(V_(V.attributes,$,Z)),M=O_(R,$,Y),T=c0.getBuiltin(V.tagName),N=T?await K8(A,Q,$,Z,Y):!1;if(T&&!N){let S={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(M,V.content,S);if(Object.keys(M.clientReactive).length>0)b=jJ(b,M.clientReactive);if(Object.keys(M.events).length>0){let y=BJ(M.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}O=O.substring(0,V.startIndex)+b+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await K8(A,Q,$,Z,Y))continue;let k={};for(let[S,b]of Object.entries(M.static))k[S]=b;for(let[S,b]of Object.entries(M.serverDynamic))k[S]=b;let I=await j5(A,k,v5(V.content,q.scripts),Q,$,Z,Y,w,J);if(Object.keys(M.clientReactive).length>0)I=jJ(I,M.clientReactive);if(Object.keys(M.events).length>0){let S=LJ(I);if(S){let b=BJ(M.events),y=Object.keys(M.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+I.substring(S.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function jJ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>U8(U)).join(" "),Q=X,w=J.length>0?LJ(Q):null;if(w){let U=J.map(([z,_])=>`:${U8(z)}="${_.replace(/"/g,"&quot;")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function LJ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function B8(X,$,Z,Y,J){if(!zJ)QJ(),zJ=!0;let G=await HJ(X,$,Z,Y,J);G=await k_(G,$,Z,Y,J),G=await I_(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=W1(G,v7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...q.tokens);let W=G;if(G=await E_(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=M_(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var zJ=!1,L_,F_,_J;var T4=E(()=>{a9();l7();wJ();KJ();P1();L0();T0();Z1();L_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);F_=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];_J=new Map});var _8={};e(_8,{stripTypeScript:()=>NJ,splitDeclaration:()=>bJ,isModuleResolutionFailure:()=>kJ,isMissingBindingFailure:()=>IJ,isCompleteImport:()=>EJ,hasVariables:()=>vJ,extractVariables:()=>N1,extractScriptFromTemplate:()=>PJ,convertToCommonJS:()=>I4,STX_ENGINE_BINDING_NAMES:()=>k4});import d1 from"path";import o5 from"process";function y_(X){let $=[],Z=0,Y=X.split(`
3696
+ `);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)$.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)$.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((z)=>{let _=z.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...K)}}}}return[...new Set($)]}function NJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let U=Y[W];if(q){if(G+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")w++;else if(U===")")w--;if(U===","&&Q===0&&w===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((W)=>{let U=W.trim(),K=U.startsWith("..."),z=K?U.slice(3):U,_=-1,B=0;for(let A=0;A<z.length;A++)if(z[A]==="<")B++;else if(z[A]===">")B--;else if(z[A]===":"&&B===0){_=A;break}if(_===-1)return W;let H=z.substring(0,_).trim().replace(/\?$/,""),O=z.substring(_+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=K?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,q=Q+1,W=0,U=null;while(q<$.length&&w>0){let _=$[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")w++;else if(_===")")w--}if(w>0)q++}if(w!==0)continue;let K=$.substring(Q+1,q);if(!K.includes(":"))continue;let z=Z(K);G.push({start:Q+1,end:q,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];$=$.substring(0,w)+W+$.substring(q)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3697
+
3698
+ `),$}function kJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function IJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function N1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let C=I1({loader:"ts",target:"browser",define:d0()}),g=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");g=g.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(g)}catch{J=NJ(X)}let G={exports:{}},Q=G.exports,w=o5.cwd(),q={},W=[...J.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 g=d1.resolve(w,"node_modules",C),a=d1.join(g,"package.json"),l=JSON.parse(Z0("fs").readFileSync(a,"utf8")),v=l.main||"index.js";if(l.exports){let m=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof m==="string")v=m;else if(m?.bun)v=m.bun;else if(m?.import)v=m.import;else if(m?.default)v=m.default}q[C]=await import(d1.resolve(g,v))}catch{}let U=(C)=>{if(q[C])return q[C];return Z0(C)},K=$.props||{},z=(C)=>{if(!C)return K;let g={};for(let[a,l]of Object.entries(C)){let v=K[a];if(v!==void 0)g[a]=v;else if(typeof l==="function")g[a]=l();else g[a]=l}return g};for(let[C,g]of Object.entries(K))Object.defineProperty(z,C,{value:g,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(K,C))continue;try{Object.defineProperty(z,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return K;let g={...K};for(let[a,l]of Object.entries(C)){let v=l&&typeof l==="object"&&!Array.isArray(l)?l:{type:l};if(g[a]===void 0&&v.default!==void 0)g[a]=typeof v.default==="function"?v.default():v.default}return g},B=()=>$.slots||{},j=(C,g)=>{let a={...C};for(let[l,v]of Object.entries(g))if(a[l]===void 0)if(typeof v==="function")a[l]=v();else a[l]=v;return a},H=(C)=>{let g=()=>C;return g.set=(a)=>{},g.update=(a)=>{},g},O=(C)=>{let g,a=!1;return()=>{if(!a)try{g=C(),a=!0}catch{g=void 0}return g}},L=(C)=>{},F=(C)=>C(),V=(C)=>{},A=(C)=>{};function R(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)D({title:g.title,description:g.description})}function M(C){if(!C||typeof C!=="object")return;let g=$.__stxClientPayload??{};Object.assign(g,C),$.__stxClientPayload=g}let T=()=>{let C=$.__stxServeContext,g=$.__stxServeSearch??C?.search??"",a=C?.path??"",l=Object.fromEntries(new URLSearchParams(g)),v=$.query,m=Object.keys(l).length>0?l:v??{},K0=g||(Object.keys(m).length>0?`?${new URLSearchParams(m).toString()}`:"");return{params:$.params??{},query:m,path:a,name:"",fullPath:a+K0,hash:"",matched:[]}},N=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),k=(C)=>{let g=$.__stx_runtime_head||{};$.__stx_runtime_head=d5(g,C||{})},D=(C)=>{k(eX(C||{}))},I=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},x=(C)=>{},f=(C)=>C?C():Promise.resolve(),i=(C)=>(g,...a)=>{},c=(C)=>{},I0=(C,g)=>{},f0=(C,g)=>g,g0=()=>({value:"light"}),X1=()=>H(!1),r=(C)=>H(!1),D0=()=>H(!1),z0=()=>r("(prefers-color-scheme: dark)"),o1=()=>r("(prefers-color-scheme: light)"),K7=()=>r("(prefers-reduced-motion: reduce)"),s=()=>r("(prefers-contrast: more)"),X0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},U0=new Proxy(X0,{get(C,g){if(g in C)return C[g];return},set(C,g,a){return C[g]=a,!0}}),h0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},E0=console;try{let C=I4(J,Z),g=new Set(Object.keys(K)),a=(t)=>/^[a-z_$][\w$]*$/i.test(t),l=Object.keys($).filter((t)=>!g.has(t)&&t!=="props"&&a(t)),v=l.map((t)=>$[t]);if(!l.includes("__stxServeContext"))l.push("__stxServeContext"),v.push(void 0);let m=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"]),K0=[],Y0=[];for(let[t,$1]of Object.entries(K)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(m.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;K0.push(t),Y0.push($1)}let R0=y_(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
3699
+ `),y1=$.params??{},u0=[],P0=[];for(let t=0;t<l.length;t++){if(l[t]==="params")continue;u0.push(l[t]),P0.push(v[t])}let a1=await Function(...k4,...K0,...u0,`return (async () => {
3700
+ ${C}
3701
+ ${R0}
3702
3702
  return module.exports
3703
- })()`)(G,Q,U,K,z,_,j,M,H,O,L,F,V,A,R,T,k,N,D,I,C,b,y,v,x,g,c,p,B,y0,b0,i0,K0,$0,N0,t0,k1,O5,r,W0,S0,j0,e.confirm,e.alert,e.fetch,e0,...z1,...I1);if(Y.preserveExisting){for(let[s,u0]of Object.entries(U0))if(!(s in $)||$[s]===void 0)$[s]=u0}else Object.assign($,U0);for(let[s,u0]of Object.entries(K))if(!(s in $))$[s]=u0}catch(P){let S=P instanceof Error?P.message:String(P);if(AJ(S))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${S}`);else if(RJ(S))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${S}`);else if(i5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${S}`);try{await b_(J,$,Z)}catch(f){if(i5.env.STX_DEBUG){let l=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${l}`)}}}}function MJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function V4(X,$){let Z=$?g1.dirname($):i5.cwd(),Y=i5.cwd(),J=X.split(`
3703
+ })()`)(G,Q,U,K,z,_,j,M,H,O,L,F,V,A,R,T,N,k,D,I,S,b,y,P,x,f,i,c,B,I0,f0,g0,X1,r,D0,z0,o1,K7,s,U0,h0,E0,X0.confirm,X0.alert,X0.fetch,y1,...Y0,...P0);if(Y.preserveExisting){for(let[t,$1]of Object.entries(a1))if(!(t in $)||$[t]===void 0)$[t]=$1}else Object.assign($,a1);for(let[t,$1]of Object.entries(K))if(!(t in $))$[t]=$1}catch(C){let g=C instanceof Error?C.message:String(C);if(kJ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${g}`);else if(IJ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${g}`);else if(o5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await x_(J,$,Z)}catch(a){if(o5.env.STX_DEBUG){let l=a instanceof Error?a.message:String(a);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${l}`)}}}}function EJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function I4(X,$){let Z=$?d1.dirname($):o5.cwd(),Y=o5.cwd(),J=X.split(`
3704
3704
  `),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,U=Q;for(let _=Q;_<J.length&&!W;_++){let B=null,j=!1,H=J[_];for(let O=0;O<H.length;O++){let L=H[O];if(j){j=!1;continue}if(L==="\\"){j=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){Q=_+1,W=!0;break}}}}if(!W)Q=J.length;let K=J.slice(U,Q).join(`
3705
- `),z=[];for(let _ of["title","description"]){let B=new RegExp(`\\b${_}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(B)z.push(`${_}: ${JSON.stringify(B[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!MJ(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+['"](.+?)['"]/),_=q,B=(j)=>{if(j.startsWith("."))return g1.resolve(Z,j);if(j.startsWith("~/")||j.startsWith("@/"))return g1.resolve(Y,j.slice(2));return j};if(U){let[,j,H]=U,O=B(H);G.push(`const ${j} = (await import('${O}')).default`),G.push(`module.exports.${j} = ${j};`)}else if(K){let[,j,H]=K,O=B(H),L=[],F=[],V=T_.has(H);for(let A of j.split(",")){let R=A.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,k]=[M[0].trim(),M[1].trim()];if(V&&_J.has(T)){G.push(`const ${k} = ${T};`),F.push(k);continue}L.push(`${T}: ${k}`),F.push(k)}else{if(V&&_J.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let j=B(z[1]);G.push(`await import('${j}')`)}else G.push(_);Q++;continue}if(k_.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=HJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=O4(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=HJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=O4(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let U=O4(W,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=J[Q].replace(/^export\s+/,""),K=0,z=Q;for(;z<J.length;z++){let _=J[z];for(let B of _)if(B==="{")K++;else if(B==="}")K--;if(z>Q)U+=`
3706
- `+_;if(K<=0&&z>=Q)break}G.push(U),G.push(`module.exports.${W} = ${W};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return I_(G.join(`
3707
- `),Z,Y)}function I_(X,$,Z){let Y=X.length,J="",G=0,Q=null,w=!1,q=!1,W=0;while(G<Y){let U=X[G],K=X[G+1];if(w){if(J+=U,U===`
3708
- `)w=!1;G++;continue}if(q){if(J+=U,U==="*"&&K==="/"){J+=K,G+=2,q=!1;continue}G++;continue}if(!Q&&U==="/"&&K==="/"){w=!0,J+=U,G++;continue}if(!Q&&U==="/"&&K==="*"){q=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=K,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&K==="{"){W++,J+=K,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let z=E_(X,G);if(z){let{quote:_,path:B,end:j}=z;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let H=B.startsWith(".")?g1.resolve($,B):g1.resolve(Z,B.slice(2));J+=`await import(${_}${H}${_})`,G=j;continue}}}J+=U,G++}return J}function E_(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function TJ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=k0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function NJ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let w=J===0?TJ(Z,Y):null;if(w){$.push(...NJ(w.pattern)),Y=w.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function kJ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=X[Z+1],q=X[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function jJ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function HJ(X,$){let Z=X[$].trim(),Y=kJ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let U=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let K=Z.slice(U[0].length),z=$;if(K.startsWith("{")||K.startsWith("[")){let B=K[0],j=B==="{"?"}":"]",H=jJ(K,B,j,0),O=K;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,z=L,H=jJ(X[L],B,j,H);if(H>0)O=K,z=$;K=O}let _=TJ(K,0);if(_){let B=U[1],j=_.pattern,H=K.slice(_.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(z,$);if(LJ(O)){let M=OJ(X,F,O);L=M.value,F=M.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=NJ(j),A=`__stx_src_${$}`,R=V.map((M)=>`module.exports.${M} = ${M};`).join(`
3705
+ `),z=[];for(let _ of["title","description"]){let B=new RegExp(`\\b${_}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(B)z.push(`${_}: ${JSON.stringify(B[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!EJ(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+['"](.+?)['"]/),_=q,B=(j)=>{if(j.startsWith("."))return d1.resolve(Z,j);if(j.startsWith("~/")||j.startsWith("@/"))return d1.resolve(Y,j.slice(2));return j};if(U){let[,j,H]=U,O=B(H);G.push(`const ${j} = (await import('${O}')).default`),G.push(`module.exports.${j} = ${j};`)}else if(K){let[,j,H]=K,O=B(H),L=[],F=[],V=D_.has(H);for(let A of j.split(",")){let R=A.trim();if(!R)continue;let M=R.split(/\s+as\s+/);if(M.length===2){let[T,N]=[M[0].trim(),M[1].trim()];if(V&&FJ.has(T)){G.push(`const ${N} = ${T};`),F.push(N);continue}L.push(`${T}: ${N}`),F.push(N)}else{if(V&&FJ.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let j=B(z[1]);G.push(`await import('${j}')`)}else G.push(_);Q++;continue}if(b_.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=AJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=N4(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=AJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=N4(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let U=N4(W,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=J[Q].replace(/^export\s+/,""),K=0,z=Q;for(;z<J.length;z++){let _=J[z];for(let B of _)if(B==="{")K++;else if(B==="}")K--;if(z>Q)U+=`
3706
+ `+_;if(K<=0&&z>=Q)break}G.push(U),G.push(`module.exports.${W} = ${W};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return S_(G.join(`
3707
+ `),Z,Y)}function S_(X,$,Z){let Y=X.length,J="",G=0,Q=null,w=!1,q=!1,W=0;while(G<Y){let U=X[G],K=X[G+1];if(w){if(J+=U,U===`
3708
+ `)w=!1;G++;continue}if(q){if(J+=U,U==="*"&&K==="/"){J+=K,G+=2,q=!1;continue}G++;continue}if(!Q&&U==="/"&&K==="/"){w=!0,J+=U,G++;continue}if(!Q&&U==="/"&&K==="*"){q=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=K,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&K==="{"){W++,J+=K,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let z=C_(X,G);if(z){let{quote:_,path:B,end:j}=z;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let H=B.startsWith(".")?d1.resolve($,B):d1.resolve(Z,B.slice(2));J+=`await import(${_}${H}${_})`,G=j;continue}}}J+=U,G++}return J}function C_(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function DJ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=y0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function yJ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let w=J===0?DJ(Z,Y):null;if(w){$.push(...yJ(w.pattern)),Y=w.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function bJ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=X[Z+1],q=X[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function VJ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function AJ(X,$){let Z=X[$].trim(),Y=bJ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let U=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let K=Z.slice(U[0].length),z=$;if(K.startsWith("{")||K.startsWith("[")){let B=K[0],j=B==="{"?"}":"]",H=VJ(K,B,j,0),O=K;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,z=L,H=VJ(X[L],B,j,H);if(H>0)O=K,z=$;K=O}let _=DJ(K,0);if(_){let B=U[1],j=_.pattern,H=K.slice(_.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(z,$);if(RJ(O)){let M=MJ(X,F,O);L=M.value,F=M.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=yJ(j),A=`__stx_src_${$}`,R=V.map((M)=>`module.exports.${M} = ${M};`).join(`
3709
3709
  `);return{type:B,name:A,value:`${L}; ${B} ${j} = ${A};
3710
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=$;if(LJ(w)){let U=OJ(X,$,w);q=U.value,W=U.nextIndex}else W=$+1;while(W<X.length){let U=X[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
3711
- ${X[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function O4(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(D_(Z)){let w=y_(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function LJ(X){let $=X.trim();if($.startsWith("{"))return k0($,"{","}",0)===-1;if($.startsWith("["))return k0($,"[","]",0)===-1;return!IJ($)}function IJ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function EJ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=k0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function D_(X){let $=EJ(X);if($===-1)return!0;return k0(X,"{","}",$)===-1}function OJ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!IJ(Y)){let G=X[J];Y+=`
3710
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=$;if(RJ(w)){let U=MJ(X,$,w);q=U.value,W=U.nextIndex}else W=$+1;while(W<X.length){let U=X[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
3711
+ ${X[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function N4(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(P_(Z)){let w=v_(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function RJ(X){let $=X.trim();if($.startsWith("{"))return y0($,"{","}",0)===-1;if($.startsWith("["))return y0($,"[","]",0)===-1;return!SJ($)}function SJ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function CJ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=y0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function P_(X){let $=CJ(X);if($===-1)return!0;return y0(X,"{","}",$)===-1}function MJ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!SJ(Y)){let G=X[J];Y+=`
3712
3712
  ${G}`,J++}while(J<X.length){let G=X[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
3713
- ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function y_(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=EJ(Y);if(G!==-1){if(k0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3714
- ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function FJ(X,$){let Z=J0(X,$)??J0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...i5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function b_(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=FJ(q,$);if(W!==void 0)$[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let q=w.trim().replace(/;$/,""),W=FJ(q,$);if(W!==void 0)$[Q]=W}catch{}}}function DJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function yJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var F4,_J,T_,k_;var n5=E(()=>{d7();D1();A0();F4=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],_J=new Set(F4),T_=new Set(["stx","@stacksjs/stx"]);k_=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var fJ={};a(fJ,{processLoops:()=>R4,parseLoopBinding:()=>A4});function P_(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=k0(X,"(",")",w);if(q===-1)continue;let W=X.slice(Q,q).trim();if(!W)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let K;try{let z=V0(W,$);if(!z||typeof z!=="object")continue;K=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+K,J=q,Z.lastIndex=q}return J===0?X:Y+X.slice(J)}function v_(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=Y.substring(w+1,W),K=W+1,z=U.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let _=z[1],B=U.slice(z[0].length),j=B.match(/^\s*,\s*/);if(!j)continue;let H=B.slice(j[0].length).trim();if(!H)continue;try{let O=V0(H,$),L=JSON.stringify(O),F=`@component('${_}', ${L})`;G.push({start:Q,end:K,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function U8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,U=null,K=!1;while(W<Y.length&&q>0){let B=Y[W];if(K){K=!1,W++;continue}if(B==="\\"&&U){K=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=Y.substring(w+1,W),_=Z(z);Y=Y.substring(0,Q)+_+Y.substring(W+1)}return Y}function x_(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);EX(G);let W=q0(G,Q)(...w),U=JSON.stringify(W),K=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${K}"`}catch(Q){return Y}}),Z}function f_(X,$){let Z=X;return Z=U8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(w0(G)){let w=q0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?K8:""}catch{return""}}),Z=U8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(w0(G)){let w=q0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?z8:""}catch{return""}}),Z}function g_(X){let $=X;return $=$.replace(/@break(?!\()/g,K8),$=$.replace(/@continue(?!\()/g,z8),$}function bJ(X){let $=X.includes(K8),Z=$?X.substring(0,X.indexOf(K8)):X;return{hasBreak:$,content:Z}}function SJ(X){let $=X.includes(z8),Z=$?X.substring(0,X.indexOf(z8)):X;return{hasContinue:$,content:Z}}function PJ(X){let $=X;return $=U8($,"@break",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=U8($,"@continue",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function h_(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,K)=>U.pos-K.pos);let w=[],q=0;for(let U of Y)q+=U.delta,w.push({pos:U.pos,depth:q});function W(U){let K=0,z=w.length-1,_=0;while(K<=z){let B=K+z>>1;if(w[B].pos<=U)_=w[B].depth,K=B+1;else z=B-1}return _}while((Z=$.exec(X))!==null){if(W(Z.index)>0)continue;let U=Z.index,K=Z.index+Z[0].length-1,z=1,_=K+1,B=-1;while(_<X.length&&z>0){if(X[_]==="(")z++;else if(X[_]===")"){if(z--,z===0){B=_;break}}_++}if(B===-1)continue;let j=X.substring(K+1,B),H=A4(j);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,M.lastIndex=A;let b=R.exec(X),y=M.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let k=X.substring(F,T),N=T+11,D=-1,I=0,C=0;while(C<k.length){let b=k.indexOf("@",C);if(b===-1)break;let y=k.substring(b);if(/^@forelse\s*\(/.test(y))I++,C=b+1;else if(y.startsWith("@endforelse"))I--,C=b+11;else if(I===0&&y.startsWith("@empty")){if(k.length<=b+6||!/[a-z]/i.test(k[b+6])){D=b;break}C=b+1}else C=b+1}if(D===-1)continue;return{start:U,end:N,arrayExpr:O,itemVar:L,foreachContent:k.substring(0,D),emptyContent:k.substring(D+6)}}return null}function CJ(X,$){let Z=X;while(!0){let Y=h_(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let U;if(w0(Q))U=q0(Q,Object.keys($))(...Object.values($));else U=J0(Q,$);let K;if(!Array.isArray(U)||U.length===0)K=W;else K=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,J)+K+Z.substring(G)}catch(U){let K=U instanceof Error?U.message:String(U),z=Z0("Forelse",`Error in @forelse(${Q} as ${w}): ${K}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function A4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function R4(X,$,Z,Y){let J=X;J=CJ(J,$);function G(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let K=U.index,z=U.index+U[0].length-1,_=1,B=z+1,j=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=q.substring(z+1,j),O=A4(H);if(!O)continue;let L=K,{arrayExpr:F,itemVar:V}=O,A=j+1,R=1,M=A,T=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&M<q.length){T.lastIndex=M,k.lastIndex=M;let N=T.exec(q),D=k.exec(q);if(!D)break;if(N&&N.index<D.index)R++,M=N.index+N[0].length;else{if(R--,R===0){let I=q.substring(A,D.index),C=D.index+11;return{start:L,end:C,arrayExpr:F,itemVar:V,content:I}}M=D.index+11}}}return null}function Q(q,W){let U=q;while(!0){let K=G(U);if(!K)break;let{start:z,end:_,arrayExpr:B,itemVar:j,content:H}=K;try{let O=B.trim(),L;if(w0(O))L=q0(O,Object.keys(W))(...Object.values(W));else L=J0(O,W);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=Z0("Foreach",`Error in @foreach: ${O} is not iterable`,o.TYPE_ERROR);U=U.substring(0,z)+D+U.substring(_);continue}let V=Y?.loops?.useAltLoopVariable??C_,A=j.trim(),R=null,M,T=!1;if(A.includes("=>")){let D=A.split("=>").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1];else M=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1],T=!0;else M=A}else M=A;let k="",N=L;for(let D=0;D<N.length;D++){let I=N[D],C={index:D,iteration:D+1,first:D===0,last:D===N.length-1,count:N.length},b={...W,loop:C,$loop:C};if(M.startsWith("[")&&M.endsWith("]")){let g=M.slice(1,-1).split(",").map((c)=>c.trim());if(Array.isArray(I))g.forEach((c,p)=>{if(c)b[c]=I[p]});else b[M]=I}else b[M]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[M]=I[1];else b[R]=D;let y=f_(H,b),v=SJ(y);if(v.hasContinue){k+=v.content;continue}let x=bJ(y);if(x.hasBreak){k+=x.content;break}if(y=CJ(y,b),y=Q(y,b),y=A1(y,b,Z),y=g_(y),x=bJ(y),x.hasBreak){k+=x.content;break}if(v=SJ(y),v.hasContinue){k+=v.content;continue}y=S1(y,b,Z),y=x_(y,b),y=v_(y,b),y=P_(y,b),k+=y}U=U.substring(0,z)+k+U.substring(_)}catch(O){let L=Z0("Foreach",`Error in @foreach(${B.trim()} as ${j.trim()}): ${O instanceof Error?O.message:String(O)}`,o.EVALUATION_ERROR);U=U.substring(0,z)+L+U.substring(_)}}return U}J=Q(J,$),J=xJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??S_;return J=m_(J,$,w),J}function vJ(X){return DX(X)}function xJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=k0(J,"(",")",q);if(W===-1)break;let U=J.slice(q+1,W),K=W+1,z=cX(J.slice(w),"for","endfor");if(z.length===0)break;let _=z[0].content,B=w+z[0].end;if(!vJ(U)){let j=Z0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+j+J.substring(B),G=!0;continue}try{let j=u_(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(j.length>0&&H){let R=d_({forExpr:U,content:_,iterVarNames:j,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(B),G=!0;continue}let O=Object.keys($),L=Object.values($),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});F=PJ(F);let A=Function(...O,`
3713
+ ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function v_(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=CJ(Y);if(G!==-1){if(y0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3714
+ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function TJ(X,$){let Z=Q0(X,$)??Q0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...o5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function x_(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=TJ(q,$);if(W!==void 0)$[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let q=w.trim().replace(/;$/,""),W=TJ(q,$);if(W!==void 0)$[Q]=W}catch{}}}function PJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function vJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var k4,FJ,D_,b_;var a5=E(()=>{L0();c7();S1();T0();k4=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],FJ=new Set(k4),D_=new Set(["stx","@stacksjs/stx"]);b_=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var mJ={};e(mJ,{processLoops:()=>D4,parseLoopBinding:()=>E4});function h_(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=y0(X,"(",")",w);if(q===-1)continue;let W=X.slice(Q,q).trim();if(!W)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let K;try{let z=M0(W,$);if(!z||typeof z!=="object")continue;K=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+K,J=q,Z.lastIndex=q}return J===0?X:Y+X.slice(J)}function u_(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=Y.substring(w+1,W),K=W+1,z=U.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let _=z[1],B=U.slice(z[0].length),j=B.match(/^\s*,\s*/);if(!j)continue;let H=B.slice(j[0].length).trim();if(!H)continue;try{let O=M0(H,$),L=JSON.stringify(O),F=`@component('${_}', ${L})`;G.push({start:Q,end:K,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function j8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,U=null,K=!1;while(W<Y.length&&q>0){let B=Y[W];if(K){K=!1,W++;continue}if(B==="\\"&&U){K=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=Y.substring(w+1,W),_=Z(z);Y=Y.substring(0,Q)+_+Y.substring(W+1)}return Y}function d_(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);CX(G);let W=W0(G,Q)(...w),U=JSON.stringify(W),K=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${K}"`}catch(Q){return Y}}),Z}function m_(X,$){let Z=X;return Z=j8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?H8:""}catch{return""}}),Z=j8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Q0(G,$));return Q?L8:""}catch{return""}}),Z}function l_(X){let $=X;return $=$.replace(/@break(?!\()/g,H8),$=$.replace(/@continue(?!\()/g,L8),$}function xJ(X){let $=X.includes(H8),Z=$?X.substring(0,X.indexOf(H8)):X;return{hasBreak:$,content:Z}}function fJ(X){let $=X.includes(L8),Z=$?X.substring(0,X.indexOf(L8)):X;return{hasContinue:$,content:Z}}function hJ(X){let $=X;return $=j8($,"@break",(Z)=>{let Y=Z.trim();if(!PX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=j8($,"@continue",(Z)=>{let Y=Z.trim();if(!PX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function c_(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,K)=>U.pos-K.pos);let w=[],q=0;for(let U of Y)q+=U.delta,w.push({pos:U.pos,depth:q});function W(U){let K=0,z=w.length-1,_=0;while(K<=z){let B=K+z>>1;if(w[B].pos<=U)_=w[B].depth,K=B+1;else z=B-1}return _}while((Z=$.exec(X))!==null){if(W(Z.index)>0)continue;let U=Z.index,K=Z.index+Z[0].length-1,z=1,_=K+1,B=-1;while(_<X.length&&z>0){if(X[_]==="(")z++;else if(X[_]===")"){if(z--,z===0){B=_;break}}_++}if(B===-1)continue;let j=X.substring(K+1,B),H=E4(j);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,M=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,M.lastIndex=A;let b=R.exec(X),y=M.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let N=X.substring(F,T),k=T+11,D=-1,I=0,S=0;while(S<N.length){let b=N.indexOf("@",S);if(b===-1)break;let y=N.substring(b);if(/^@forelse\s*\(/.test(y))I++,S=b+1;else if(y.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&y.startsWith("@empty")){if(N.length<=b+6||!/[a-z]/i.test(N[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:U,end:k,arrayExpr:O,itemVar:L,foreachContent:N.substring(0,D),emptyContent:N.substring(D+6)}}return null}function gJ(X,$){let Z=X;while(!0){let Y=c_(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let U;if(q0(Q))U=W0(Q,Object.keys($))(...Object.values($));else U=Q0(Q,$);let K;if(!Array.isArray(U)||U.length===0)K=W;else K=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,J)+K+Z.substring(G)}catch(U){let K=U instanceof Error?U.message:String(U),z=J0("Forelse",`Error in @forelse(${Q} as ${w}): ${K}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function E4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function D4(X,$,Z,Y){let J=X;J=gJ(J,$);function G(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let K=U.index,z=U.index+U[0].length-1,_=1,B=z+1,j=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=q.substring(z+1,j),O=E4(H);if(!O)continue;let L=K,{arrayExpr:F,itemVar:V}=O,A=j+1,R=1,M=A,T=/@foreach\s*\(/g,N=/@endforeach/g;while(R>0&&M<q.length){T.lastIndex=M,N.lastIndex=M;let k=T.exec(q),D=N.exec(q);if(!D)break;if(k&&k.index<D.index)R++,M=k.index+k[0].length;else{if(R--,R===0){let I=q.substring(A,D.index),S=D.index+11;return{start:L,end:S,arrayExpr:F,itemVar:V,content:I}}M=D.index+11}}}return null}function Q(q,W){let U=q;while(!0){let K=G(U);if(!K)break;let{start:z,end:_,arrayExpr:B,itemVar:j,content:H}=K;try{let O=B.trim(),L;if(q0(O))L=W0(O,Object.keys(W))(...Object.values(W));else L=Q0(O,W);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=J0("Foreach",`Error in @foreach: ${O} is not iterable`,o.TYPE_ERROR);U=U.substring(0,z)+D+U.substring(_);continue}let V=Y?.loops?.useAltLoopVariable??g_,A=j.trim(),R=null,M,T=!1;if(A.includes("=>")){let D=A.split("=>").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])R=D[0],M=D[1];else M=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])M=D[0],R=D[1],T=!0;else M=A}else M=A;let N="",k=L;for(let D=0;D<k.length;D++){let I=k[D],S={index:D,iteration:D+1,first:D===0,last:D===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((i)=>i.trim());if(Array.isArray(I))f.forEach((i,c)=>{if(i)b[i]=I[c]});else b[M]=I}else b[M]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[M]=I[1];else b[R]=D;let y=m_(H,b),P=fJ(y);if(P.hasContinue){N+=P.content;continue}let x=xJ(y);if(x.hasBreak){N+=x.content;break}if(y=gJ(y,b),y=Q(y,b),y=T1(y,b,Z),y=l_(y),x=xJ(y),x.hasBreak){N+=x.content;break}if(P=fJ(y),P.hasContinue){N+=P.content;continue}y=v1(y,b,Z),y=d_(y,b),y=u_(y,b),y=h_(y,b),N+=y}U=U.substring(0,z)+N+U.substring(_)}catch(O){let L=J0("Foreach",`Error in @foreach(${B.trim()} as ${j.trim()}): ${O instanceof Error?O.message:String(O)}`,o.EVALUATION_ERROR);U=U.substring(0,z)+L+U.substring(_)}}return U}J=Q(J,$),J=dJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??f_;return J=n_(J,$,w),J}function uJ(X){return PX(X)}function dJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=y0(J,"(",")",q);if(W===-1)break;let U=J.slice(q+1,W),K=W+1,z=sX(J.slice(w),"for","endfor");if(z.length===0)break;let _=z[0].content,B=w+z[0].end;if(!uJ(U)){let j=J0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+j+J.substring(B),G=!0;continue}try{let j=p_(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(j.length>0&&H){let R=i_({forExpr:U,content:_,iterVarNames:j,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(B),G=!0;continue}let O=Object.keys($),L=Object.values($),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,M)=>{return`\${${M}}`});F=hJ(F);let A=Function(...O,`
3715
3715
  let result = '';
3716
3716
  for (${U}) {
3717
3717
  result += \`${F}\`;
3718
3718
  }
3719
3719
  return result;
3720
- `)(...L);J=J.substring(0,w)+A+J.substring(B),G=!0}catch(j){let H=Z0("For",`Error in @for(${U}): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(B),G=!0}}return J}function u_(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let z=q.slice(W+1).trim(),_=z.indexOf("=");return(_>=0?z.slice(0,_):z).trim()}let U=q.indexOf("="),K=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function d_(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,w=Object.keys(J),q=Object.values(J),W=Function(...w,"__pushIter",`
3720
+ `)(...L);J=J.substring(0,w)+A+J.substring(B),G=!0}catch(j){let H=J0("For",`Error in @for(${U}): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(B),G=!0}}return J}function p_(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let z=q.slice(W+1).trim(),_=z.indexOf("=");return(_>=0?z.slice(0,_):z).trim()}let U=q.indexOf("="),K=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function i_(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,w=Object.keys(J),q=Object.values(J),W=Function(...w,"__pushIter",`
3721
3721
  for (${$}) {
3722
3722
  __pushIter([${Y.join(", ")}])
3723
3723
  }
3724
- `),U=[];W(...q,(_)=>{U.push(_)});let K=G??"inline.stx",z="";for(let _ of U){let B={...J};Y.forEach((H,O)=>{B[H]=_[O]});let j=xJ(Z,B,G,Q);j=A1(j,B,K),j=S1(j,B,K),z+=j}return z}function m_(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,q=k0(Y,"(",")",w);if(q===-1)break;let W=Y.slice(w+1,q),U=cX(Y.slice(Q),"while","endwhile");if(U.length===0)break;let K=U[0].content,z=Q+U[0].end;if(!vJ(W)){let _=Z0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+_+Y.substring(z),J=!0;continue}try{let _=Object.keys($),B=Object.values($),j=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});j=PJ(j);let O=Function(..._,`
3724
+ `),U=[];W(...q,(_)=>{U.push(_)});let K=G??"inline.stx",z="";for(let _ of U){let B={...J};Y.forEach((H,O)=>{B[H]=_[O]});let j=dJ(Z,B,G,Q);j=T1(j,B,K),j=v1(j,B,K),z+=j}return z}function n_(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,q=y0(Y,"(",")",w);if(q===-1)break;let W=Y.slice(w+1,q),U=sX(Y.slice(Q),"while","endwhile");if(U.length===0)break;let K=U[0].content,z=Q+U[0].end;if(!uJ(W)){let _=J0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+_+Y.substring(z),J=!0;continue}try{let _=Object.keys($),B=Object.values($),j=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});j=hJ(j);let O=Function(..._,`
3725
3725
  let result = '';
3726
3726
  let maxIterations = ${Z}; // Configurable safety limit
3727
3727
  let counter = 0;
@@ -3733,21 +3733,21 @@ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function FJ(X,$){let Z=J0(X,$)??J0(
3733
3733
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3734
3734
  }
3735
3735
  return result;
3736
- `)(...B);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(_){let B=Z0("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0}}return Y}var S_=1000,C_=!1,K8="<!--__STX_BREAK__-->",z8="<!--__STX_CONTINUE__-->";var M4=E(()=>{u7();V1();w1();pX();A0()});import B0 from"path";function T4(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function l_(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")")q--;W++}if(q!==0)break;let U=Y.substring(w+1,W-1),K=`${Z}(${U})`;Y=Y.substring(0,Q)+K+Y.substring(W),J.lastIndex=Q+K.length,G=J.exec(Y)}return Y}function c_(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function hJ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w=(K)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===K){G++;return}G++}},q=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let K=1;while(G<Q&&K>0)if($[G]==="{")K++,G++;else if($[G]==="}")K--,G++;else if($[G]==="'"||$[G]==='"')w($[G]);else if($[G]==="`")q();else G++;continue}G++}},W=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
3737
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},U=()=>{if(J!==0)return;let K=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(G<Q){if(W())continue;if($[G]==="'"||$[G]==='"'){w($[G]);continue}if($[G]==="`"){q();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))U();G++}return Z.join(", ")}function uJ(X,$=""){let Z=hJ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
3736
+ `)(...B);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(_){let B=J0("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0}}return Y}var f_=1000,g_=!1,H8="<!--__STX_BREAK__-->",L8="<!--__STX_CONTINUE__-->";var y4=E(()=>{l7();M1();K1();oX();T0()});import j0 from"path";function b4(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function r_(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")")q--;W++}if(q!==0)break;let U=Y.substring(w+1,W-1),K=`${Z}(${U})`;Y=Y.substring(0,Q)+K+Y.substring(W),J.lastIndex=Q+K.length,G=J.exec(Y)}return Y}function s_(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function cJ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w=(K)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===K){G++;return}G++}},q=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let K=1;while(G<Q&&K>0)if($[G]==="{")K++,G++;else if($[G]==="}")K--,G++;else if($[G]==="'"||$[G]==='"')w($[G]);else if($[G]==="`")q();else G++;continue}G++}},W=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
3737
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},U=()=>{if(J!==0)return;let K=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(G<Q){if(W())continue;if($[G]==="'"||$[G]==='"'){w($[G]);continue}if($[G]==="`"){q();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))U();G++}return Z.join(", ")}function pJ(X,$=""){let Z=cJ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
3738
3738
  (function() {
3739
- ${k5("var",Z)}
3739
+ ${D5("var",Z)}
3740
3740
  var __destroyHooks = [];
3741
3741
  var __origOnDestroy = onDestroy;
3742
3742
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
3743
3743
 
3744
3744
  ${X}
3745
3745
  ${$}})();
3746
- `}function dJ(X,$){return`
3746
+ `}function iJ(X,$){return`
3747
3747
  // Register scope variables for STX runtime
3748
3748
  if (!window.stx._scopes) window.stx._scopes = {};
3749
3749
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3750
- ${hJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
3750
+ ${cJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
3751
3751
  `)}
3752
3752
  // #1767: when the bundler renamed a component const that collided with an
3753
3753
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3755,7 +3755,7 @@ ${hJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3755
3755
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3756
3756
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3757
3757
  window.stx._scopes['${$}'] = __scopeRegistration;
3758
- `}function p_(X,$){let Z=dJ(X,$),Y=`
3758
+ `}function o_(X,$){let Z=iJ(X,$),Y=`
3759
3759
  (function() {
3760
3760
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${$}"]') : null;
3761
3761
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -3764,93 +3764,93 @@ ${hJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3764
3764
  } finally {
3765
3765
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3766
3766
  }
3767
- })();`;return Y+uJ(X,Z)+`
3767
+ })();`;return Y+pJ(X,Z)+`
3768
3768
  } finally {
3769
3769
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3770
3770
  }
3771
- })();`}function i_(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function r_(X){if(X.__onceStore instanceof Set)return X.__onceStore;return n_}async function N4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||B0.join(B0.dirname(Z),"partials");if(Q&&!B0.isAbsolute(Q))Q=B0.resolve(process.cwd(),Q);let w=l_(X,"@partial","@include"),q=r_($);w=w.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let L=H.trim(),F=`${Z}:${L}`;if(q.has(F))return"";return q.add(F),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")")F--;V++}if(F!==0)break;let A=w.substring(L+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=V;continue}let M=R[1],T=W(M,Q,Z),k="";if(T&&await Bun.file(T).exists())J.add(T),k=`@include(${A})`;w=w.substring(0,O)+k+w.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=O.exec(w))!==null){let F=L.index,V=F+L[0].length-1,A=1,R=V+1;while(R<w.length&&A>0){if(w[R]==="(")A++;else if(w[R]===")")A--;R++}if(A!==0)break;let M=w.substring(V+1,R-1),T=T4(M,0);if(T===-1){O.lastIndex=R;continue}let k=M.substring(0,T).trim(),N=M.substring(T+1).trim(),D=N.match(/^\s*['"]([^'"]+)['"]/);if(!D){O.lastIndex=R;continue}let I=D[1],C=N.substring(D[0].length),b,y=T4(C,0);if(y!==-1)b=C.substring(y+1).trim();try{let v=`Boolean(${k})`,x;if(w0(v)){let p=q0(v,Object.keys($));x=Boolean(p(...Object.values($)))}else x=Boolean(J0(v,$));let g=H?!x:x,c="";if(g){let p=W(I,Q,Z);if(p&&await Bun.file(p).exists())J.add(p);c=`@include('${I}'${b?`, ${b}`:""})`}w=w.substring(0,F)+c+w.substring(R),O.lastIndex=0}catch(v){let x=v instanceof Error?v.message:String(v),g=z0("Include",`Error evaluating ${j} condition: ${x}`,Z,X,F);w=w.substring(0,F)+g+w.substring(R),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){j.lastIndex=0,w=w.replace(R,"");continue}let[,T,k,N,D]=M;try{let I,C=k.trim();if(w0(C))I=q0(C,Object.keys($))(...Object.values($));else I=J0(C,$);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let v={...$,[N]:y},x=await z(T,v,X,O);b+=x}else if(D)b=await z(D,{},X,O);w=w.substring(0,O)+b+w.substring(V+1),j.lastIndex=0}catch(I){let C=I instanceof Error?I.message:String(I);w=w.substring(0,O)+z0("Each",`Error in @each: ${C}`,Z,X,O)+w.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*(\[[^\]]+\])/);if(!M){j.lastIndex=0,w=w.replace(R,"");continue}let T=M[1],k=A.slice(M[0].length),N,D=k.match(/^\s*,\s*\{/);if(D){k=k.slice(D[0].length-1);let b=1,y=1;while(y<k.length&&b>0){if(k[y]==="{")b++;else if(k[y]==="}"){if(b--,b===0)break}y++}N=k.substring(0,y+1),k=k.slice(y+1)}let I,C=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(C)I=C[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(N)try{y=V0(N,$)}catch(x){let g=x instanceof Error?x.message:String(x);if(Y.debug){let c=z0("Include",`Error parsing includeFirst variables: ${g}`,Z,X,O,R);w=w.replace(R,()=>c)}else w=w.replace(R,()=>I||"");continue}let v=!1;for(let x of b){let g=W(x,Q,Z);if(!g)continue;if(await n(g)){let c=await z(x,y,X,O);w=w.replace(R,()=>c),v=!0;break}}if(!v)if(I!==void 0)w=w.replace(R,()=>I);else if(Y.debug){let x=z0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,O,R);w=w.replace(R,()=>x)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),v=z0("Include",`Error processing @includeFirst: ${y}`,Z,X,O,R);w=w.replace(R,()=>v)}j.lastIndex=0}}function W(j,H,O){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let F=B0.resolve(H),V=B0.resolve(B0.dirname(O)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=B0.resolve(H,L);else A=B0.resolve(V,L);let R=B0.normalize(A),M=R.startsWith(F+B0.sep)||R===F,T=R.startsWith(V+B0.sep)||R===V,k=!1,N=B0.dirname(V);if(R.startsWith(N+B0.sep)){if(!B0.relative(N,R).split(B0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))k=!0}if(!M&&!T&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let U=B0.resolve(Z);G.add(U);function K(j,H,O,L){return Y.onIncludeError?.({includePath:j,templatePath:Z,message:H,partialsDir:Q}),z0("Include",H,Z,O,L)}async function z(j,H={},O,L){let F=W(j,Q,Z);if(!F)return K(j,`Could not resolve path for include: ${j}`,O,L);let V=B0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>B0.basename(R)).join(" -> ");return K(j,`Circular include detected: ${A}`,O,L)}try{J.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(g){let c=g instanceof Error?g.message:String(g);return K(j,`Error loading include file ${j}: ${c}`,O,L)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (u9(),h9));A=g(A,$)}if(A&&(Y.debug||!f7()&&!gX()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (m9(),mY));g(A,F)}catch{}let R=A;try{let{processESImports:g}=await Promise.resolve().then(() => (L4(),BJ));await g(A,$,F,Y,J)}catch(g){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,g instanceof Error?g.message:g)}let M=h5(R);if(M)R=M.content.trim();let k=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),N="";if(k)N=`<style${k[1]}>${k[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...$};D.__stx_signals_gate=O1(A);for(let[g,c]of Object.entries(H))D[g]=c;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...A.matchAll(I)],b="",y=null;for(let g of C){let c=g[1]||"",p=g[2]||"",y0=c.includes("server"),b0=X5(c),i0="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:N0}=await Promise.resolve().then(() => (y5(),n2)),t0=$0(p,{filePath:F,projectRoot:process.cwd()});p=t0.code,i0=N0(t0.styles)}catch($0){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,$0 instanceof Error?$0.message:$0)}if(b0&&p.trim())p=$5(p);if(!y0)try{let{hasUserImports:$0,bundleClientScript:N0}=await Promise.resolve().then(() => (E7(),I7));if($0(p))p=await N0(p,F,{projectRoot:process.cwd()})}catch($0){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,$0 instanceof Error?$0.message:$0)}let K0=c_(p);if(K0&&!y0){y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++gJ}`;let $0=m0(p),N0=p_($0,y);b+=`${i0}<script data-stx-scoped data-stx-run="always">${N0}</script>
3772
- `;continue}if(y0)try{let{extractVariables:$0}=await Promise.resolve().then(() => (n5(),W8));await $0(p,D,F)}catch($0){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,$0)}if(!y0&&!K0){let $0=c.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++gJ}`;let N0=m0(p),t0=dJ(N0,y),k1=uJ(N0,t0);b+=`${i0}<script data-stx-scoped data-stx-run="always"${$0?` ${$0}`:""}>${k1}</script>
3773
- `}}if(y){let g=i_(R,y);if(R=g.html,g.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),y=g.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await N4(R,D,F,Y,J,G);let{processLoops:v}=await Promise.resolve().then(() => (M4(),fJ)),x=v(R,D,F);if(x=A1(x,D,F),x=S1(x,D,F),N)x+=`
3774
- `+N;if(b)x+=`
3775
- `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return K(j,`Error processing include ${j}: ${R}`,O,L)}}let _=/@include\s*\(/g,B;while((B=_.exec(w))!==null){let j=B.index,H=j+B[0].length-1,O=1,L=H+1;while(L<w.length&&O>0){if(w[L]==="(")O++;else if(w[L]===")")O--;L++}if(O!==0)break;let F=w.substring(j,L),V=w.substring(H+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=L;continue}let R=A[1],M,T=V.substring(A[0].length),k=T4(T,0);if(k!==-1)M=T.substring(k+1).trim();let N={};if(M)try{N=V0(M,$)}catch(I){let C=I instanceof Error?I.message:String(I);w=w.replace(F,z0("Include",`Error parsing include variables for ${R}: ${C}`,Z,X,j)),_.lastIndex=0;continue}let D=await z(R,N,X,j);w=w.substring(0,j)+D+w.substring(L),_.lastIndex=0}return w}function k4(X,$){let Z=X;function Y(J,G,Q,w){let q=J,W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),K=q.match(U);if(!K||K.index===void 0)break;let z=K.index,_=K[1],B=z+K[0].length,j=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=B,F=-1;while(O>0&&L<q.length){let A=q.slice(L),R=A.match(j),M=A.match(H),T=R?L+R.index:1/0,k=M?L+M.index:1/0;if(T<k)O++,L=T+(R[0].length||1);else if(k<1/0){if(O--,O===0){F=k;break}L=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(B,F);if(!$[_])$[_]=[];if(w)$[_].unshift(V);else $[_].push(V);q=q.substring(0,z)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function I4(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
3776
- `)})}var gJ=0,Gk,n_;var mJ=E(()=>{aX();u7();w1();X1();P5();A0();T0();Gk=new Y5(500),n_=new Set});import*as E4 from"path";async function lJ(X,$,Z=""){if(E4.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return pJ(X,$,Z,"@js","@endjs")}async function cJ(X,$,Z=""){if(E4.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return pJ(X,$,Z,"@ts","@endts")}async function pJ(X,$,Z,Y,J){let G=X,Q=C5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:K}of w)try{let z={...$,global:$},_=Object.keys(z),B=Object.values(z),j=U.trim();if(Y==="@ts")j=j.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 O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3771
+ })();`}function a_(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function e_(X){if(X.__onceStore instanceof Set)return X.__onceStore;return t_}async function S4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||j0.join(j0.dirname(Z),"partials");if(Q&&!j0.isAbsolute(Q))Q=j0.resolve(process.cwd(),Q);let w=r_(X,"@partial","@include"),q=e_($);w=w.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let L=H.trim(),F=`${Z}:${L}`;if(q.has(F))return"";return q.add(F),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")")F--;V++}if(F!==0)break;let A=w.substring(L+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=V;continue}let M=R[1],T=W(M,Q,Z),N="";if(T&&await Bun.file(T).exists())J.add(T),N=`@include(${A})`;w=w.substring(0,O)+N+w.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=O.exec(w))!==null){let F=L.index,V=F+L[0].length-1,A=1,R=V+1;while(R<w.length&&A>0){if(w[R]==="(")A++;else if(w[R]===")")A--;R++}if(A!==0)break;let M=w.substring(V+1,R-1),T=b4(M,0);if(T===-1){O.lastIndex=R;continue}let N=M.substring(0,T).trim(),k=M.substring(T+1).trim(),D=k.match(/^\s*['"]([^'"]+)['"]/);if(!D){O.lastIndex=R;continue}let I=D[1],S=k.substring(D[0].length),b,y=b4(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${N})`,x;if(q0(P)){let c=W0(P,Object.keys($));x=Boolean(c(...Object.values($)))}else x=Boolean(Q0(P,$));let f=H?!x:x,i="";if(f){let c=W(I,Q,Z);if(c&&await Bun.file(c).exists())J.add(c);i=`@include('${I}'${b?`, ${b}`:""})`}w=w.substring(0,F)+i+w.substring(R),O.lastIndex=0}catch(P){let x=P instanceof Error?P.message:String(P),f=_0("Include",`Error evaluating ${j} condition: ${x}`,Z,X,F);w=w.substring(0,F)+f+w.substring(R),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){j.lastIndex=0,w=w.replace(R,"");continue}let[,T,N,k,D]=M;try{let I,S=N.trim();if(q0(S))I=W0(S,Object.keys($))(...Object.values($));else I=Q0(S,$);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let P={...$,[k]:y},x=await z(T,P,X,O);b+=x}else if(D)b=await z(D,{},X,O);w=w.substring(0,O)+b+w.substring(V+1),j.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);w=w.substring(0,O)+_0("Each",`Error in @each: ${S}`,Z,X,O)+w.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(w))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(L+1,V),R=w.substring(O,V+1),M=A.match(/^\s*(\[[^\]]+\])/);if(!M){j.lastIndex=0,w=w.replace(R,"");continue}let T=M[1],N=A.slice(M[0].length),k,D=N.match(/^\s*,\s*\{/);if(D){N=N.slice(D[0].length-1);let b=1,y=1;while(y<N.length&&b>0){if(N[y]==="{")b++;else if(N[y]==="}"){if(b--,b===0)break}y++}k=N.substring(0,y+1),N=N.slice(y+1)}let I,S=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(k)try{y=M0(k,$)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let i=_0("Include",`Error parsing includeFirst variables: ${f}`,Z,X,O,R);w=w.replace(R,()=>i)}else w=w.replace(R,()=>I||"");continue}let P=!1;for(let x of b){let f=W(x,Q,Z);if(!f)continue;if(await n(f)){let i=await z(x,y,X,O);w=w.replace(R,()=>i),P=!0;break}}if(!P)if(I!==void 0)w=w.replace(R,()=>I);else if(Y.debug){let x=_0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,O,R);w=w.replace(R,()=>x)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=_0("Include",`Error processing @includeFirst: ${y}`,Z,X,O,R);w=w.replace(R,()=>P)}j.lastIndex=0}}function W(j,H,O){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let F=j0.resolve(H),V=j0.resolve(j0.dirname(O)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=j0.resolve(H,L);else A=j0.resolve(V,L);let R=j0.normalize(A),M=R.startsWith(F+j0.sep)||R===F,T=R.startsWith(V+j0.sep)||R===V,N=!1,k=j0.dirname(V);if(R.startsWith(k+j0.sep)){if(!j0.relative(k,R).split(j0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))N=!0}if(!M&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let U=j0.resolve(Z);G.add(U);function K(j,H,O,L){return Y.onIncludeError?.({includePath:j,templatePath:Z,message:H,partialsDir:Q}),_0("Include",H,Z,O,L)}async function z(j,H={},O,L){let F=W(j,Q,Z);if(!F)return K(j,`Could not resolve path for include: ${j}`,O,L);let V=j0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>j0.basename(R)).join(" -> ");return K(j,`Circular include detected: ${A}`,O,L)}try{J.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let i=f instanceof Error?f.message:String(f);return K(j,`Error loading include file ${j}: ${i}`,O,L)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (n9(),i9));A=f(A,$)}if(A&&(Y.debug||!u7()&&!lX()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (s9(),nY));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (T4(),OJ));await f(A,$,F,Y,J)}catch(f){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let M=l5(R);if(M)R=M.content.trim();let N=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(N)k=`<style${N[1]}>${N[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...$};D.__stx_signals_gate=A1(A);for(let[f,i]of Object.entries(H))D[f]=i;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",y=null;for(let f of S){let i=f[1]||"",c=f[2]||"",I0=i.includes("server"),f0=Q5(i),g0="";try{let{extractAndStripCssImports:r,renderVendorStyleTags:D0}=await Promise.resolve().then(() => (C5(),t2)),z0=r(c,{filePath:F,projectRoot:process.cwd()});c=z0.code,g0=D0(z0.styles)}catch(r){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,r instanceof Error?r.message:r)}if(f0&&c.trim())c=w5(c);if(!I0)try{let{hasUserImports:r,bundleClientScript:D0}=await Promise.resolve().then(() => (S7(),b7));if(r(c))c=await D0(c,F,{projectRoot:process.cwd()})}catch(r){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,r instanceof Error?r.message:r)}let X1=s_(c);if(X1&&!I0){y=`stx_scope_${j0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++lJ}`;let r=i0(c),D0=o_(r,y);b+=`${g0}<script data-stx-scoped data-stx-run="always">${D0}</script>
3772
+ `;continue}if(I0)try{let{extractVariables:r}=await Promise.resolve().then(() => (a5(),_8));await r(c,D,F)}catch(r){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,r)}if(!I0&&!X1){let r=i.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++lJ}`;let D0=i0(c),z0=iJ(D0,y),o1=pJ(D0,z0);b+=`${g0}<script data-stx-scoped data-stx-run="always"${r?` ${r}`:""}>${o1}</script>
3773
+ `}}if(y){let f=a_(R,y);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),y=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await S4(R,D,F,Y,J,G);let{processLoops:P}=await Promise.resolve().then(() => (y4(),mJ)),x=P(R,D,F);if(x=T1(x,D,F),x=v1(x,D,F),k)x+=`
3774
+ `+k;if(b)x+=`
3775
+ `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return K(j,`Error processing include ${j}: ${R}`,O,L)}}let _=/@include\s*\(/g,B;while((B=_.exec(w))!==null){let j=B.index,H=j+B[0].length-1,O=1,L=H+1;while(L<w.length&&O>0){if(w[L]==="(")O++;else if(w[L]===")")O--;L++}if(O!==0)break;let F=w.substring(j,L),V=w.substring(H+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=L;continue}let R=A[1],M,T=V.substring(A[0].length),N=b4(T,0);if(N!==-1)M=T.substring(N+1).trim();let k={};if(M)try{k=M0(M,$)}catch(I){let S=I instanceof Error?I.message:String(I);w=w.replace(F,_0("Include",`Error parsing include variables for ${R}: ${S}`,Z,X,j)),_.lastIndex=0;continue}let D=await z(R,k,X,j);w=w.substring(0,j)+D+w.substring(L),_.lastIndex=0}return w}function C4(X,$){let Z=X;function Y(J,G,Q,w){let q=J,W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),K=q.match(U);if(!K||K.index===void 0)break;let z=K.index,_=K[1],B=z+K[0].length,j=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=B,F=-1;while(O>0&&L<q.length){let A=q.slice(L),R=A.match(j),M=A.match(H),T=R?L+R.index:1/0,N=M?L+M.index:1/0;if(T<N)O++,L=T+(R[0].length||1);else if(N<1/0){if(O--,O===0){F=N;break}L=N+Q.length+1}else break}if(F===-1)break;let V=q.slice(B,F);if(!$[_])$[_]=[];if(w)$[_].unshift(V);else $[_].push(V);q=q.substring(0,z)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function P4(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
3776
+ `)})}var lJ=0,Kk,t_;var nJ=E(()=>{Z8();l7();K1();Z1();g5();T0();L0();Kk=new q5(500),t_=new Set});import*as v4 from"path";async function rJ(X,$,Z=""){if(v4.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return oJ(X,$,Z,"@js","@endjs")}async function sJ(X,$,Z=""){if(v4.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return oJ(X,$,Z,"@ts","@endts")}async function oJ(X,$,Z,Y,J){let G=X,Q=f5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:K}of w)try{let z={...$,global:$},_=Object.keys(z),B=Object.values(z),j=U.trim();if(Y==="@ts")j=j.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 O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3777
3777
  ${j}
3778
3778
  ${L}
3779
- `,A=Function(..._,F)(...B);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(W,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let _=z instanceof Error?z.message:String(z),B=z0(`${Y} Directive`,`Error executing code: ${_}`,Z,X,K,W);console.error(B),G=G.replace(W,"")}return G}var iJ=E(()=>{P5();T0()});function s_(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function nJ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return s_(Y,G||"_method")})}async function rJ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,$,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=z0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
3780
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${$1(W)}</div>
3781
- `)}}}return G}async function sJ(X,$,Z,Y){return rJ(X,$,Z,Y,"before")}async function oJ(X,$,Z,Y){return rJ(X,$,Z,Y,"after")}var aJ=E(()=>{w1();T0()});function tJ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?V0(J,{}):{};return O7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var eJ=E(()=>{r1();r1();A0()});function XG(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),K=q,z=U.length>1?U[1]:"";if(z&&$[z])W=$[z];else if(K.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])W=$.openGraph[U[1]];else W="";return W?`<meta property="${i(K)}" content="${i(W)}">`:""}return W?`<meta name="${i(q)}" content="${i(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let K=J.substring(q+1,U).trim(),z=U+1,_=(()=>{try{let B=V0(K,$);if(!B)return"";let j="<meta";if(B.name)j+=` name="${i(String(B.name))}"`;if(B.property)j+=` property="${i(String(B.property))}"`;if(B.httpEquiv)j+=` http-equiv="${i(String(B.httpEquiv))}"`;if(B.content)j+=` content="${i(String(B.content))}"`;return j+=">",j}catch(B){let j=B instanceof Error?B.message:String(B);return Z0("MetaTag",j,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+_+J.substring(z),G.lastIndex=0}return J}function $G(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=Y.substring(w+1,W).trim(),K=W+1,z=(()=>{try{let _=V0(U,$);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return Z0("StructuredData",B,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=0}return Y}function ZG(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,U=null,K=!1;while(W<J.length&&q>0){let O=J[W];if(K){K=!1,W++;continue}if(O==="\\"&&U){K=!0,W++;continue}if(U){if(O===U)U=null;W++;continue}if(O==='"'||O==="'"||O==="`"){U=O,W++;continue}if(O==="{")q++;else if(O==="}")q--;W++}if(q!==0)break;let z=J.substring(W).match(/^\s*\)/);if(!z)break;let _=W+z[0].length,B=J.substring(w,W),j=J.substring(Q.index,_),H=((O)=>{try{let L=V0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${i(L.title)}</title>
3782
- `,F+=`<meta name="title" content="${i(L.title)}">
3783
- `;if(L.description)F+=`<meta name="description" content="${i(L.description)}">
3784
- `;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${i(V)}">
3785
- `}if(L.robots)F+=`<meta name="robots" content="${i(L.robots)}">
3786
- `;if(L.canonical)F+=`<link rel="canonical" href="${i(L.canonical)}">
3787
- `;if(L.openGraph){let V=L.openGraph;if(F+=`<meta property="og:type" content="${i(V.type||"website")}">
3788
- `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta property="og:title" content="${i(A)}">
3789
- `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta property="og:description" content="${i(A)}">
3790
- `}if(V.url||L.canonical){let A=V.url||L.canonical||"";F+=`<meta property="og:url" content="${i(A)}">
3791
- `}if(V.image){if(F+=`<meta property="og:image" content="${i(V.image)}">
3792
- `,V.imageAlt)F+=`<meta property="og:image:alt" content="${i(V.imageAlt)}">
3793
- `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${i(String(V.imageWidth))}">
3794
- `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${i(String(V.imageHeight))}">
3795
- `}if(V.siteName)F+=`<meta property="og:site_name" content="${i(V.siteName)}">
3796
- `}if(L.twitter){let V=L.twitter;if(F+=`<meta name="twitter:card" content="${i(V.card||"summary_large_image")}">
3797
- `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta name="twitter:title" content="${i(A)}">
3798
- `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta name="twitter:description" content="${i(A)}">
3799
- `}if(V.image||L.openGraph&&L.openGraph.image){let A=V.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${i(A)}">
3800
- `}if(V.site)F+=`<meta name="twitter:site" content="${i(V.site)}">
3801
- `;if(V.creator)F+=`<meta name="twitter:creator" content="${i(V.creator)}">
3779
+ `,A=Function(..._,F)(...B);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(W,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let _=z instanceof Error?z.message:String(z),B=_0(`${Y} Directive`,`Error executing code: ${_}`,Z,X,K,W);console.error(B),G=G.replace(W,"")}return G}var aJ=E(()=>{g5();L0()});function Xj(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function tJ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return Xj(Y,G||"_method")})}async function eJ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,$,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=_0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
3780
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${Y1(W)}</div>
3781
+ `)}}}return G}async function XG(X,$,Z,Y){return eJ(X,$,Z,Y,"before")}async function $G(X,$,Z,Y){return eJ(X,$,Z,Y,"after")}var ZG=E(()=>{K1();L0()});function YG(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?M0(J,{}):{};return R7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var JG=E(()=>{X5();X5();T0()});function GG(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),K=q,z=U.length>1?U[1]:"";if(z&&$[z])W=$[z];else if(K.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])W=$.openGraph[U[1]];else W="";return W?`<meta property="${p(K)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let K=J.substring(q+1,U).trim(),z=U+1,_=(()=>{try{let B=M0(K,$);if(!B)return"";let j="<meta";if(B.name)j+=` name="${p(String(B.name))}"`;if(B.property)j+=` property="${p(String(B.property))}"`;if(B.httpEquiv)j+=` http-equiv="${p(String(B.httpEquiv))}"`;if(B.content)j+=` content="${p(String(B.content))}"`;return j+=">",j}catch(B){let j=B instanceof Error?B.message:String(B);return J0("MetaTag",j,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+_+J.substring(z),G.lastIndex=0}return J}function QG(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=Y.substring(w+1,W).trim(),K=W+1,z=(()=>{try{let _=M0(U,$);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return J0("StructuredData",B,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=0}return Y}function wG(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,U=null,K=!1;while(W<J.length&&q>0){let O=J[W];if(K){K=!1,W++;continue}if(O==="\\"&&U){K=!0,W++;continue}if(U){if(O===U)U=null;W++;continue}if(O==='"'||O==="'"||O==="`"){U=O,W++;continue}if(O==="{")q++;else if(O==="}")q--;W++}if(q!==0)break;let z=J.substring(W).match(/^\s*\)/);if(!z)break;let _=W+z[0].length,B=J.substring(w,W),j=J.substring(Q.index,_),H=((O)=>{try{let L=M0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${p(L.title)}</title>
3782
+ `,F+=`<meta name="title" content="${p(L.title)}">
3783
+ `;if(L.description)F+=`<meta name="description" content="${p(L.description)}">
3784
+ `;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${p(V)}">
3785
+ `}if(L.robots)F+=`<meta name="robots" content="${p(L.robots)}">
3786
+ `;if(L.canonical)F+=`<link rel="canonical" href="${p(L.canonical)}">
3787
+ `;if(L.openGraph){let V=L.openGraph;if(F+=`<meta property="og:type" content="${p(V.type||"website")}">
3788
+ `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta property="og:title" content="${p(A)}">
3789
+ `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta property="og:description" content="${p(A)}">
3790
+ `}if(V.url||L.canonical){let A=V.url||L.canonical||"";F+=`<meta property="og:url" content="${p(A)}">
3791
+ `}if(V.image){if(F+=`<meta property="og:image" content="${p(V.image)}">
3792
+ `,V.imageAlt)F+=`<meta property="og:image:alt" content="${p(V.imageAlt)}">
3793
+ `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${p(String(V.imageWidth))}">
3794
+ `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${p(String(V.imageHeight))}">
3795
+ `}if(V.siteName)F+=`<meta property="og:site_name" content="${p(V.siteName)}">
3796
+ `}if(L.twitter){let V=L.twitter;if(F+=`<meta name="twitter:card" content="${p(V.card||"summary_large_image")}">
3797
+ `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta name="twitter:title" content="${p(A)}">
3798
+ `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta name="twitter:description" content="${p(A)}">
3799
+ `}if(V.image||L.openGraph&&L.openGraph.image){let A=V.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${p(A)}">
3800
+ `}if(V.site)F+=`<meta name="twitter:site" content="${p(V.site)}">
3801
+ `;if(V.creator)F+=`<meta name="twitter:creator" content="${p(V.creator)}">
3802
3802
  `}if(L.structuredData){let V=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
3803
- `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return Z0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(B);J=J.substring(0,Q.index)+H+J.substring(_),G.lastIndex=Q.index+H.length}return J}function YG(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((K)=>K.property==="og:title"||K.name==="og:title"||K.name==="twitter:title"||K.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let w="";if($.description)w=$.description;else if($.meta&&$.meta.description)w=$.meta.description;else if(Z.seo?.defaultConfig?.description)w=Z.seo.defaultConfig.description;else w=Z.defaultDescription||"A website built with stx templating engine";let q="";if($.image)q=$.image;else if($.meta&&$.meta.image)q=$.meta.image;else if($.openGraph&&$.openGraph.image)q=$.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
3803
+ `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(B);J=J.substring(0,Q.index)+H+J.substring(_),G.lastIndex=Q.index+H.length}return J}function qG(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((K)=>K.property==="og:title"||K.name==="og:title"||K.name==="twitter:title"||K.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let w="";if($.description)w=$.description;else if($.meta&&$.meta.description)w=$.meta.description;else if(Z.seo?.defaultConfig?.description)w=Z.seo.defaultConfig.description;else w=Z.defaultDescription||"A website built with stx templating engine";let q="";if($.image)q=$.image;else if($.meta&&$.meta.image)q=$.meta.image;else if($.openGraph&&$.openGraph.image)q=$.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
3804
3804
  <!-- stx SEO Tags -->
3805
- <meta name="title" content="${i(Q)}">
3806
- <meta name="description" content="${i(w)}">
3807
- <meta property="og:title" content="${i(Q)}">
3808
- <meta property="og:description" content="${i(w)}">
3805
+ <meta name="title" content="${p(Q)}">
3806
+ <meta name="description" content="${p(w)}">
3807
+ <meta property="og:title" content="${p(Q)}">
3808
+ <meta property="og:description" content="${p(w)}">
3809
3809
  <meta property="og:type" content="website">
3810
3810
  <meta name="twitter:card" content="summary_large_image">
3811
- <meta name="twitter:title" content="${i(Q)}">
3812
- <meta name="twitter:description" content="${i(w)}">
3811
+ <meta name="twitter:title" content="${p(Q)}">
3812
+ <meta name="twitter:description" content="${p(w)}">
3813
3813
  `;if(q)W+=`
3814
- <meta property="og:image" content="${i(q)}">
3815
- <meta name="twitter:image" content="${i(q)}">
3814
+ <meta property="og:image" content="${p(q)}">
3815
+ <meta name="twitter:image" content="${p(q)}">
3816
3816
  `;let U=X;if(!G)U=U.replace(/<head[^>]*>/,`$&
3817
- <title>${i(Q)}</title>`);return U.replace(/<head[^>]*>/,`$&
3817
+ <title>${p(Q)}</title>`);return U.replace(/<head[^>]*>/,`$&
3818
3818
  ${W}
3819
- `)}function i(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var JG,GG;var D4=E(()=>{V1();A0();JG={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${i(J)}" content="${i(G)}">`},hasEndTag:!1},GG={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return Z0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function QG(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(a7.exact[X])for(let Y of a7.exact[X])await Promise.resolve(Y($,X));if(a7.exact[Z])for(let Y of a7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of a7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var a7;var wG=E(()=>{a7={patterns:[],exact:{}}});function t_(X){let $=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let G=Y.index,Q=G+Y[0].length,w=Y[1].toLowerCase();if(Y[0].endsWith("/>")||a_.has(w)){$.push([G,Q]);continue}let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=Q;let U=1,K=Q,z;while((z=W.exec(X))!==null)if(z[0].startsWith("</")){if(U--,U===0){K=z.index+z[0].length;break}}else if(!z[0].endsWith("/>"))U++;$.push([G,K])}return $}function qG(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>qG($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function WG(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);J.push(...t_(X));function Q(W){return J.some(([U,K])=>W>=U&&W<K)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],U=G[2];if(!U||!U.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,_=U,B=!1;while((z=K.exec(U))!==null){let j=z[1],H=z[2];if(O2(j))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(j==="class"){let R=qG(A);if(R){let M=_.match(/\sclass="([^"]*)"/);if(M)_=_.replace(M[0],` class="${M[1]} ${R}"`);else _=_.replace(z[0],` class="${R}"`)}else _=_.replace(z[0],"");B=!0;continue}if(o_.has(j)){if(A)_=_.replace(z[0],` ${j}`);else _=_.replace(z[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(z[0],` ${j}="${R}"`)}B=!0}catch{continue}}if(B){let j=W.endsWith("/>")?" /":"",O=`<${G[1]}${_}${j}>`;q.push({start:G.index,end:G.index+W.length,replacement:O})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:K,replacement:z}=q[W];Z=Z.slice(0,U)+z+Z.slice(K)}return Z}var o_,a_;var UG=E(()=>{X1();o_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),a_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function K5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&e_.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function $j(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec(X),q=Q.exec(X);if(!q)return-1;if(w&&w.index<q.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function W1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=$j(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function KG(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function r5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function h1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function u1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function Zj(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function Yj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=r5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];q=`${w} as ${L} => ${O}`}else q=`${w} as ${Q}`;let W=h1(Y.attrs,"v-for"),U=h1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=W1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=u1(z,{...Y,start:0,end:Y.end-Y.start},U),B=`@foreach(${q})
3819
+ `)}function p(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var WG,UG;var x4=E(()=>{M1();T0();WG={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return J0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${p(J)}" content="${p(G)}">`},hasEndTag:!1},UG={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return J0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return J0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function KG(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(XX.exact[X])for(let Y of XX.exact[X])await Promise.resolve(Y($,X));if(XX.exact[Z])for(let Y of XX.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of XX.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var XX;var zG=E(()=>{XX={patterns:[],exact:{}}});function Yj(X){let $=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let G=Y.index,Q=G+Y[0].length,w=Y[1].toLowerCase();if(Y[0].endsWith("/>")||Zj.has(w)){$.push([G,Q]);continue}let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=Q;let U=1,K=Q,z;while((z=W.exec(X))!==null)if(z[0].startsWith("</")){if(U--,U===0){K=z.index+z[0].length;break}}else if(!z[0].endsWith("/>"))U++;$.push([G,K])}return $}function BG(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>BG($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function _G(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);J.push(...Yj(X));function Q(W){return J.some(([U,K])=>W>=U&&W<K)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],U=G[2];if(!U||!U.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,_=U,B=!1;while((z=K.exec(U))!==null){let j=z[1],H=z[2];if(N2(j))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(j==="class"){let R=BG(A);if(R){let M=_.match(/\sclass="([^"]*)"/);if(M)_=_.replace(M[0],` class="${M[1]} ${R}"`);else _=_.replace(z[0],` class="${R}"`)}else _=_.replace(z[0],"");B=!0;continue}if($j.has(j)){if(A)_=_.replace(z[0],` ${j}`);else _=_.replace(z[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(z[0],` ${j}="${R}"`)}B=!0}catch{continue}}if(B){let j=W.endsWith("/>")?" /":"",O=`<${G[1]}${_}${j}>`;q.push({start:G.index,end:G.index+W.length,replacement:O})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:K,replacement:z}=q[W];Z=Z.slice(0,U)+z+Z.slice(K)}return Z}var $j,Zj;var jG=E(()=>{Z1();$j=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Zj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function H5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&Jj.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function Qj(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec(X),q=Q.exec(X);if(!q)return-1;if(w&&w.index<q.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function B1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=Qj(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function HG(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function t5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function m1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function l1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function wj(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function qj(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];q=`${w} as ${L} => ${O}`}else q=`${w} as ${Q}`;let W=m1(Y.attrs,"v-for"),U=m1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=B1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=l1(z,{...Y,start:0,end:Y.end-Y.start},U),B=`@foreach(${q})
3820
3820
  `,j=`${B}${_}
3821
- @endforeach`;$=$.slice(0,K.outerStart)+j+$.slice(K.outerEnd),Z=K.outerStart+B.length}return $}function Jj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=r5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=W1($,Y),w=h1(Y.attrs,"v-if"),q=u1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:Y});let W=Q.outerEnd,U=!0;while(U){let j=$.slice(W).match(/^\s*/),H=j?j[0].length:0,O=K5($,W+H);if(!O){U=!1;break}let L=r5(O.attrs,"v-else-if"),F=KG(O.attrs,"v-else");if(L!==null){let V=W1($,O),A=h1(O.attrs,"v-else-if"),R=u1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),W=V.outerEnd}else if(F){let V=W1($,O),A=h1(O.attrs,"v-else"),R=u1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),U=!1}else U=!1}let K=[];for(let j of G)if(j.type==="if")K.push(`@if(${j.expr})
3821
+ @endforeach`;$=$.slice(0,K.outerStart)+j+$.slice(K.outerEnd),Z=K.outerStart+B.length}return $}function Wj(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=B1($,Y),w=m1(Y.attrs,"v-if"),q=l1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:Y});let W=Q.outerEnd,U=!0;while(U){let j=$.slice(W).match(/^\s*/),H=j?j[0].length:0,O=H5($,W+H);if(!O){U=!1;break}let L=t5(O.attrs,"v-else-if"),F=HG(O.attrs,"v-else");if(L!==null){let V=B1($,O),A=m1(O.attrs,"v-else-if"),R=l1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),W=V.outerEnd}else if(F){let V=B1($,O),A=m1(O.attrs,"v-else"),R=l1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),U=!1}else U=!1}let K=[];for(let j of G)if(j.type==="if")K.push(`@if(${j.expr})
3822
3822
  ${j.element}`);else if(j.type==="else-if")K.push(`@elseif(${j.expr})
3823
3823
  ${j.element}`);else K.push(`@else
3824
3824
  ${j.element}`);K.push("@endif");let z=K.join(`
3825
- `),_=G[0].outerStart,B=G[G.length-1].outerEnd;$=$.slice(0,_)+z+$.slice(B),Z=_+z.length}return $}function Gj(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Qj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let U=w[1],K=w[2],z=w[3];J=J.replace(w[0],""),J+=` :${U}="${z}" @update:${U}="${z} = $event"`,w=J.match(Q)}if(G){let U=W1($,Y),K=$.slice(U.outerStart,U.outerEnd),z=u1(K,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,U.outerStart)+z+$.slice(U.outerEnd),Z=U.outerStart+z.length;continue}let q=r5(Y.attrs,"v-model");if(q===null){Z=Y.end;continue}if(Xj.has(Y.tag)){let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,K=W1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=u1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+_.length}else{let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let K=W1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=u1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+_.length}}return $}function wj(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function qj(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Wj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=r5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=W1($,Y),Q=h1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function Uj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=r5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=W1($,Y),Q=h1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function Kj(X){return X.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 zj(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;if(!KG(Y.attrs,"v-once")){Z=Y.end;continue}let J=h1(Y.attrs,"v-once"),G=W1($,Y),Q=$.slice(G.outerStart,G.outerEnd),q=`@once
3826
- ${u1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
3827
- @endonce`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function Bj(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function _j(X){return X.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 zG(X){if(!Zj(X))return X;let $=X;return $=Yj($),$=Jj($),$=zj($),$=wj($),$=qj($),$=Qj($),$=Gj($),$=_j($),$=Wj($),$=Uj($),$=Kj($),$=Bj($),$}var e_,Xj;var BG=E(()=>{e_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Xj=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 B8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _G(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=J0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return y4.has(G)?G:null}function jG(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function HG(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(jj.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function LG(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=_G(U.expr,$);if(!K||typeof K!=="string"){let L=`<!-- dynamic component: could not resolve "${B8(jG(U.expr))}" -->`;G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}if(y4.has(K)){let L=HG(K,U.attrs,U.slotContent);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}let z=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,j;while((j=B.exec(z))!==null){let L=j[1]||j[2],F=j[3];if(j[1])try{_[L]=J0(F,$)}catch{_[L]=F}else _[L]=F}let H=Y.componentsDir||"components",O=await U5(K,_,U.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),_=`<!-- dynamic component error: ${B8(z)} -->`;G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}}return G=await Hj(G,$,Z,Y,J),G}async function Hj(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=_G(U.expr,$);if(!K||typeof K!=="string"){let B=`<!-- dynamic component: could not resolve "${B8(jG(U.expr))}" -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}if(y4.has(K)){let B=HG(K,U.attrs,"");G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}let z=Y.componentsDir||"components",_=await U5(K,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),_=`<!-- dynamic component error: ${B8(z)} -->`;G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}}return G}var y4,jj;var OG=E(()=>{T0();A0();y4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),jj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function FG(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function VG(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let w=b4(X),q=[],W=new Map;if(G)for(let U of w){let K=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let z=K[1],_=`${$}_${z}`;W.set(z,_)}}for(let U of w){let K=AG(U,$,Y,J,W,Q);q.push(K)}return q.join(`
3825
+ `),_=G[0].outerStart,B=G[G.length-1].outerEnd;$=$.slice(0,_)+z+$.slice(B),Z=_+z.length}return $}function Uj(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Kj(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let U=w[1],K=w[2],z=w[3];J=J.replace(w[0],""),J+=` :${U}="${z}" @update:${U}="${z} = $event"`,w=J.match(Q)}if(G){let U=B1($,Y),K=$.slice(U.outerStart,U.outerEnd),z=l1(K,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,U.outerStart)+z+$.slice(U.outerEnd),Z=U.outerStart+z.length;continue}let q=t5(Y.attrs,"v-model");if(q===null){Z=Y.end;continue}if(Gj.has(Y.tag)){let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,K=B1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=l1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+_.length}else{let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let K=B1($,Y),z=$.slice(K.outerStart,K.outerEnd),_=l1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+_+$.slice(K.outerEnd),Z=K.outerStart+_.length}}return $}function zj(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Bj(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function _j(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=B1($,Y),Q=m1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function jj(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;let J=t5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=B1($,Y),Q=m1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function Hj(X){return X.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 Lj(X){let $=X,Z=0;while(Z<$.length){let Y=H5($,Z);if(!Y)break;if(!HG(Y.attrs,"v-once")){Z=Y.end;continue}let J=m1(Y.attrs,"v-once"),G=B1($,Y),Q=$.slice(G.outerStart,G.outerEnd),q=`@once
3826
+ ${l1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
3827
+ @endonce`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function Oj(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fj(X){return X.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 LG(X){if(!wj(X))return X;let $=X;return $=qj($),$=Wj($),$=Lj($),$=zj($),$=Bj($),$=Kj($),$=Uj($),$=Fj($),$=_j($),$=jj($),$=Hj($),$=Oj($),$}var Jj,Gj;var OG=E(()=>{Jj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Gj=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 O8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FG(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=Q0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return f4.has(G)?G:null}function VG(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function AG(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(Vj.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function RG(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=FG(U.expr,$);if(!K||typeof K!=="string"){let L=`<!-- dynamic component: could not resolve "${O8(VG(U.expr))}" -->`;G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}if(f4.has(K)){let L=AG(K,U.attrs,U.slotContent);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}let z=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,j;while((j=B.exec(z))!==null){let L=j[1]||j[2],F=j[3];if(j[1])try{_[L]=Q0(F,$)}catch{_[L]=F}else _[L]=F}let H=Y.componentsDir||"components",O=await j5(K,_,U.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),_=`<!-- dynamic component error: ${O8(z)} -->`;G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}}return G=await Aj(G,$,Z,Y,J),G}async function Aj(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=FG(U.expr,$);if(!K||typeof K!=="string"){let B=`<!-- dynamic component: could not resolve "${O8(VG(U.expr))}" -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}if(f4.has(K)){let B=AG(K,U.attrs,"");G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length);continue}let z=Y.componentsDir||"components",_=await j5(K,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),_=`<!-- dynamic component error: ${O8(z)} -->`;G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length)}}return G}var f4,Vj;var MG=E(()=>{L0();T0();f4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Vj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function TG(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function NG(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let w=g4(X),q=[],W=new Map;if(G)for(let U of w){let K=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let z=K[1],_=`${$}_${z}`;W.set(z,_)}}for(let U of w){let K=kG(U,$,Y,J,W,Q);q.push(K)}return q.join(`
3828
3828
 
3829
- `)}function b4(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&Y===0)G=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,K,z]=W;if(U==="keyframes")$.push({selector:`@keyframes ${K.trim()}`,declarations:z.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=b4(z);$.push({selector:`@${U} ${K.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
3830
- `)})}else $.push({selector:`@${U} ${K.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)$.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return $}function AG(X,$,Z,Y,J,G){let{selector:Q,declarations:w}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let U=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(U)||U} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let K=b4(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>AG(z,$,Z,Y,J,G)).join(`
3829
+ `)}function g4(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&Y===0)G=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,K,z]=W;if(U==="keyframes")$.push({selector:`@keyframes ${K.trim()}`,declarations:z.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=g4(z);$.push({selector:`@${U} ${K.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
3830
+ `)})}else $.push({selector:`@${U} ${K.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)$.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return $}function kG(X,$,Z,Y,J,G){let{selector:Q,declarations:w}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let U=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(U)||U} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let K=g4(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>kG(z,$,Z,Y,J,G)).join(`
3831
3831
  `);return`${Q} {
3832
3832
  ${K}
3833
- }`}return`${Q} { ${w} }`}let q=Lj(Q,$,Z,Y),W=w;for(let[U,K]of J)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),K);if(G)W=W.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${q} { ${W} }`}function Lj(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let q=Oj(Q,$);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function Oj(X,$){let Z=0,Y=X.length;for(let q=0;q<X.length;q++){let W=X[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){Y=q;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function MG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function _8(X,$){if(!Fj.test(X))return{html:X,hasScoped:!1};let Z=FG($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${S4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,q,W)=>{Q=!0;let U=Vj(W,Y),K=q.replace(new RegExp(S4,"gi"),"").trim(),z=K?` ${K}`:"";return`<style data-stx-scoped="${Z}"${z}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=Rj(J,Y),{html:J,hasScoped:!0}}function Vj(X,$){return VG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function Rj(X,$){let Z=Q1(X,(J,G)=>{let Q=y1(J,G);return Q>G?Q:b5(J,G)},(J,G)=>Aj(G)),Y=Mj(Z.output,$);return RG.lastIndex=0,Y.replace(RG,(J,G)=>Z.tokens[Number(G)])}function Mj(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var S4,Fj,Aj=(X)=>`\x00stx-scope-mask-${X}\x00`,RG;var C4=E(()=>{Z5();S4=String.raw`(?<![\w-])scoped(?![\w-])`,Fj=new RegExp(`<style\\s+[^>]*${S4}`,"i");RG=/\u0000stx-scope-mask-(\d+)\u0000/g});function Ej(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Tj.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!Ij.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!kj.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!Nj.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function Dj(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function v4(X={}){let $=Ej(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Dj($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function TG(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=P4(X);if(Z===null)return X;let Y=v4($);return`${X.slice(0,Z)}
3834
- ${Y}${X.slice(Z)}`}function P4(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function Sj(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=bj.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
3835
- ${G[0]}`+Q+X.slice(Z+J.length)}function NG(X){return Cj(Sj(X))}function Cj(X){let $=yj.exec(X);if(!$)return X;let Z=P4(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=P4(Y);if(J===null)return X;return`${Y.slice(0,J)}
3836
- ${$[0]}${Y.slice(J)}`}var Tj,Nj,kj,Ij,yj,bj;var x4=E(()=>{Tj=new Set(["light","dark","auto","system"]),Nj=new Set(["auto","system"]),kj=/^[a-z][\w:-]*$/i,Ij=/^[\w-]+$/;yj=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),bj=/<meta\b[^>]*\bcharset\b[^>]*>/i});function Pj(){if(f4===null)f4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return f4}function kG(X,$=Pj()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
3837
- <meta name="stx-build" content="${$}">${X.slice(Y)}`}var f4=null;function T1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vj(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g4(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function s5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${T1(String(Y))}"`).join(" ")}function xj(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[w,q]of Object.entries(X||{})){if(q==null)continue;let W=w.trim();if(!EG.test(W))continue;let U=W.toLowerCase();if(U==="lang"){G=String(q);continue}if(U==="class"){J=String(q).trim();continue}Z.push(` ${W}="${T1(String(q))}"`),Y.push(W)}let Q=` lang="${T1(G)}"`;if(J)Q+=` class="${T1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${H8}="${T1(J)}"`;if(Y.length)Q+=` ${j8}="${T1(Y.join(" "))}"`;return Q}function DG(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function yG(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let U=Q[1];if(!(U in Y))J.push(U);Y[U]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[U,K]of Object.entries($)){if(K==null)continue;let z=U.trim();if(!EG.test(z))continue;let _=z.toLowerCase();if(_==="class"){let B=(Y.class||"").split(/\s+/).filter(Boolean);for(let j of String(K).split(/\s+/).filter(Boolean))if(!B.includes(j))B.push(j),w.push(j);if(!("class"in Y))J.push("class");Y.class=B.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(K),_!=="lang")q.push(z)}if(w.length){if(!(H8 in Y))J.push(H8);Y[H8]=w.join(" ")}if(q.length){if(!(j8 in Y))J.push(j8);Y[j8]=q.join(" ")}let W=J.map((U)=>` ${U}="${T1(Y[U])}"`).join("");return X.replace(Z[0],()=>`<html${W}>`)}function bG(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${IG}
3838
- ${X.slice($)}`}function fj(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let K=X.indexOf("-->",Z);if(K===-1)break;Z=K+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let K=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(K===-1)break;Z=K+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function gj(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:U="",bodyAttrs:K={}}=$,z=Z.title||Y,_=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map(g4).filter(Boolean)),H=[..._.filter((N)=>!B.has(g4(N))),...G].map((N)=>{return` <meta ${s5(N)}>`}).join(`
3839
- `),O=Q.map((N)=>{return` <link ${s5(N)}>`}).join(`
3840
- `),L=w.map((N)=>{if(N.src)return` <script ${s5(N,(D)=>D==="content")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
3841
- `),F=xj(W,J),V=Object.entries(K).map(([N,D])=>` ${N}="${T1(String(D))}"`).join(""),A=U?` class="${T1(U)}"`:"",{body:R,hoisted:M}=fj(X),T=[H,Z.colorMode?` ${v4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:vj(z)}</title>`,` ${IG}`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((N)=>` ${N}`),...M.map((N)=>` ${N}`),...(Z.headScripts||[]).map((N)=>` ${N}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((N)=>N),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3833
+ }`}return`${Q} { ${w} }`}let q=Rj(Q,$,Z,Y),W=w;for(let[U,K]of J)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),K);if(G)W=W.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${q} { ${W} }`}function Rj(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let q=Mj(Q,$);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function Mj(X,$){let Z=0,Y=X.length;for(let q=0;q<X.length;q++){let W=X[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){Y=q;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function EG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function F8(X,$){if(!Tj.test(X))return{html:X,hasScoped:!1};let Z=TG($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${h4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,q,W)=>{Q=!0;let U=Nj(W,Y),K=q.replace(new RegExp(h4,"gi"),"").trim(),z=K?` ${K}`:"";return`<style data-stx-scoped="${Z}"${z}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=Ij(J,Y),{html:J,hasScoped:!0}}function Nj(X,$){return NG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function Ij(X,$){let Z=W1(X,(J,G)=>{let Q=C1(J,G);return Q>G?Q:P5(J,G)},(J,G)=>kj(G)),Y=Ej(Z.output,$);return IG.lastIndex=0,Y.replace(IG,(J,G)=>Z.tokens[Number(G)])}function Ej(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var h4,Tj,kj=(X)=>`\x00stx-scope-mask-${X}\x00`,IG;var u4=E(()=>{P1();h4=String.raw`(?<![\w-])scoped(?![\w-])`,Tj=new RegExp(`<style\\s+[^>]*${h4}`,"i");IG=/\u0000stx-scope-mask-(\d+)\u0000/g});function Cj(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Dj.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!Sj.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!bj.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!yj.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function Pj(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function m4(X={}){let $=Cj(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Pj($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function DG(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=d4(X);if(Z===null)return X;let Y=m4($);return`${X.slice(0,Z)}
3834
+ ${Y}${X.slice(Z)}`}function d4(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function fj(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=xj.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
3835
+ ${G[0]}`+Q+X.slice(Z+J.length)}function yG(X){return gj(fj(X))}function gj(X){let $=vj.exec(X);if(!$)return X;let Z=d4(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=d4(Y);if(J===null)return X;return`${Y.slice(0,J)}
3836
+ ${$[0]}${Y.slice(J)}`}var Dj,yj,bj,Sj,vj,xj;var l4=E(()=>{Dj=new Set(["light","dark","auto","system"]),yj=new Set(["auto","system"]),bj=/^[a-z][\w:-]*$/i,Sj=/^[\w-]+$/;vj=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),xj=/<meta\b[^>]*\bcharset\b[^>]*>/i});function hj(){if(c4===null)c4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return c4}function bG(X,$=hj()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
3837
+ <meta name="stx-build" content="${$}">${X.slice(Y)}`}var c4=null;function E1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uj(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p4(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function e5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${E1(String(Y))}"`).join(" ")}function dj(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[w,q]of Object.entries(X||{})){if(q==null)continue;let W=w.trim();if(!CG.test(W))continue;let U=W.toLowerCase();if(U==="lang"){G=String(q);continue}if(U==="class"){J=String(q).trim();continue}Z.push(` ${W}="${E1(String(q))}"`),Y.push(W)}let Q=` lang="${E1(G)}"`;if(J)Q+=` class="${E1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${A8}="${E1(J)}"`;if(Y.length)Q+=` ${V8}="${E1(Y.join(" "))}"`;return Q}function PG(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function vG(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let U=Q[1];if(!(U in Y))J.push(U);Y[U]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[U,K]of Object.entries($)){if(K==null)continue;let z=U.trim();if(!CG.test(z))continue;let _=z.toLowerCase();if(_==="class"){let B=(Y.class||"").split(/\s+/).filter(Boolean);for(let j of String(K).split(/\s+/).filter(Boolean))if(!B.includes(j))B.push(j),w.push(j);if(!("class"in Y))J.push("class");Y.class=B.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(K),_!=="lang")q.push(z)}if(w.length){if(!(A8 in Y))J.push(A8);Y[A8]=w.join(" ")}if(q.length){if(!(V8 in Y))J.push(V8);Y[V8]=q.join(" ")}let W=J.map((U)=>` ${U}="${E1(Y[U])}"`).join("");return X.replace(Z[0],()=>`<html${W}>`)}function xG(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${SG}
3838
+ ${X.slice($)}`}function mj(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let K=X.indexOf("-->",Z);if(K===-1)break;Z=K+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let K=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(K===-1)break;Z=K+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function lj(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:U="",bodyAttrs:K={}}=$,z=Z.title||Y,_=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map(p4).filter(Boolean)),H=[..._.filter((k)=>!B.has(p4(k))),...G].map((k)=>{return` <meta ${e5(k)}>`}).join(`
3839
+ `),O=Q.map((k)=>{return` <link ${e5(k)}>`}).join(`
3840
+ `),L=w.map((k)=>{if(k.src)return` <script ${e5(k,(D)=>D==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
3841
+ `),F=dj(W,J),V=Object.entries(K).map(([k,D])=>` ${k}="${E1(String(D))}"`).join(""),A=U?` class="${E1(U)}"`:"",{body:R,hoisted:M}=mj(X),T=[H,Z.colorMode?` ${m4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:uj(z)}</title>`,` ${SG}`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...M.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),N=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3842
3842
  <html${F}>
3843
3843
  <head>
3844
3844
  ${T.join(`
3845
3845
  `)}
3846
3846
  </head>
3847
3847
  <body${A}${V}>
3848
- ${k.join(`
3848
+ ${N.join(`
3849
3849
  `)}
3850
3850
  </body>
3851
- </html>`}function h4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function u4(X){return h4(X)}function SG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),q=[];for(let W of Y){let U=g4(W);if(U&&w.includes(U))continue;q.push(` <meta ${s5(W)}>`)}for(let W of J){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${s5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${s5(W,(U)=>U==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return X;return`${X.slice(0,Z)}${q.join(`
3851
+ </html>`}function i4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function n4(X){return i4(X)}function fG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),q=[];for(let W of Y){let U=p4(W);if(U&&w.includes(U))continue;q.push(` <meta ${e5(W)}>`)}for(let W of J){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${e5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${e5(W,(U)=>U==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return X;return`${X.slice(0,Z)}${q.join(`
3852
3852
  `)}
3853
- ${X.slice(Z)}`}function CG(X,$={},Z={}){if(u4(X))return X;return gj(X,$,Z)}var IG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",j8="data-stx-html-attrs",H8="data-stx-html-class",EG;var PG=E(()=>{x4();EG=/^[A-Za-z_:][\w:.-]*$/});function vG(X,$={}){return new T5(X,$).routes}var xG=E(()=>{r1();r1()});async function gG(X){let $=X;if(!$)try{$=(await d1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=fG.get(Z);if(Y)return Y;let J=[];try{J=vG(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return fG.set(Z,J),J}var fG;var hG=E(()=>{xG();L1();fG=new Map});function hj(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function uG(X){return hj(JSON.stringify(X))}function m4(){return z5}function l4(X){let $=z5;return dG.push(X),z5=X,$}function c4(X){dG.pop(),z5=X}function p4(){return L8>0}function i4(X){d4.add(X)}function mG(X){L8++;try{X()}finally{if(L8--,L8===0){let $=[...d4];d4.clear();for(let Z of $)Z()}}}function lG(X){let $=z5;z5=null;try{return X()}finally{z5=$}}var z5=null,dG,L8=0,d4;var cG=E(()=>{dG=[],d4=new Set});function m1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=m4();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((w)=>w($,Q)),p4())Y.forEach((w)=>i4(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function F8(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,p4())Y.forEach((Q)=>i4(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=m4();if(Q)Y.add(Q);if(Z){let w=l4(J);try{$=X()}finally{c4(w)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function V8(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=l4(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{c4(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function r4(X){mG(X)}function s4(X){n4.push(X)}function o4(X){O8.push(X)}function uj(){pG(n4,"onMount",O8)}function dj(){pG(O8,"onDestroy")}function pG(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function mj(){return{mount:n4.length,destroy:O8.length}}function A8(X){return typeof X==="function"&&X._isSignal===!0}function R8(X){return typeof X==="function"&&X._isDerived===!0}function a4(X){if(A8(X)||R8(X))return X();return X}function M8(X){return lG(X)}function lj(X,$){let Z=typeof X==="function"?X:()=>X,Y=m1([]),J=F8(()=>Y().reduce((w,q)=>$(w,q.action),Z())),G=!1;return V8(()=>{if(Z(),!G){G=!0;return}if(M8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let U=()=>{let K=Y().filter((z)=>z!==W);if(K.length!==Y().length)Y.set(K)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var n4,O8;var T8=E(()=>{cG();n4=[],O8=[]});var nG={};a(nG,{useOptimistic:()=>lj,untrack:()=>a4,state:()=>m1,runMountCallbacks:()=>uj,runDestroyCallbacks:()=>dj,pendingLifecycleCounts:()=>mj,peek:()=>M8,onMount:()=>s4,onDestroy:()=>o4,isSignal:()=>A8,isDerived:()=>R8,generateSignalsRuntimeDev:()=>t4,generateSignalsRuntime:()=>iG,effect:()=>V8,derived:()=>F8,default:()=>pj,batch:()=>r4});function iG(){let X=cj(t4());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function cj(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let w=X[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<X.length&&X[Q]!==q){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function t4(){return`
3853
+ ${X.slice(Z)}`}function gG(X,$={},Z={}){if(n4(X))return X;return lj(X,$,Z)}var SG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",V8="data-stx-html-attrs",A8="data-stx-html-class",CG;var hG=E(()=>{l4();CG=/^[A-Za-z_:][\w:.-]*$/});function uG(X,$={}){return new I5(X,$).routes}var dG=E(()=>{X5();X5()});async function lG(X){let $=X;if(!$)try{$=(await c1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=mG.get(Z);if(Y)return Y;let J=[];try{J=uG(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return mG.set(Z,J),J}var mG;var cG=E(()=>{dG();V1();mG=new Map});function cj(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pG(X){return cj(JSON.stringify(X))}function s4(){return L5}function o4(X){let $=L5;return iG.push(X),L5=X,$}function a4(X){iG.pop(),L5=X}function t4(){return R8>0}function e4(X){r4.add(X)}function nG(X){R8++;try{X()}finally{if(R8--,R8===0){let $=[...r4];r4.clear();for(let Z of $)Z()}}}function rG(X){let $=L5;L5=null;try{return X()}finally{L5=$}}var L5=null,iG,R8=0,r4;var sG=E(()=>{iG=[],r4=new Set});function p1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=s4();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((w)=>w($,Q)),t4())Y.forEach((w)=>e4(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function T8(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,t4())Y.forEach((Q)=>e4(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=s4();if(Q)Y.add(Q);if(Z){let w=o4(J);try{$=X()}finally{a4(w)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function N8(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=o4(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{a4(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function $3(X){nG(X)}function Z3(X){X3.push(X)}function Y3(X){M8.push(X)}function pj(){oG(X3,"onMount",M8)}function ij(){oG(M8,"onDestroy")}function oG(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function nj(){return{mount:X3.length,destroy:M8.length}}function k8(X){return typeof X==="function"&&X._isSignal===!0}function I8(X){return typeof X==="function"&&X._isDerived===!0}function J3(X){if(k8(X)||I8(X))return X();return X}function E8(X){return rG(X)}function rj(X,$){let Z=typeof X==="function"?X:()=>X,Y=p1([]),J=T8(()=>Y().reduce((w,q)=>$(w,q.action),Z())),G=!1;return N8(()=>{if(Z(),!G){G=!0;return}if(E8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let U=()=>{let K=Y().filter((z)=>z!==W);if(K.length!==Y().length)Y.set(K)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var X3,M8;var D8=E(()=>{sG();X3=[],M8=[]});var tG={};e(tG,{useOptimistic:()=>rj,untrack:()=>J3,state:()=>p1,runMountCallbacks:()=>pj,runDestroyCallbacks:()=>ij,pendingLifecycleCounts:()=>nj,peek:()=>E8,onMount:()=>Z3,onDestroy:()=>Y3,isSignal:()=>k8,isDerived:()=>I8,generateSignalsRuntimeDev:()=>G3,generateSignalsRuntime:()=>aG,effect:()=>N8,derived:()=>T8,default:()=>oj,batch:()=>$3});function aG(){let X=sj(G3());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function sj(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let w=X[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<X.length&&X[Q]!==q){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function G3(){return`
3854
3854
  // STX Signals Runtime (Development Build)
3855
3855
  console.log('[stx] signals runtime loading');
3856
3856
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6456,7 +6456,7 @@ catch (e2) {
6456
6456
  // :attr still works for backward compat but is reserved for structural directives.
6457
6457
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
6458
6458
  // handled by their own code paths below \u2014 exclude them here.
6459
- var X_HANDLED = ${A2()};
6459
+ var X_HANDLED = ${E2()};
6460
6460
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6461
6461
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6462
6462
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -11816,42 +11816,42 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
11816
11816
  }
11817
11817
  }
11818
11818
  })();
11819
- `}var pj;var rG=E(()=>{T8();X1();T8();pj={state:m1,derived:F8,effect:V8,batch:r4,onMount:s4,onDestroy:o4,isSignal:A8,isDerived:R8,untrack:a4,peek:M8,generateSignalsRuntime:iG,generateSignalsRuntimeDev:t4}});var e4={};a(e4,{templateCache:()=>sG,readFileCached:()=>ij,invalidateFileCacheByDir:()=>rj,invalidateFileCache:()=>nj,hashFilePath:()=>t7,getCachedSignalsRuntime:()=>aj,getCachedRouterScript:()=>tj,clearDevCaches:()=>ej,checkCache:()=>XH,cacheTemplate:()=>$H,__setSignalsGeneratorsForTest:()=>oj});import l1 from"fs";import o5 from"path";async function ij(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await l1.promises.stat(X)).mtime.getTime(),Q=B5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await l1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return B5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw B5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function nj(X){B5.delete(X)}function rj(X){for(let $ of B5.keys())if($.startsWith(X))B5.delete($)}function oj(X){oG=X}async function aj(X=!1){let $=oG??await Promise.resolve().then(() => (rG(),nG));if(X)return $.generateSignalsRuntimeDev();if(N8===null)N8=$.generateSignalsRuntime();return N8}async function tj(){if(k8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (r1(),W2));k8=X()}return k8}function ej(){B5.clear(),tG(),N8=null,sj=null,k8=null}function aG(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function XH(X,$){try{if(!$.cachePath)return null;let Z=o5.resolve($.cachePath),Y=o5.join(Z,`${t7(X)}.html`),J=o5.join(Z,`${t7(X)}.meta.json`);if(!await n(Y)||!await n(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==aG($))return null;if((await l1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await n(q)){if((await l1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function $H(X,$,Z,Y){try{if(!Y.cachePath)return;let J=o5.resolve(Y.cachePath);await l1.promises.mkdir(J,{recursive:!0});let G=o5.join(J,`${t7(X)}.html`),Q=o5.join(J,`${t7(X)}.meta.json`),w=await l1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:aG(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),sG.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function t7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,ZH)}var sG,B5,N8=null,sj=null,oG=null,k8=null,ZH=16;var X3=E(()=>{T0();sG=new Map,B5=new Map});function eG(X){return X.includes("data-stx-runtime")}function XQ(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function $3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11819
+ `}var oj;var eG=E(()=>{D8();Z1();D8();oj={state:p1,derived:T8,effect:N8,batch:$3,onMount:Z3,onDestroy:Y3,isSignal:k8,isDerived:I8,untrack:J3,peek:E8,generateSignalsRuntime:aG,generateSignalsRuntimeDev:G3}});var Q3={};e(Q3,{templateCache:()=>XQ,readFileCached:()=>aj,invalidateFileCacheByDir:()=>ej,invalidateFileCache:()=>tj,hashFilePath:()=>$X,getCachedSignalsRuntime:()=>ZH,getCachedRouterScript:()=>YH,clearDevCaches:()=>JH,checkCache:()=>GH,cacheTemplate:()=>QH,__setSignalsGeneratorsForTest:()=>$H});import i1 from"fs";import X7 from"path";async function aj(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await i1.promises.stat(X)).mtime.getTime(),Q=O5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await i1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return O5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw O5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function tj(X){O5.delete(X)}function ej(X){for(let $ of O5.keys())if($.startsWith(X))O5.delete($)}function $H(X){$Q=X}async function ZH(X=!1){let $=$Q??await Promise.resolve().then(() => (eG(),tG));if(X)return $.generateSignalsRuntimeDev();if(y8===null)y8=$.generateSignalsRuntime();return y8}async function YH(){if(b8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (X5(),H2));b8=X()}return b8}function JH(){O5.clear(),YQ(),y8=null,XH=null,b8=null}function ZQ(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function GH(X,$){try{if(!$.cachePath)return null;let Z=X7.resolve($.cachePath),Y=X7.join(Z,`${$X(X)}.html`),J=X7.join(Z,`${$X(X)}.meta.json`);if(!await n(Y)||!await n(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==ZQ($))return null;if((await i1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await n(q)){if((await i1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function QH(X,$,Z,Y){try{if(!Y.cachePath)return;let J=X7.resolve(Y.cachePath);await i1.promises.mkdir(J,{recursive:!0});let G=X7.join(J,`${$X(X)}.html`),Q=X7.join(J,`${$X(X)}.meta.json`),w=await i1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:ZQ(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),XQ.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function $X(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,wH)}var XQ,O5,y8=null,XH=null,$Q=null,b8=null,wH=16;var w3=E(()=>{L0();XQ=new Map,O5=new Map});function JQ(X){return X.includes("data-stx-runtime")}function GQ(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function q3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11820
11820
  `+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
11821
11821
  ${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
11822
- `+X.slice(Q)}if(x7(X))return vX(X,(Q)=>`${Q}
11822
+ `+X.slice(Q)}if(h7(X))return uX(X,(Q)=>`${Q}
11823
11823
  ${$}`);return`${$}
11824
- ${X}`}async function I8(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return $3(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return $3(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (X3(),e4)),Y=await Z($.debug);return $3(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function YH(X){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(X)}function $Q(X){if(X.includes("data-stx-tooltip-runtime")||!YH(X))return X;let $=`<script data-stx-scoped data-stx-tooltip-runtime>${z4()}</script>`,Z=X.lastIndexOf("</body>");if(Z===-1)return`${X}
11824
+ ${X}`}async function S8(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return q3(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return q3(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (w3(),Q3)),Y=await Z($.debug);return q3(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function qH(X){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(X)}function QQ(X){if(X.includes("data-stx-tooltip-runtime")||!qH(X))return X;let $=`<script data-stx-scoped data-stx-tooltip-runtime>${F4()}</script>`,Z=X.lastIndexOf("</body>");if(Z===-1)return`${X}
11825
11825
  ${$}`;return`${X.slice(0,Z)}${$}
11826
- ${X.slice(Z)}`}async function Z3(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let q=await gG($?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${uG(w)};</script>
11827
- `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (X3(),e4)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11828
- </body>`+X.slice(Q+7)}var E8=E(()=>{hG();z9()});var C8={};a(C8,{scanScriptTags:()=>wQ,rewriteStxImportSpecifiers:()=>KQ,processSignals:()=>q3,processScriptSetup:()=>WQ,preEvalLiteralReactiveIfs:()=>Q3,parseLoopExpression:()=>J3,hasSignalsSyntax:()=>S8,findMarkupIndexOutsideScripts:()=>y8,extractExports:()=>UQ,convertSignalLoopsToAttributes:()=>w3,convertSignalDirectivesToAttributes:()=>G3});function wQ(X,$={}){let Z=[];for(let Y of bX(X,y1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let w=J[0].length,q=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,q),start:Y.start,end:Y.end})}return Z}function J3(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=ZQ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=ZQ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function ZQ(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function S8(X){return L2(X)}function GH(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function QH(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function wH(X){if(!/[:@]for\s*=/.test(X)&&!/\bx-for\s*=/.test(X))return[];let $=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Y3})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=bX(X,(G,Q)=>{$.lastIndex=Q;let w=$.exec(G);if(!w||w.index!==Q||!Z.test(w[2]))return-1;return $.lastIndex}),J=[];for(let G of Y){$.lastIndex=0;let Q=$.exec(G.token);if(!Q)continue;let w=Q[2].match(Z),q=J3(w?.[1]??w?.[2]??""),W=[q.itemVar,q.indexVar].filter(Boolean);if(W.length===0)continue;let U=Q[1],z=/\/\s*>$/.test(G.token)||b8.has(U.toLowerCase())?G.end:qQ(X,G.start,U,G.end);if(z!==-1)J.push({start:G.start,end:z,vars:new Set(W)})}return J}function qH(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function JQ(X,$,Z,Y){if(!X)return!1;let J=qH(X),G=!1,Q=!1,w=!1,q=/([a-zA-Z_$][\w$]*)/g,W;while((W=q.exec(J))!==null){let _=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(YQ.has(_))continue;if($.has(_)||Y?.has(_))G=!0;else if(Z&&_ in Z)Q=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=U.exec(J))!==null){let _=K[1];if(J.slice(0,K.index).trimEnd().endsWith("."))continue;if(YQ.has(_)||Z&&_ in Z)continue;w=!0}return(G||w)&&!Q}function D8(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(QQ);if(G&&WH(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${Y}>${q}</${Q}>`}return`<template${Y}>${J}</template>`}function WH(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function G3(X,$){let Z=QH(X);function Y(J){let G=J,Q=wH(J),w=(K)=>{let z=new Set;for(let _ of Q)if(K>_.start&&K<_.end)for(let B of _.vars)z.add(B);return z},q=/@if\s*\(/g,W,U=[];while((W=q.exec(G))!==null){let K=W.index,z=K+W[0].length,_=1,B=z;while(B<G.length&&_>0){if(G[B]==="(")_++;else if(G[B]===")")_--;B++}if(_!==0)continue;let j=G.substring(z,B-1).trim(),H=B,O=1,L=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))O++;else if(V[1]==="endif"){if(O--,O===0){L=V.index+V[0].length;break}}if(O!==0)continue;let A=G.substring(H,L-6).trim(),R;if(GH(A)){let M=h7(G.substring(K,L));if(M.length===0)continue;let T=M[0].branches.filter((I)=>I.type!=="else"),k=w(K);if(!(T.length>0&&T.every((I)=>JQ(I.condition,Z,$,k))))continue;R=M[0].branches.map((I)=>{let C=Y(I.content);if(I.type==="elseif")return D8(C,"@else-if",I.condition??"");if(I.type==="else")return D8(C,"@else");return D8(C,"@if",I.condition??"")}).join(`
11829
- `)}else{if(!JQ(j,Z,$,w(K)))continue;R=D8(Y(A),"@if",j)}U.push({start:K,end:L,replacement:R}),q.lastIndex=L}for(let K=U.length-1;K>=0;K--){let{start:z,end:_,replacement:B}=U[K];G=G.substring(0,z)+B+G.substring(_)}return G}return Y(X)}function UH(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function qQ(X,$,Z,Y){if(b8.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,w=1,q=Y;while(q<Q){let W=X.indexOf("<",q);if(W===-1)return-1;if(q=W,X.startsWith("<!--",q)){let _=X.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec(X.slice(q,q+8));if(U){let _=X.indexOf(">",q);if(_===-1)return-1;if(X[_-1]==="/"){q=_+1;continue}let B=G.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let j=X.indexOf(">",B);if(j===-1)return-1;q=j+1;continue}if(X[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===J){if(w--,q+=_[0].length,w===0)return q;continue}q+=_[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(X.slice(q,q+64));if(!K){q++;continue}let z=X.indexOf(">",q);if(z===-1)return-1;if(K[1].toLowerCase()===J){let _=X.slice(q,z+1);if(!(/\/\s*>$/.test(_)||b8.has(J)))w++}q=z+1}return-1}function zH(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return KH.test(G)}function Q3(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(K)=>$.some(([z,_])=>K>=z&&K<_),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec(X))!==null){if(J(w.index))continue;let[K,z,_,B,j,H,O]=w,L=UH(j);if(L===void 0)continue;let F=w.index,V=F+K.length,M=!!O||/\/\s*>$/.test(K)||b8.has(z.toLowerCase())?V:qQ(X,F,z,V);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&zH(X,M)){G.lastIndex=V;continue}if(L===!0){let k=`<${z}${_}${H}${O}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:M,replacement:""}),G.lastIndex=M}if(Q.length===0)return X;Q.sort((K,z)=>K.start-z.start);let q=[],W=-1;for(let K of Q){if(K.start<W)continue;q.push(K),W=K.end}let U=X;for(let K=q.length-1;K>=0;K--){let{start:z,end:_,replacement:B}=q[K];U=U.substring(0,z)+B+U.substring(_)}return U}function w3(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],q=J.index,W=q+J[0].length,U=1,K=W;while(K<Z.length&&U>0){if(Z[K]==="(")U++;else if(Z[K]===")")U--;K++}if(U!==0)continue;let z=Z.substring(W,K-1).trim(),_=K,B=J3(z),j=w==="for"?"@endfor":"@endforeach",H=1,O=_,L=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");L.lastIndex=_;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[B.itemVar,B.indexVar].filter(Boolean);if(T.length)Q.push({start:q,end:O,vars:T})};if(B.iterable){let T=B.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let k=T.split(/[.[(]/)[0].trim(),N=$?k in $:!1,D=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(k));if(k&&(N||D)){V();continue}}if(B.style==="as")z=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let A=Z.substring(_,O-j.length).trim(),R=A.match(QQ),M;if(R){let[,T,k,N]=R;M=`<${T}${k} @for="${z}">${N}</${T}>`}else M=`<template @for="${z}">${A}</template>`;G.push({start:q,end:O,replacement:M})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:U}=G[w];Z=Z.substring(0,q)+U+Z.substring(W)}return Z}function BH(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(U)=>{let K=Y+1;while(K<G){let z=X[K];if(z==="\\"){K+=2;continue}if(z===U)return K+1;K++}return G},w=()=>{let U=Y+2;while(U<G&&X[U]!==`
11826
+ ${X.slice(Z)}`}async function W3(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let q=await lG($?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${pG(w)};</script>
11827
+ `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (w3(),Q3)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11828
+ </body>`+X.slice(Q+7)}var C8=E(()=>{cG();F9()});var g8={};e(g8,{scanScriptTags:()=>zQ,rewriteStxImportSpecifiers:()=>HQ,processSignals:()=>j3,processScriptSetup:()=>_Q,preEvalLiteralReactiveIfs:()=>B3,parseLoopExpression:()=>K3,hasSignalsSyntax:()=>f8,findMarkupIndexOutsideScripts:()=>v8,extractExports:()=>jQ,convertSignalLoopsToAttributes:()=>_3,convertSignalDirectivesToAttributes:()=>z3});function zQ(X,$={}){let Z=[];for(let Y of xX(X,C1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let w=J[0].length,q=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,q),start:Y.start,end:Y.end})}return Z}function K3(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=wQ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=wQ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function wQ(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function f8(X){return T2(X)}function UH(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function KH(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function zH(X){if(!/[:@]for\s*=/.test(X)&&!/\bx-for\s*=/.test(X))return[];let $=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${U3})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=xX(X,(G,Q)=>{$.lastIndex=Q;let w=$.exec(G);if(!w||w.index!==Q||!Z.test(w[2]))return-1;return $.lastIndex}),J=[];for(let G of Y){$.lastIndex=0;let Q=$.exec(G.token);if(!Q)continue;let w=Q[2].match(Z),q=K3(w?.[1]??w?.[2]??""),W=[q.itemVar,q.indexVar].filter(Boolean);if(W.length===0)continue;let U=Q[1],z=/\/\s*>$/.test(G.token)||x8.has(U.toLowerCase())?G.end:BQ(X,G.start,U,G.end);if(z!==-1)J.push({start:G.start,end:z,vars:new Set(W)})}return J}function BH(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function WQ(X,$,Z,Y){if(!X)return!1;let J=BH(X),G=!1,Q=!1,w=!1,q=/([a-zA-Z_$][\w$]*)/g,W;while((W=q.exec(J))!==null){let _=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(qQ.has(_))continue;if($.has(_)||Y?.has(_))G=!0;else if(Z&&_ in Z)Q=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=U.exec(J))!==null){let _=K[1];if(J.slice(0,K.index).trimEnd().endsWith("."))continue;if(qQ.has(_)||Z&&_ in Z)continue;w=!0}return(G||w)&&!Q}function P8(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(KQ);if(G&&_H(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${Y}>${q}</${Q}>`}return`<template${Y}>${J}</template>`}function _H(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function z3(X,$){let Z=KH(X);function Y(J){let G=J,Q=zH(J),w=(K)=>{let z=new Set;for(let _ of Q)if(K>_.start&&K<_.end)for(let B of _.vars)z.add(B);return z},q=/@if\s*\(/g,W,U=[];while((W=q.exec(G))!==null){let K=W.index,z=K+W[0].length,_=1,B=z;while(B<G.length&&_>0){if(G[B]==="(")_++;else if(G[B]===")")_--;B++}if(_!==0)continue;let j=G.substring(z,B-1).trim(),H=B,O=1,L=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))O++;else if(V[1]==="endif"){if(O--,O===0){L=V.index+V[0].length;break}}if(O!==0)continue;let A=G.substring(H,L-6).trim(),R;if(UH(A)){let M=m7(G.substring(K,L));if(M.length===0)continue;let T=M[0].branches.filter((I)=>I.type!=="else"),N=w(K);if(!(T.length>0&&T.every((I)=>WQ(I.condition,Z,$,N))))continue;R=M[0].branches.map((I)=>{let S=Y(I.content);if(I.type==="elseif")return P8(S,"@else-if",I.condition??"");if(I.type==="else")return P8(S,"@else");return P8(S,"@if",I.condition??"")}).join(`
11829
+ `)}else{if(!WQ(j,Z,$,w(K)))continue;R=P8(Y(A),"@if",j)}U.push({start:K,end:L,replacement:R}),q.lastIndex=L}for(let K=U.length-1;K>=0;K--){let{start:z,end:_,replacement:B}=U[K];G=G.substring(0,z)+B+G.substring(_)}return G}return Y(X)}function jH(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function BQ(X,$,Z,Y){if(x8.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,w=1,q=Y;while(q<Q){let W=X.indexOf("<",q);if(W===-1)return-1;if(q=W,X.startsWith("<!--",q)){let _=X.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec(X.slice(q,q+8));if(U){let _=X.indexOf(">",q);if(_===-1)return-1;if(X[_-1]==="/"){q=_+1;continue}let B=G.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let j=X.indexOf(">",B);if(j===-1)return-1;q=j+1;continue}if(X[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===J){if(w--,q+=_[0].length,w===0)return q;continue}q+=_[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(X.slice(q,q+64));if(!K){q++;continue}let z=X.indexOf(">",q);if(z===-1)return-1;if(K[1].toLowerCase()===J){let _=X.slice(q,z+1);if(!(/\/\s*>$/.test(_)||x8.has(J)))w++}q=z+1}return-1}function LH(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return HH.test(G)}function B3(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(K)=>$.some(([z,_])=>K>=z&&K<_),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec(X))!==null){if(J(w.index))continue;let[K,z,_,B,j,H,O]=w,L=jH(j);if(L===void 0)continue;let F=w.index,V=F+K.length,M=!!O||/\/\s*>$/.test(K)||x8.has(z.toLowerCase())?V:BQ(X,F,z,V);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&LH(X,M)){G.lastIndex=V;continue}if(L===!0){let N=`<${z}${_}${H}${O}>`;Q.push({start:F,end:V,replacement:N});continue}Q.push({start:F,end:M,replacement:""}),G.lastIndex=M}if(Q.length===0)return X;Q.sort((K,z)=>K.start-z.start);let q=[],W=-1;for(let K of Q){if(K.start<W)continue;q.push(K),W=K.end}let U=X;for(let K=q.length-1;K>=0;K--){let{start:z,end:_,replacement:B}=q[K];U=U.substring(0,z)+B+U.substring(_)}return U}function _3(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],q=J.index,W=q+J[0].length,U=1,K=W;while(K<Z.length&&U>0){if(Z[K]==="(")U++;else if(Z[K]===")")U--;K++}if(U!==0)continue;let z=Z.substring(W,K-1).trim(),_=K,B=K3(z),j=w==="for"?"@endfor":"@endforeach",H=1,O=_,L=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");L.lastIndex=_;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[B.itemVar,B.indexVar].filter(Boolean);if(T.length)Q.push({start:q,end:O,vars:T})};if(B.iterable){let T=B.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let N=T.split(/[.[(]/)[0].trim(),k=$?N in $:!1,D=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(N));if(N&&(k||D)){V();continue}}if(B.style==="as")z=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let A=Z.substring(_,O-j.length).trim(),R=A.match(KQ),M;if(R){let[,T,N,k]=R;M=`<${T}${N} @for="${z}">${k}</${T}>`}else M=`<template @for="${z}">${A}</template>`;G.push({start:q,end:O,replacement:M})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:U}=G[w];Z=Z.substring(0,q)+U+Z.substring(W)}return Z}function OH(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(U)=>{let K=Y+1;while(K<G){let z=X[K];if(z==="\\"){K+=2;continue}if(z===U)return K+1;K++}return G},w=()=>{let U=Y+2;while(U<G&&X[U]!==`
11830
11830
  `)U++;return U},q=()=>{let U=Y+2;while(U<G-1){if(X[U]==="*"&&X[U+1]==="/")return U+2;U++}return G},W=(U)=>{let K=U,z=0;while(K<G){let _=X[K];if(_==="/"&&X[K+1]==="/"){let B=K+2;while(B<G&&X[B]!==`
11831
- `)B++;K=B;continue}if(_==="/"&&X[K+1]==="*"){let B=K+2;while(B<G-1&&!(X[B]==="*"&&X[B+1]==="/"))B++;K=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=K+1;while(B<G){if(X[B]==="\\"){B+=2;continue}if(X[B]===_){B++;break}B++}K=B;continue}if(_==="("||_==="["||_==="{"){z++,K++;continue}if(_===")"||_==="]"||_==="}"){z--,K++;continue}if(_===";"&&z===0)return K+1;K++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let K=w();Z.push(X.slice(Y,K)),Y=K;continue}if(U==="/"&&X[Y+1]==="*"){let K=q();Z.push(X.slice(Y,K)),Y=K;continue}if(U==='"'||U==="'"||U==="`"){let K=Q(U);Z.push(X.slice(Y,K)),Y=K;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let K=Y>0?X[Y-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let _=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],j=W(Y+_[0].length);if($.has(B)){Z.push(`/* stx: deduped const ${B} */`),Y=j;continue}$.add(B),Z.push(X.slice(Y,j)),Y=j;continue}}}Z.push(U),Y++}return Z.join("")}async function WQ(X,$,Z){let Y=wQ(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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*\(/,G=[];for(let H of Y){let O=H.body;if(X5(H.attrs))O=$5(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${JH++}`,{hasUserImports:w,bundleClientScript:q}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (E7(),I7))),W=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=D5(O).code,w(O))O=await q(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>KQ(V));let L=m0(O);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11831
+ `)B++;K=B;continue}if(_==="/"&&X[K+1]==="*"){let B=K+2;while(B<G-1&&!(X[B]==="*"&&X[B+1]==="/"))B++;K=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=K+1;while(B<G){if(X[B]==="\\"){B+=2;continue}if(X[B]===_){B++;break}B++}K=B;continue}if(_==="("||_==="["||_==="{"){z++,K++;continue}if(_===")"||_==="]"||_==="}"){z--,K++;continue}if(_===";"&&z===0)return K+1;K++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let K=w();Z.push(X.slice(Y,K)),Y=K;continue}if(U==="/"&&X[Y+1]==="*"){let K=q();Z.push(X.slice(Y,K)),Y=K;continue}if(U==='"'||U==="'"||U==="`"){let K=Q(U);Z.push(X.slice(Y,K)),Y=K;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let K=Y>0?X[Y-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let _=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],j=W(Y+_[0].length);if($.has(B)){Z.push(`/* stx: deduped const ${B} */`),Y=j;continue}$.add(B),Z.push(X.slice(Y,j)),Y=j;continue}}}Z.push(U),Y++}return Z.join("")}async function _Q(X,$,Z){let Y=zQ(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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*\(/,G=[];for(let H of Y){let O=H.body;if(Q5(H.attrs))O=w5(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${WH++}`,{hasUserImports:w,bundleClientScript:q}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (S7(),b7))),W=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=S5(O).code,w(O))O=await q(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>HQ(V));let L=i0(O);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11832
11832
  ${L}`)}let U=W.join(`
11833
11833
 
11834
- `);U=BH(U);let K=UQ(U),z=K.split(",").map((H)=>H.trim()).filter(Boolean),_=kX(U,Z),B=`
11834
+ `);U=OH(U);let K=jQ(U),z=K.split(",").map((H)=>H.trim()).filter(Boolean),_=bX(U,Z),B=`
11835
11835
  <script data-stx-scoped>
11836
11836
  function ${Q}() {
11837
- ${k5("const",z)}
11838
- ${I5(`${_}${U}`)}
11837
+ ${D5("const",z)}
11838
+ ${y5(`${_}${U}`)}
11839
11839
  return { ${K} };
11840
11840
  }
11841
11841
  window.__stx_latestSetup=${Q};
11842
11842
  if(window.stx)window.stx._latestSetup=${Q};
11843
- </script>`,j=X;for(let H of G)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(new RegExp(`<body(${Y3})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],O=!1;j=j.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Y3})>`,"gi"),(L,F,V)=>{if(O||H.includes(F.toLowerCase()))return L;return O=!0,`<${F}${V} data-stx="${Q}">`})}return{output:j,setupCode:B}}function UQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w="",q=()=>{G++;let B=!1;while(G<Q){let j=$[G];if(j==="\\"){G+=2;continue}if(j==="["&&!B){B=!0,G++;continue}if(j==="]"&&B){B=!1,G++;continue}if(j==="/"&&!B){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(j===`
11843
+ </script>`,j=X;for(let H of G)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(new RegExp(`<body(${U3})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],O=!1;j=j.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U3})>`,"gi"),(L,F,V)=>{if(O||H.includes(F.toLowerCase()))return L;return O=!0,`<${F}${V} data-stx="${Q}">`})}return{output:j,setupCode:B}}function jQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w="",q=()=>{G++;let B=!1;while(G<Q){let j=$[G];if(j==="\\"){G+=2;continue}if(j==="["&&!B){B=!0,G++;continue}if(j==="]"&&B){B=!1,G++;continue}if(j==="/"&&!B){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(j===`
11844
11844
  `)return;G++}},W=()=>{if(!w)return!0;if(/[\w)\]]/.test(w))return!1;return!0},U=(B)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===B){G++;return}G++}},K=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let B=1;while(G<Q&&B>0)if($[G]==="{")B++,G++;else if($[G]==="}")B--,G++;else if($[G]==="'"||$[G]==='"')U($[G]);else if($[G]==="`")K();else G++;continue}G++}},z=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11845
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let B=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let j=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(j){j[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),M=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(M&&!Y.has(M))Z.push(M),Y.add(M)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){U($[G]),w=$[G-1];continue}if($[G]==="`"){K(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&W()){q(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))_();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function q3(X,$,Z,Y){if(!S8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await WQ(J,Z,Y);if(J=G,J=await I8(J,$),Q){let U=y8(J,/<\/head>/i),K=U===-1?y8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
11845
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let B=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let j=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(j){j[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),M=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(M&&!Y.has(M))Z.push(M),Y.add(M)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){U($[G]),w=$[G-1];continue}if($[G]==="`"){K(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&W()){q(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))_();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function j3(X,$,Z,Y){if(!f8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await _Q(J,Z,Y);if(J=G,J=await S8(J,$),Q){let U=v8(J,/<\/head>/i),K=U===-1?v8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
11846
11846
  ${J.slice(U)}`;else if(K!==-1){let z=/<body[^>]*>/i.exec(J.slice(K))[0],_=K+z.length;J=`${J.slice(0,_)}
11847
11847
  ${Q}${J.slice(_)}`}else J=`${J}
11848
- ${Q}`}let q=J.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(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,K=y8(J,U);if(K!==-1){let z=J.slice(0,K),_=J.slice(K).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+_}}return J}function y8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([U,K])=>q>=U&&q<K))return q;Q=q+Math.max(w[0].length,1)}return-1}function KQ(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return GQ;return`var ${$.join(", ")}; ${GQ}`}var JH=0,Y3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,QQ,YQ,b8,KH,GQ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var e7=E(()=>{y5();pX();X1();n$();T0();E8();Z5();R7();QQ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;YQ=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"]);b8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);KH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import a5 from"path";function zQ(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function BQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=a5.join(J,X);if(await Bun.file(Q).exists())return Q;J=a5.dirname(J)}Y=a5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=a5.resolve($,X);else Y=a5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function _Q(X,$,Z){let Y=X,J=a5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,U,K,z]=Q;if(zQ(K))continue;let _=await BQ(K,J,$);if(_)try{let B=await Bun.file(_).text();if(Z.add(_),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:x0()});if(H.outputs.length>0)B=await H.outputs[0].text()}let j=`<script>
11848
+ ${Q}`}let q=J.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(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,K=v8(J,U);if(K!==-1){let z=J.slice(0,K),_=J.slice(K).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+_}}return J}function v8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([U,K])=>q>=U&&q<K))return q;Q=q+Math.max(w[0].length,1)}return-1}function HQ(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return UQ;return`var ${$.join(", ")}; ${UQ}`}var WH=0,U3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,KQ,qQ,x8,HH,UQ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var ZX=E(()=>{C5();oX();Z1();e$();L0();C8();P1();k7();KQ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;qQ=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"]);x8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);HH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import $7 from"path";function LQ(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function OQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=$7.join(J,X);if(await Bun.file(Q).exists())return Q;J=$7.dirname(J)}Y=$7.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=$7.resolve($,X);else Y=$7.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function FQ(X,$,Z){let Y=X,J=$7.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,U,K,z]=Q;if(LQ(K))continue;let _=await OQ(K,J,$);if(_)try{let B=await Bun.file(_).text();if(Z.add(_),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:d0()});if(H.outputs.length>0)B=await H.outputs[0].text()}let j=`<script>
11849
11849
  // Source: ${K}
11850
11850
  ${B}
11851
- </script>`;Y=Y.replace(W,j),G.lastIndex=0}catch(B){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,U,K,z]=q,_=U+z;if(zQ(K))continue;if(/rel=["']stylesheet["']/.test(_)||K.endsWith(".css")){let j=await BQ(K,J,$);if(j)try{let H=await Bun.file(j).text();Z.add(j);let O=`<style>
11851
+ </script>`;Y=Y.replace(W,j),G.lastIndex=0}catch(B){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,U,K,z]=q,_=U+z;if(LQ(K))continue;if(/rel=["']stylesheet["']/.test(_)||K.endsWith(".css")){let j=await OQ(K,J,$);if(j)try{let H=await Bun.file(j).text();Z.add(j);let O=`<style>
11852
11852
  /* Source: ${K} */
11853
11853
  ${H}
11854
- </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var jQ=E(()=>{D1()});function W3(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,U=!1;while(q<Z.length&&w>0){let F=Z[q];if(U){U=!1,q++;continue}if(F==="\\"&&W){U=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),_=-1,B=0,j=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")B++;else if(V===")"||V==="]"||V==="}")B--;if(V===","&&B===0){_=F;break}}let O=_>=0?K.substring(0,_).trim():K,L=_>=0?K.substring(_+1).trim():void 0;try{let F=O.trim(),V;if(w0(F))V=q0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){J1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function U3(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function HQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),U=q,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let _=K.slice(0,z),B=U+z+8,j=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=_.slice(H),L=_.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[M,T,k="",N]=A,D=`<${T}${k} data-stx-memo="${W}"${N}>`;R=_.slice(0,H)+D+V.slice(M.length)+_.slice(H+V.length)}else R=`${_.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${_.slice(H+V.length)}`;J.push({start:G,end:B,replacement:R}),Z.lastIndex=B}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function K3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function LQ(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,U=-1;while(w<X.length){let j=X[w];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=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),_=z.indexOf("</"),B=_>=0?z.slice(0,_):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function OQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let B=`</${Q}>`,j=X.toLowerCase().indexOf(B,G);if(j!==-1)$.lastIndex=j+B.length;continue}let w=G+J[0].length,q=!1,W=!1,U=-1;while(w<X.length){let B=X[w];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!_H.test(K))continue;let z=X[U-1]==="/",_=z?U-1:U;Z+=`${X.slice(Y,_)} x-cloak${z?" ":""}`,Y=_}return Z+=X.slice(Y),Z}var _H;var z3=E(()=>{V1();A0();_H=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function B3(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],w=r0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:U}of jH){if(G.some((z)=>/\w/.test(z)&&W.includes(z)))continue;q.lastIndex=0;let K=w.match(q);if(K&&K.length>0){let z=w.split(`
11854
+ </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var VQ=E(()=>{S1()});function H3(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,U=!1;while(q<Z.length&&w>0){let F=Z[q];if(U){U=!1,q++;continue}if(F==="\\"&&W){U=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),_=-1,B=0,j=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")B++;else if(V===")"||V==="]"||V==="}")B--;if(V===","&&B===0){_=F;break}}let O=_>=0?K.substring(0,_).trim():K,L=_>=0?K.substring(_+1).trim():void 0;try{let F=O.trim(),V;if(q0(F))V=W0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){Q1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function L3(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function AQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),U=q,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let _=K.slice(0,z),B=U+z+8,j=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=_.slice(H),L=_.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[M,T,N="",k]=A,D=`<${T}${N} data-stx-memo="${W}"${k}>`;R=_.slice(0,H)+D+V.slice(M.length)+_.slice(H+V.length)}else R=`${_.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${_.slice(H+V.length)}`;J.push({start:G,end:B,replacement:R}),Z.lastIndex=B}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function O3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function RQ(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,U=-1;while(w<X.length){let j=X[w];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=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),_=z.indexOf("</"),B=_>=0?z.slice(0,_):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function MQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let B=`</${Q}>`,j=X.toLowerCase().indexOf(B,G);if(j!==-1)$.lastIndex=j+B.length;continue}let w=G+J[0].length,q=!1,W=!1,U=-1;while(w<X.length){let B=X[w];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!FH.test(K))continue;let z=X[U-1]==="/",_=z?U-1:U;Z+=`${X.slice(Y,_)} x-cloak${z?" ":""}`,Y=_}return Z+=X.slice(Y),Z}var FH;var F3=E(()=>{M1();T0();FH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function V3(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],w=o0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:U}of VH){if(G.some((z)=>/\w/.test(z)&&W.includes(z)))continue;q.lastIndex=0;let K=w.match(q);if(K&&K.length>0){let z=w.split(`
11855
11855
  `),_=X.split(`
11856
11856
  `),B=[];z.forEach((L,F)=>{if(q.lastIndex=0,q.test(L))B.push(F+1)});let j=B.length>0?` (script line${B.length>1?"s":""} ${B.join(", ")})`:"",H=B.slice(0,3).map((L)=>` ${L} | ${(_[L-1]??"").trim().slice(0,100)}`).join(`
11857
11857
  `),O=H?`
@@ -11859,17 +11859,17 @@ ${H}`:"";Q.push(` \u2717 ${W}${j}
11859
11859
  \u2192 ${U}${O}`)}}if(Q.length>0&&J.enabled){let q=(K)=>{let z=`${process.cwd()}/`;return K.startsWith(z)?K.slice(z.length):K},U=`[STX] DOM API violation in ${Y&&Y!==$?`${q(Y)} (composed into ${q($)})`:q($)}:
11860
11860
  ${Q.join(`
11861
11861
  `)}
11862
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(U);else console.warn(U)}}var jH;var _3=E(()=>{jH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import HH from"fs";function P8(X){return[...X].sort().map(($)=>{try{let Z=HH.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
11863
- `)}function v8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function U1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var j3=()=>{};var FQ={};a(FQ,{getStoreScript:()=>OH,clearStoreCache:()=>FH});import x8 from"path";function LH(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function OH(X){let $;if(X)$=x8.resolve(X);else{let B=await d1();$=x8.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let B of Z.scan({cwd:$,absolute:!0})){let j=x8.basename(B,".ts");if(["index","types"].includes(j))continue;if(B.includes(".d.ts"))continue;Y.push(B)}}catch{return U1(t5,$,"",""),null}let J=P8(Y),G=v8(t5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return U1(t5,$,J,""),null;let Q=[];for(let B of Y){let j=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(j)})}Q.sort((B,j)=>{if(B.hasUseStore===j.hasUseStore)return 0;return B.hasUseStore?1:-1});let w=Q.map((B)=>B.file),q=[],W=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()});for(let B of w)try{let j=await Bun.file(B).text(),H=x8.basename(B,".ts");LH(j,W),j=m0(j),j=AX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=U.transformSync(j),q.push(`// Store: ${H}
11864
- ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load store ${B}:`,j)}if(q.length===0)return U1(t5,$,J,""),null;let K=q.join(`
11862
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(U);else console.warn(U)}}var VH;var A3=E(()=>{VH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import AH from"fs";function h8(X){return[...X].sort().map(($)=>{try{let Z=AH.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
11863
+ `)}function u8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function _1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var R3=()=>{};var TQ={};e(TQ,{getStoreScript:()=>MH,clearStoreCache:()=>TH});import d8 from"path";function RH(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function MH(X){let $;if(X)$=d8.resolve(X);else{let B=await c1();$=d8.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let B of Z.scan({cwd:$,absolute:!0})){let j=d8.basename(B,".ts");if(["index","types"].includes(j))continue;if(B.includes(".d.ts"))continue;Y.push(B)}}catch{return _1(Z7,$,"",""),null}let J=h8(Y),G=u8(Z7,$,J);if(G!==void 0)return G||null;if(Y.length===0)return _1(Z7,$,J,""),null;let Q=[];for(let B of Y){let j=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(j)})}Q.sort((B,j)=>{if(B.hasUseStore===j.hasUseStore)return 0;return B.hasUseStore?1:-1});let w=Q.map((B)=>B.file),q=[],W=new Set,U=I1({loader:"ts",target:"browser",define:d0()});for(let B of w)try{let j=await Bun.file(B).text(),H=d8.basename(B,".ts");RH(j,W),j=i0(j),j=NX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=U.transformSync(j),q.push(`// Store: ${H}
11864
+ ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load store ${B}:`,j)}if(q.length===0)return _1(Z7,$,J,""),null;let K=q.join(`
11865
11865
 
11866
11866
  `),_=`;(function(){
11867
11867
  var __stx = window.stx || {};
11868
- ${H1.filter((B)=>!W.has(B)&&new RegExp(`\\b${B}\\b`).test(K)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11868
+ ${F1.filter((B)=>!W.has(B)&&new RegExp(`\\b${B}\\b`).test(K)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11869
11869
  `)}
11870
11870
  ${K}
11871
- })();`;return U1(t5,$,J,_),_}function FH(){t5.clear()}var t5;var VQ=E(()=>{L1();D1();X1();j3();t5=new Map});var H3,yI;var AQ=E(()=>{H3=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],yI=new Set(H3)});var TQ={};a(TQ,{selectComposableFiles:()=>RQ,referencedFrameworkComposables:()=>MQ,getFrameworkComposableScript:()=>MH,clearFrameworkComposableCache:()=>AH,__setRuntimeOwnedForTest:()=>TH});import f8 from"path";function AH(){XX.clear()}function RQ(X){let $=new Map;for(let Z of X){let Y=f8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function RH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function MQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of VH){if(L3.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function MH(X,$){let Z=MQ(X);if(Z.length===0)return null;let Y=$??f8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=XX.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}),w=new Set(Z),q=[],W=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let j of B.scan({cwd:Y,absolute:!0}))U.push(j)}catch{return XX.set(J,""),null}U=RQ(U);for(let B of U){let j;try{j=await Bun.file(B).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${f8.basename(B).replace(/\.[jt]s$/,"")}
11872
- ${Q.transformSync(j).trim()}`);for(let O of H)W.add(O)}catch(O){console.warn(`[stx] framework composable ${f8.basename(B)} could not be bundled:`,O)}}let K=Z.filter((B)=>!W.has(B)&&!RH(X,B));if(K.length>0)console.warn(`[stx] could not bundle ${K.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return XX.set(J,""),null;let z=[...W].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
11871
+ })();`;return _1(Z7,$,J,_),_}function TH(){Z7.clear()}var Z7;var NQ=E(()=>{V1();S1();Z1();R3();L0();Z7=new Map});var M3,fI;var kQ=E(()=>{M3=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],fI=new Set(M3)});var DQ={};e(DQ,{selectComposableFiles:()=>IQ,referencedFrameworkComposables:()=>EQ,getFrameworkComposableScript:()=>EH,clearFrameworkComposableCache:()=>kH,__setRuntimeOwnedForTest:()=>DH});import m8 from"path";function kH(){YX.clear()}function IQ(X){let $=new Map;for(let Z of X){let Y=m8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function IH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function EQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of NH){if(T3.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function EH(X,$){let Z=EQ(X);if(Z.length===0)return null;let Y=$??m8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=YX.get(J);if(G!==void 0)return G||null;let Q=I1({loader:"ts",target:"browser",define:d0()}),w=new Set(Z),q=[],W=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let j of B.scan({cwd:Y,absolute:!0}))U.push(j)}catch{return YX.set(J,""),null}U=IQ(U);for(let B of U){let j;try{j=await Bun.file(B).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${m8.basename(B).replace(/\.[jt]s$/,"")}
11872
+ ${Q.transformSync(j).trim()}`);for(let O of H)W.add(O)}catch(O){console.warn(`[stx] framework composable ${m8.basename(B)} could not be bundled:`,O)}}let K=Z.filter((B)=>!W.has(B)&&!IH(X,B));if(K.length>0)console.warn(`[stx] could not bundle ${K.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return YX.set(J,""),null;let z=[...W].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
11873
11873
  `),_=`<script data-stx-framework-composables>
11874
11874
  ;(function(){
11875
11875
  var __s = window.stx = window.stx || {};
@@ -11878,15 +11878,15 @@ ${q.join(`
11878
11878
  `)}
11879
11879
  ${z}
11880
11880
  })();
11881
- </script>`;return XX.set(J,_),_}function TH(X){L3.clear();for(let $ of X)L3.add($)}var XX,L3,VH;var NQ=E(()=>{D1();AQ();XX=new Map,L3=new Set,VH=new Set(H3)});var IQ={};a(IQ,{getComposableScript:()=>EH,clearComposableCache:()=>DH});import $X from"path";function kQ(X){let $=$X.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function kH(X){if(X)return $X.resolve(X);let $=`<default>:${process.cwd()}`,Z=O3.get($);if(Z!==void 0)return Z;let Y=await IH();if(Y!==null)O3.set($,Y);return Y}async function IH(){let X=await d1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return $X.resolve($,Z);for(let Y of NH){let J=$X.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!kQ(Q))return J}catch{}}return null}async function EH(X){let $=await kH(X);if(!$)return null;let Z=[];try{let B=new Bun.Glob("**/*.ts");for await(let j of B.scan({cwd:$,absolute:!0})){if(kQ(j))continue;Z.push(j)}}catch{return U1(e5,$,"",""),null}let Y=P8(Z),J=v8(e5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return U1(e5,$,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}),Q=[],w=new Set,q=new Set;for(let B of Z)try{let j=await Bun.file(B).text(),H=$X.basename(B,".ts");for(let O of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])q.add(O[1]);try{for(let O of G.scan(j).exports)if(O!=="default")w.add(O)}catch{}j=m0(j),j=AX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=G.transformSync(j),Q.push(`// Composable: ${H}
11882
- ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${B}:`,j)}if(Q.length===0||w.size===0)return U1(e5,$,Y,""),null;let W=[...w].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
11881
+ </script>`;return YX.set(J,_),_}function DH(X){T3.clear();for(let $ of X)T3.add($)}var YX,T3,NH;var yQ=E(()=>{S1();kQ();L0();YX=new Map,T3=new Set,NH=new Set(M3)});var SQ={};e(SQ,{getComposableScript:()=>CH,clearComposableCache:()=>PH});import JX from"path";function bQ(X){let $=JX.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function bH(X){if(X)return JX.resolve(X);let $=`<default>:${process.cwd()}`,Z=N3.get($);if(Z!==void 0)return Z;let Y=await SH();if(Y!==null)N3.set($,Y);return Y}async function SH(){let X=await c1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return JX.resolve($,Z);for(let Y of yH){let J=JX.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!bQ(Q))return J}catch{}}return null}async function CH(X){let $=await bH(X);if(!$)return null;let Z=[];try{let B=new Bun.Glob("**/*.ts");for await(let j of B.scan({cwd:$,absolute:!0})){if(bQ(j))continue;Z.push(j)}}catch{return _1(Y7,$,"",""),null}let Y=h8(Z),J=u8(Y7,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return _1(Y7,$,Y,""),null;Z.sort();let G=I1({loader:"ts",target:"browser",define:d0()}),Q=[],w=new Set,q=new Set;for(let B of Z)try{let j=await Bun.file(B).text(),H=JX.basename(B,".ts");for(let O of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])q.add(O[1]);try{for(let O of G.scan(j).exports)if(O!=="default")w.add(O)}catch{}j=i0(j),j=NX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=G.transformSync(j),Q.push(`// Composable: ${H}
11882
+ ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${B}:`,j)}if(Q.length===0||w.size===0)return _1(Y7,$,Y,""),null;let W=[...w].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
11883
11883
  `),U=JSON.stringify([...w]),K=Q.join(`
11884
11884
 
11885
11885
  `),_=`;(function(){
11886
11886
  window.__composables = window.__composables || {};
11887
11887
  var __c = window.__composables;
11888
11888
  var __stx = window.stx || {};
11889
- ${H1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(K)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11889
+ ${F1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(K)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11890
11890
  `)}
11891
11891
  ${K}
11892
11892
  ${W}
@@ -11903,7 +11903,7 @@ ${W}
11903
11903
  }
11904
11904
  window[__n] = __c[__n];
11905
11905
  }
11906
- })();`;return U1(e5,$,Y,_),_}function DH(){e5.clear(),O3.clear()}var e5,O3,NH;var EQ=E(()=>{L1();D1();j3();X1();e5=new Map,O3=new Map,NH=["composables","functions"]});var yQ={};a(yQ,{processDeferDirectives:()=>PH});function yH(){return`stx-defer-${++DQ}`}function bH(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function SH(X,$,Z){let{trigger:Y,value:J}=bH($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)q=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function CH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11906
+ })();`;return _1(Y7,$,Y,_),_}function PH(){Y7.clear(),N3.clear()}var Y7,N3,yH;var CQ=E(()=>{V1();S1();R3();Z1();L0();Y7=new Map,N3=new Map,yH=["composables","functions"]});var vQ={};e(vQ,{processDeferDirectives:()=>hH});function vH(){return`stx-defer-${++PQ}`}function xH(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function fH(X,$,Z){let{trigger:Y,value:J}=xH($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)q=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function gH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11907
11907
  const observer = new IntersectionObserver((entries) => {
11908
11908
  if (entries[0].isIntersecting) {
11909
11909
  observer.disconnect();
@@ -11976,7 +11976,7 @@ else {
11976
11976
  ${J}
11977
11977
  })();
11978
11978
  </script>
11979
- `}function PH(X,$,Z){DQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let w=yH(),q=SH(J,G,Q),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>',K=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,_=CH(w,q);return`
11979
+ `}function hH(X,$,Z){PQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let w=vH(),q=fH(J,G,Q),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>',K=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,_=gH(w,q);return`
11980
11980
  <div id="${w}" class="stx-defer" data-defer-trigger="${q.trigger}">
11981
11981
  ${W}
11982
11982
  ${U}
@@ -11984,7 +11984,7 @@ else {
11984
11984
  ${K}
11985
11985
  </div>
11986
11986
  ${_}
11987
- `})}var DQ=0;var SQ={};a(SQ,{processTeleportDirectives:()=>gH,ensureTeleportTargets:()=>hH});function vH(){return`stx-teleport-${++bQ}`}function xH(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function fH(X,$){return`
11987
+ `})}var PQ=0;var fQ={};e(fQ,{processTeleportDirectives:()=>lH,ensureTeleportTargets:()=>cH});function uH(){return`stx-teleport-${++xQ}`}function dH(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function mH(X,$){return`
11988
11988
  <script>
11989
11989
  (function() {
11990
11990
  const source = document.getElementById('${X}');
@@ -12030,12 +12030,12 @@ else {
12030
12030
  });
12031
12031
  })();
12032
12032
  </script>
12033
- `}function gH(X,$,Z){bQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let w=vH(),{target:q,disabled:W}=xH(G),U=Q.trim();if(W)try{let z=!1;if(W==="true")z=!0;else if(W==="false")z=!1;else if(W in $)z=Boolean($[W]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let K=fH(w,q);return`
12033
+ `}function lH(X,$,Z){xQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let w=uH(),{target:q,disabled:W}=dH(G),U=Q.trim();if(W)try{let z=!1;if(W==="true")z=!0;else if(W==="false")z=!1;else if(W in $)z=Boolean($[W]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let K=mH(w,q);return`
12034
12034
  <div id="${w}" class="stx-teleport-source" style="display: none;">
12035
12035
  <template>${U}</template>
12036
12036
  </div>
12037
12037
  ${K}
12038
- `})}function hH(){return`
12038
+ `})}function cH(){return`
12039
12039
  <script>
12040
12040
  (function() {
12041
12041
  // Common teleport targets
@@ -12052,7 +12052,7 @@ else {
12052
12052
  });
12053
12053
  })();
12054
12054
  </script>
12055
- `}var bQ=0;var xQ={};a(xQ,{processTransitionDirectives:()=>lH,processTransitionAttributes:()=>nH,performLeave:()=>mH,performEnter:()=>dH,generateTransitionRuntime:()=>iH,generateTransitionCSS:()=>pH});function CQ(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function uH(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function PQ(X,$){return new Promise((Z)=>{let Y=$??uH(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function vQ(X){X.offsetHeight}async function dH(X,$={}){let Z=$.name||"stx",Y=CQ(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),vQ(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await PQ(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function mH(X,$={}){let Z=$.name||"stx",Y=CQ(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),vQ(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await PQ(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function lH(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let w=cH(G),q=w.name||"stx",W=w.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12055
+ `}var xQ=0;var dQ={};e(dQ,{processTransitionDirectives:()=>rH,processTransitionAttributes:()=>tH,performLeave:()=>nH,performEnter:()=>iH,generateTransitionRuntime:()=>aH,generateTransitionCSS:()=>oH});function gQ(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function pH(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function hQ(X,$){return new Promise((Z)=>{let Y=$??pH(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function uQ(X){X.offsetHeight}async function iH(X,$={}){let Z=$.name||"stx",Y=gQ(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),uQ(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await hQ(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function nH(X,$={}){let Z=$.name||"stx",Y=gQ(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),uQ(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await hQ(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function rH(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let w=sH(G),q=w.name||"stx",W=w.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12056
12056
  <div
12057
12057
  class="stx-transition-wrapper"
12058
12058
  data-transition="${q}"
@@ -12094,7 +12094,7 @@ else {
12094
12094
  });
12095
12095
  })();
12096
12096
  </script>
12097
- `})}function cH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function pH(){return`
12097
+ `})}function sH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function oH(){return`
12098
12098
  /* STX Transition Presets */
12099
12099
 
12100
12100
  /* Fade */
@@ -12281,7 +12281,7 @@ else {
12281
12281
  opacity: 1;
12282
12282
  max-height: 1000px;
12283
12283
  }
12284
- `}function iH(){return`
12284
+ `}function aH(){return`
12285
12285
  // STX Transition Runtime
12286
12286
  (function() {
12287
12287
  if (typeof window === 'undefined') return;
@@ -12370,7 +12370,7 @@ else {
12370
12370
 
12371
12371
  console.log('[stx] Transition runtime initialized');
12372
12372
  })();
12373
- `}function nH(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var gQ={};a(gQ,{withErrorBoundary:()=>fQ,processErrorBoundaryDirectives:()=>oH,generateErrorBoundaryRuntime:()=>$L,generateErrorBoundaryCSS:()=>XL,createErrorBoundary:()=>eH});function sH(){return`eb-${++rH}-${Date.now().toString(36)}`}function oH(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,w)=>{let q=sH(),W=aH(G||"");return tH(q,Q.trim(),w.trim(),W)})}function aH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function tH(X,$,Z,Y){let J=Y.logErrors!==!1;return`
12373
+ `}function tH(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var lQ={};e(lQ,{withErrorBoundary:()=>mQ,processErrorBoundaryDirectives:()=>$L,generateErrorBoundaryRuntime:()=>QL,generateErrorBoundaryCSS:()=>GL,createErrorBoundary:()=>JL});function XL(){return`eb-${++eH}-${Date.now().toString(36)}`}function $L(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,w)=>{let q=XL(),W=ZL(G||"");return YL(q,Q.trim(),w.trim(),W)})}function ZL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function YL(X,$,Z,Y){let J=Y.logErrors!==!1;return`
12374
12374
  <div class="stx-error-boundary" data-boundary-id="${X}" data-has-error="false">
12375
12375
  <div class="stx-error-boundary-content" data-boundary-content="${X}">
12376
12376
  ${$}
@@ -12490,7 +12490,7 @@ else {
12490
12490
  };
12491
12491
  })();
12492
12492
  </script>
12493
- `}async function fQ(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function eH(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>fQ(Y,X,Z)}function XL(){return`
12493
+ `}async function mQ(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function JL(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>mQ(Y,X,Z)}function GL(){return`
12494
12494
  /* STX Error Boundary Styles */
12495
12495
  .stx-error-boundary {
12496
12496
  position: relative;
@@ -12534,7 +12534,7 @@ else {
12534
12534
  color: #fecaca;
12535
12535
  }
12536
12536
  }
12537
- `}function $L(){return`
12537
+ `}function QL(){return`
12538
12538
  // STX Error Boundary Runtime
12539
12539
  (function() {
12540
12540
  if (typeof window === 'undefined') return;
@@ -12599,7 +12599,7 @@ else {
12599
12599
 
12600
12600
  console.log('[stx] Error boundary runtime initialized');
12601
12601
  })();
12602
- `}var rH=0;var hQ={};a(hQ,{renderSSRSuspense:()=>qL,processSuspenseDirectives:()=>JL,generateSuspenseRuntime:()=>UL,generateSuspenseCSS:()=>WL,createSSRSuspense:()=>wL});function YL(){return`suspense-${++ZL}-${Date.now().toString(36)}`}function JL(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,w)=>{let q=YL(),W=GL(G||"");return QL(q,Q.trim(),w.trim(),W)})}function GL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function QL(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
12602
+ `}var eH=0;var cQ={};e(cQ,{renderSSRSuspense:()=>BL,processSuspenseDirectives:()=>WL,generateSuspenseRuntime:()=>jL,generateSuspenseCSS:()=>_L,createSSRSuspense:()=>zL});function qL(){return`suspense-${++wL}-${Date.now().toString(36)}`}function WL(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,w)=>{let q=qL(),W=UL(G||"");return KL(q,Q.trim(),w.trim(),W)})}function UL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function KL(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
12603
12603
  <div class="stx-suspense" data-suspense-id="${X}" data-custom-id="${G}" data-status="pending">
12604
12604
  <div class="stx-suspense-fallback" data-suspense-fallback="${X}">
12605
12605
  ${Z}
@@ -12789,7 +12789,7 @@ else {
12789
12789
  }, 0);
12790
12790
  })();
12791
12791
  </script>
12792
- `}function wL(X,$,Z){return{id:X,fallback:Z,content:$}}async function qL(X){let $=X.map((Y)=>`
12792
+ `}function zL(X,$,Z){return{id:X,fallback:Z,content:$}}async function BL(X){let $=X.map((Y)=>`
12793
12793
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
12794
12794
  ${Y.fallback}
12795
12795
  </div>
@@ -12814,7 +12814,7 @@ else {
12814
12814
  }
12815
12815
  })();
12816
12816
  </script>
12817
- `}}return{initial:$,streaming:Z()}}function WL(){return`
12817
+ `}}return{initial:$,streaming:Z()}}function _L(){return`
12818
12818
  /* STX Suspense Styles */
12819
12819
  .stx-suspense {
12820
12820
  position: relative;
@@ -12870,7 +12870,7 @@ else {
12870
12870
  background-size: 200% 100%;
12871
12871
  }
12872
12872
  }
12873
- `}function UL(){return`
12873
+ `}function jL(){return`
12874
12874
  // STX Suspense Runtime
12875
12875
  (function() {
12876
12876
  if (typeof window === 'undefined') return;
@@ -12937,7 +12937,7 @@ else {
12937
12937
 
12938
12938
  console.log('[stx] Suspense runtime initialized');
12939
12939
  })();
12940
- `}var ZL=0;var lQ={};a(lQ,{processAsyncDirectives:()=>zL,isAsyncComponent:()=>_L,generateAsyncComponentRuntime:()=>HL,generateAsyncComponentCSS:()=>jL,defineAsyncComponent:()=>BL});function uQ(){return`async-${++KL}-${Date.now().toString(36)}`}function zL(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,w,q,W)=>{let U=uQ(),K=dQ(w);return mQ(U,K,q.trim(),W.trim())}),G=G.replace(J,(Q,w,q)=>{let W=uQ(),U=dQ(w);return mQ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function dQ(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){case"component":$.component=G||w||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=w==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||w;break;case"errorComponent":$.errorComponent=G||w;break}}return $}function mQ(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:q}=$;return`
12940
+ `}var wL=0;var rQ={};e(rQ,{processAsyncDirectives:()=>LL,isAsyncComponent:()=>FL,generateAsyncComponentRuntime:()=>AL,generateAsyncComponentCSS:()=>VL,defineAsyncComponent:()=>OL});function pQ(){return`async-${++HL}-${Date.now().toString(36)}`}function LL(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,w,q,W)=>{let U=pQ(),K=iQ(w);return nQ(U,K,q.trim(),W.trim())}),G=G.replace(J,(Q,w,q)=>{let W=pQ(),U=iQ(w);return nQ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function iQ(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){case"component":$.component=G||w||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=w==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||w;break;case"errorComponent":$.errorComponent=G||w;break}}return $}function nQ(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:q}=$;return`
12941
12941
  <div class="stx-async-component" data-async-id="${X}" data-component="${J}" data-status="pending">
12942
12942
  <div class="stx-async-loading" data-async-loading="${X}">
12943
12943
  ${Z}
@@ -13164,7 +13164,7 @@ catch (error) {
13164
13164
  loadComponent();
13165
13165
  })();
13166
13166
  </script>
13167
- `}function BL(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function _L(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function jL(){return`
13167
+ `}function OL(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function FL(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function VL(){return`
13168
13168
  /* STX Async Component Styles */
13169
13169
  .stx-async-component {
13170
13170
  position: relative;
@@ -13238,7 +13238,7 @@ catch (error) {
13238
13238
  background-size: 200% 100%;
13239
13239
  }
13240
13240
  }
13241
- `}function HL(){return`
13241
+ `}function AL(){return`
13242
13242
  // STX Async Component Runtime
13243
13243
  (function() {
13244
13244
  if (typeof window === 'undefined') return;
@@ -13292,7 +13292,7 @@ catch (error) {
13292
13292
 
13293
13293
  console.log('[stx] Async component runtime initialized');
13294
13294
  })();
13295
- `}var KL=0;var pQ={};a(pQ,{shouldCacheComponent:()=>RL,processKeepAliveDirectives:()=>OL,onDeactivated:()=>kL,onActivated:()=>NL,generateKeepAliveRuntime:()=>TL,generateKeepAliveCSS:()=>ML,createKeepAliveCache:()=>AL});function cQ(){return`keep-alive-${++LL}-${Date.now().toString(36)}`}function OL(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let w=cQ(),q=FL(G||"");return VL(w,Q.trim(),q)})}function FL(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function VL(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
13295
+ `}var HL=0;var oQ={};e(oQ,{shouldCacheComponent:()=>IL,processKeepAliveDirectives:()=>ML,onDeactivated:()=>bL,onActivated:()=>yL,generateKeepAliveRuntime:()=>DL,generateKeepAliveCSS:()=>EL,createKeepAliveCache:()=>kL});function sQ(){return`keep-alive-${++RL}-${Date.now().toString(36)}`}function ML(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let w=sQ(),q=TL(G||"");return NL(w,Q.trim(),q)})}function TL(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function NL(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
13296
13296
  <div class="stx-keep-alive" data-keep-alive-id="${X}" data-custom-id="${Q}">
13297
13297
  <div class="stx-keep-alive-content" data-keep-alive-content="${X}">
13298
13298
  ${$}
@@ -13579,7 +13579,7 @@ else {
13579
13579
  });
13580
13580
  })();
13581
13581
  </script>
13582
- `}function AL(X={}){return{id:X.id||cQ(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function RL(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function ML(){return`
13582
+ `}function kL(X={}){return{id:X.id||sQ(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function IL(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function EL(){return`
13583
13583
  /* STX Keep-Alive Styles */
13584
13584
  .stx-keep-alive {
13585
13585
  position: relative;
@@ -13604,7 +13604,7 @@ else {
13604
13604
  .stx-keep-alive-content > [data-activated] {
13605
13605
  opacity: 1;
13606
13606
  }
13607
- `}function TL(){return`
13607
+ `}function DL(){return`
13608
13608
  // STX Keep-Alive Runtime
13609
13609
  (function() {
13610
13610
  if (typeof window === 'undefined') return;
@@ -13640,7 +13640,7 @@ else {
13640
13640
 
13641
13641
  console.log('[stx] Keep-alive runtime initialized');
13642
13642
  })();
13643
- `}function NL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function kL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var LL=0;var oQ={};a(oQ,{useVirtualList:()=>nQ,processVirtualListDirectives:()=>V3,processVirtualGridDirectives:()=>sQ,processInfiniteListDirectives:()=>rQ,generateVirtualListCSS:()=>iQ,default:()=>IL,createVirtualList:()=>F3});function F3(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=$,W=[...X],U=0,K=new Map;function z(){if(Q)return _();let R=Math.max(0,Math.floor(U/Z)-J),M=Math.ceil(Y/Z),T=Math.min(W.length-1,R+M+J*2);return{startIndex:R,endIndex:T}}function _(){let R=0,M=0,T=W.length-1;for(let k=0;k<W.length;k++){let N=K.get(k)||w;if(R+N>U){M=Math.max(0,k-J);break}R+=N}R=0;for(let k=0;k<W.length;k++){let N=K.get(k)||w;if(R+=N,R>U+Y){T=Math.min(W.length-1,k+J);break}}return{startIndex:M,endIndex:T}}function B(){if(Q){let R=0;for(let M=0;M<W.length;M++)R+=K.get(M)||w;return R}return W.length*Z}function j(R){if(Q){let M=0;for(let T=0;T<R;T++)M+=K.get(T)||w;return M}return R*Z}function H(){let{startIndex:R,endIndex:M}=z();return{startIndex:R,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:W.slice(R,M+1),itemHeights:new Map(K)}}function O(R,M="auto"){let T=j(R);L(T,M)}function L(R,M="auto"){U=Math.max(0,Math.min(R,B()-Y))}function F(){z()}function V(R){W=[...R],K.clear(),F()}function A(){W=[],K.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function V3(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[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(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();U={...U,...F}}catch{}let K=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,j=Math.min(W.length-1,z+_),H="";for(let L=B;L<=j&&L<W.length;L++){let F=W[L],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));H+=`
13643
+ `}function yL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function bL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var RL=0;var $w={};e($w,{useVirtualList:()=>tQ,processVirtualListDirectives:()=>I3,processVirtualGridDirectives:()=>Xw,processInfiniteListDirectives:()=>eQ,generateVirtualListCSS:()=>aQ,default:()=>SL,createVirtualList:()=>k3});function k3(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=$,W=[...X],U=0,K=new Map;function z(){if(Q)return _();let R=Math.max(0,Math.floor(U/Z)-J),M=Math.ceil(Y/Z),T=Math.min(W.length-1,R+M+J*2);return{startIndex:R,endIndex:T}}function _(){let R=0,M=0,T=W.length-1;for(let N=0;N<W.length;N++){let k=K.get(N)||w;if(R+k>U){M=Math.max(0,N-J);break}R+=k}R=0;for(let N=0;N<W.length;N++){let k=K.get(N)||w;if(R+=k,R>U+Y){T=Math.min(W.length-1,N+J);break}}return{startIndex:M,endIndex:T}}function B(){if(Q){let R=0;for(let M=0;M<W.length;M++)R+=K.get(M)||w;return R}return W.length*Z}function j(R){if(Q){let M=0;for(let T=0;T<R;T++)M+=K.get(T)||w;return M}return R*Z}function H(){let{startIndex:R,endIndex:M}=z();return{startIndex:R,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:W.slice(R,M+1),itemHeights:new Map(K)}}function O(R,M="auto"){let T=j(R);L(T,M)}function L(R,M="auto"){U=Math.max(0,Math.min(R,B()-Y))}function F(){z()}function V(R){W=[...R],K.clear(),F()}function A(){W=[],K.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function I3(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[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(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();U={...U,...F}}catch{}let K=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,j=Math.min(W.length-1,z+_),H="";for(let L=B;L<=j&&L<W.length;L++){let F=W[L],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));H+=`
13644
13644
  <div class="virtual-item ${U.itemClass||""}"
13645
13645
  style="position: absolute; top: ${L*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
13646
13646
  data-index="${L}">
@@ -13717,7 +13717,7 @@ else {
13717
13717
  };
13718
13718
  })();
13719
13719
  </script>
13720
- `})}function iQ(){return`
13720
+ `})}function aQ(){return`
13721
13721
  .virtual-list-container {
13722
13722
  position: relative;
13723
13723
  overflow-y: auto;
@@ -13765,7 +13765,7 @@ else {
13765
13765
  0% { background-position: 200% 0; }
13766
13766
  100% { background-position: -200% 0; }
13767
13767
  }
13768
- `}function nQ(X,$){let Z=null,Y=()=>{if(!Z)Z=F3(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function rQ(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,w,q)=>{let W=G.trim(),U=$[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let B=Function(`return ${Q.trim()}`)();K={...K,...B}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,_=V3(`@virtualList(${W}, ${JSON.stringify({itemHeight:K.itemHeight,containerHeight:K.containerHeight,overscan:K.overscan,containerClass:K.containerClass})})${w}@endvirtualList`,$);return _=_.replace("</script>",`
13768
+ `}function tQ(X,$){let Z=null,Y=()=>{if(!Z)Z=k3(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function eQ(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,w,q)=>{let W=G.trim(),U=$[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let B=Function(`return ${Q.trim()}`)();K={...K,...B}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,_=I3(`@virtualList(${W}, ${JSON.stringify({itemHeight:K.itemHeight,containerHeight:K.containerHeight,overscan:K.overscan,containerClass:K.containerClass})})${w}@endvirtualList`,$);return _=_.replace("</script>",`
13769
13769
  // Infinite scroll detection
13770
13770
  container.addEventListener('scroll', function() {
13771
13771
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -13783,11 +13783,11 @@ else {
13783
13783
  ${q}
13784
13784
  </div>
13785
13785
  </div>
13786
- `})}function sQ(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[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(Q)try{let F=Function(`return ${Q.trim()}`)();U={...U,...F}}catch{}let K=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.length/U.columns),_=z*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),j=U.overscan||2,H=0,O=Math.min(z-1,B+j),L="";for(let F=H;F<=O;F++)for(let V=0;V<U.columns;V++){let A=F*U.columns+V;if(A>=W.length)break;let R=W[A],M=V*(100/U.columns),T=F*(U.rowHeight+(U.gap||0)),k=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));L+=`
13786
+ `})}function Xw(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[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(Q)try{let F=Function(`return ${Q.trim()}`)();U={...U,...F}}catch{}let K=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.length/U.columns),_=z*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),j=U.overscan||2,H=0,O=Math.min(z-1,B+j),L="";for(let F=H;F<=O;F++)for(let V=0;V<U.columns;V++){let A=F*U.columns+V;if(A>=W.length)break;let R=W[A],M=V*(100/U.columns),T=F*(U.rowHeight+(U.gap||0)),N=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));L+=`
13787
13787
  <div class="virtual-grid-item"
13788
13788
  style="position: absolute; top: ${T}px; left: ${M}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
13789
13789
  data-index="${A}">
13790
- ${k}
13790
+ ${N}
13791
13791
  </div>`}return`
13792
13792
  <div id="${K}"
13793
13793
  class="virtual-grid-container"
@@ -13853,7 +13853,7 @@ else {
13853
13853
  });
13854
13854
  })();
13855
13855
  </script>
13856
- `})}var IL;var aQ=E(()=>{IL={createVirtualList:F3,processVirtualListDirectives:V3,processInfiniteListDirectives:rQ,processVirtualGridDirectives:sQ,generateVirtualListCSS:iQ,useVirtualList:nQ}});function tQ(){return`<script data-stx-hydration-runtime>
13856
+ `})}var SL;var Zw=E(()=>{SL={createVirtualList:k3,processVirtualListDirectives:I3,processInfiniteListDirectives:eQ,processVirtualGridDirectives:Xw,generateVirtualListCSS:aQ,useVirtualList:tQ}});function Yw(){return`<script data-stx-hydration-runtime>
13857
13857
  (function() {
13858
13858
  'use strict';
13859
13859
 
@@ -14013,7 +14013,7 @@ else {
14013
14013
  stxIslands.initIslands();
14014
14014
  }
14015
14015
  })();
14016
- </script>`}function eQ(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Xw(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var Kw={};a(Kw,{processStaticDirectives:()=>Ww,processPartialHydrationDirectives:()=>Zw,onHydrated:()=>qw,isHydrated:()=>ww,hydrateIsland:()=>Jw,hydrateByStrategy:()=>Gw,hydrateAll:()=>Qw,generatePartialHydrationCSS:()=>Yw,generateIslandManifest:()=>Uw,default:()=>vL,createIslandRegistry:()=>$w});function $w(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function EL(X){return`
14016
+ </script>`}function Jw(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Gw(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var Hw={};e(Hw,{processStaticDirectives:()=>_w,processPartialHydrationDirectives:()=>ww,onHydrated:()=>Bw,isHydrated:()=>zw,hydrateIsland:()=>Ww,hydrateByStrategy:()=>Uw,hydrateAll:()=>Kw,generatePartialHydrationCSS:()=>qw,generateIslandManifest:()=>jw,default:()=>uL,createIslandRegistry:()=>Qw});function Qw(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function CL(X){return`
14017
14017
  <script data-hydrate="${X}">
14018
14018
  (function() {
14019
14019
  const island = document.querySelector('[data-island="${X}"]');
@@ -14024,7 +14024,7 @@ else {
14024
14024
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
14025
14025
  })();
14026
14026
  </script>
14027
- `}function DL(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
14027
+ `}function PL(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
14028
14028
  <script data-hydrate="${X}">
14029
14029
  (function() {
14030
14030
  const island = document.querySelector('[data-island="${X}"]');
@@ -14060,7 +14060,7 @@ else {
14060
14060
  }
14061
14061
  })();
14062
14062
  </script>
14063
- `}function yL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
14063
+ `}function vL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
14064
14064
  <script data-hydrate="${X}">
14065
14065
  (function() {
14066
14066
  const island = document.querySelector('[data-island="${X}"]');
@@ -14093,7 +14093,7 @@ else {
14093
14093
  }
14094
14094
  })();
14095
14095
  </script>
14096
- `}function bL(X,$){let Z=$.media||"(min-width: 768px)";return`
14096
+ `}function xL(X,$){let Z=$.media||"(min-width: 768px)";return`
14097
14097
  <script data-hydrate="${X}">
14098
14098
  (function() {
14099
14099
  const island = document.querySelector('[data-island="${X}"]');
@@ -14122,7 +14122,7 @@ else {
14122
14122
  }
14123
14123
  })();
14124
14124
  </script>
14125
- `}function SL(X){return`
14125
+ `}function fL(X){return`
14126
14126
  <script data-hydrate="${X}">
14127
14127
  (function() {
14128
14128
  const island = document.querySelector('[data-island="${X}"]');
@@ -14144,7 +14144,7 @@ else {
14144
14144
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
14145
14145
  })();
14146
14146
  </script>
14147
- `}function CL(X,$){let Z=$.event||"stx:activate";return`
14147
+ `}function gL(X,$){let Z=$.event||"stx:activate";return`
14148
14148
  <script data-hydrate="${X}">
14149
14149
  (function() {
14150
14150
  const island = document.querySelector('[data-island="${X}"]');
@@ -14165,9 +14165,9 @@ else {
14165
14165
  });
14166
14166
  })();
14167
14167
  </script>
14168
- `}function Zw(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=X7(Y,"load",$),Y=X7(Y,"idle",$),Y=X7(Y,"visible",$),Y=X7(Y,"media",$),Y=PL(Y),Y=X7(Y,"hover",$),Y=X7(Y,"event",$),J=G&&Y!==X,J)Y+=`
14169
- `+tQ();return Y}function X7(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let w={strategy:$};if(G)try{let j=G.split(",").map((H)=>H.trim());for(let H of j){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");w[O]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=eQ(Q.trim()),U=Xw(Q.trim(),Z),K=[];if(w.rootMargin)K.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)K.push(`data-threshold="${w.threshold}"`);if(w.media)K.push(`data-media="${w.media}"`);if(w.event)K.push(`data-event="${w.event}"`);if(W)K.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
14170
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch($){case"load":B=EL(q);break;case"idle":B=DL(q,w);break;case"visible":B=yL(q,w);break;case"media":B=bL(q,w);break;case"hover":B=SL(q);break;case"event":B=CL(q,w);break}return`
14168
+ `}function ww(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=J7(Y,"load",$),Y=J7(Y,"idle",$),Y=J7(Y,"visible",$),Y=J7(Y,"media",$),Y=hL(Y),Y=J7(Y,"hover",$),Y=J7(Y,"event",$),J=G&&Y!==X,J)Y+=`
14169
+ `+Yw();return Y}function J7(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let w={strategy:$};if(G)try{let j=G.split(",").map((H)=>H.trim());for(let H of j){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");w[O]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=Jw(Q.trim()),U=Gw(Q.trim(),Z),K=[];if(w.rootMargin)K.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)K.push(`data-threshold="${w.threshold}"`);if(w.media)K.push(`data-media="${w.media}"`);if(w.event)K.push(`data-event="${w.event}"`);if(W)K.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
14170
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch($){case"load":B=CL(q);break;case"idle":B=PL(q,w);break;case"visible":B=vL(q,w);break;case"media":B=xL(q,w);break;case"hover":B=fL(q);break;case"event":B=gL(q,w);break}return`
14171
14171
  <div data-island="${q}"
14172
14172
  data-strategy="${$}"
14173
14173
  ${K.join(`
@@ -14177,7 +14177,7 @@ else {
14177
14177
  ${Q.trim()}${_}
14178
14178
  </div>
14179
14179
  ${B}
14180
- `})}function PL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14180
+ `})}function hL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14181
14181
  <div data-island="${J}"
14182
14182
  data-strategy="only"
14183
14183
  class="stx-island stx-client-only">
@@ -14196,7 +14196,7 @@ else {
14196
14196
  }
14197
14197
  })();
14198
14198
  </script>
14199
- `})}function Yw(){return`
14199
+ `})}function qw(){return`
14200
14200
  /* Island base styles */
14201
14201
  .stx-island {
14202
14202
  display: contents;
@@ -14237,11 +14237,11 @@ else {
14237
14237
  .stx-island.hydrated {
14238
14238
  opacity: 1;
14239
14239
  }
14240
- `}function Jw(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Gw(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Qw(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function ww(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function qw(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function Ww(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function Uw(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
14240
+ `}function Ww(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Uw(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Kw(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function zw(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function Bw(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function _w(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function jw(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
14241
14241
  <script type="application/json" id="stx-island-manifest">
14242
14242
  ${JSON.stringify($)}
14243
14243
  </script>
14244
- `}var vL;var zw=E(()=>{vL={processPartialHydrationDirectives:Zw,processStaticDirectives:Ww,generatePartialHydrationCSS:Yw,generateIslandManifest:Uw,createIslandRegistry:$w,hydrateIsland:Jw,hydrateByStrategy:Gw,hydrateAll:Qw,isHydrated:ww,onHydrated:qw}});var Mw={};a(Mw,{watchMultiple:()=>Lw,watchEffect:()=>Ow,watch:()=>Hw,unref:()=>Bw,toRefs:()=>_w,throttledComputed:()=>Rw,stxWatchMultiple:()=>Lw,stxWatchEffect:()=>Ow,stxWatch:()=>Hw,stxUnref:()=>Bw,stxToRefs:()=>_w,stxThrottledComputed:()=>Rw,stxShallowRef:()=>jw,stxRef:()=>$7,stxIsRef:()=>c1,stxDebouncedComputed:()=>Aw,stxComputed:()=>YX,shallowRef:()=>jw,ref:()=>$7,processWatchDirectives:()=>Vw,processComputedDirectives:()=>Fw,isRef:()=>c1,default:()=>xL,debouncedComputed:()=>Aw,computed:()=>YX});function $7(X){let $=X,Z=new Set,Y={get value(){if(K1){let J=ZX.get(Y);if(!J)J=new Set,ZX.set(Y,J);J.add(K1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=ZX.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function c1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function Bw(X){return c1(X)?X.value:X}function _w(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=$7(X[Z]);return $}function jw(X){return $7(X)}function YX(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let z=K.value;q.forEach((_)=>_(z))}};function U(){w.clear();let z=K1;K1=W,g8.push(W);try{return Z()}finally{g8.pop(),K1=z}}let K={get value(){if(K1){let z=ZX.get(K);if(!z)z=new Set,ZX.set(K,z);z.add(K1)}if(Q){let z=U();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return K}function Hw(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,U=()=>{if(c1(X))return J?_5(X.value):X.value;return X()},K=()=>{if(!q||W)return;let B=U();if(w!==void 0&&Object.is(w,B)&&!J)return;let j=()=>{if($(B,w),w=J?_5(B):B,Q)_()};if(G==="sync")j();else if(G==="post")queueMicrotask(j);else Promise.resolve().then(j)},z=null;if(c1(X))z=X.subscribe(()=>K());else z=YX(X).subscribe(()=>K());if(Y)w=void 0,K();else w=U();let _=()=>{if(q=!1,z)z(),z=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function Lw(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((K)=>c1(K)?K.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let K=X.map((z)=>c1(z)?z.value:void 0);if($(K,G),G=[...K],J)U()},W=X.map((K)=>{if(c1(K))return K.subscribe(()=>q());return()=>{}});if(Y)q();let U=()=>{Q=!1,W.forEach((K)=>K())};return U.pause=()=>{w=!0},U.resume=()=>{w=!1},U}function Ow(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let q=K1;K1=Q,g8.push(Q);try{Y=X()}finally{g8.pop(),K1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function Fw(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function Vw(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
14244
+ `}var uL;var Lw=E(()=>{uL={processPartialHydrationDirectives:ww,processStaticDirectives:_w,generatePartialHydrationCSS:qw,generateIslandManifest:jw,createIslandRegistry:Qw,hydrateIsland:Ww,hydrateByStrategy:Uw,hydrateAll:Kw,isHydrated:zw,onHydrated:Bw}});var Ew={};e(Ew,{watchMultiple:()=>Rw,watchEffect:()=>Mw,watch:()=>Aw,unref:()=>Ow,toRefs:()=>Fw,throttledComputed:()=>Iw,stxWatchMultiple:()=>Rw,stxWatchEffect:()=>Mw,stxWatch:()=>Aw,stxUnref:()=>Ow,stxToRefs:()=>Fw,stxThrottledComputed:()=>Iw,stxShallowRef:()=>Vw,stxRef:()=>G7,stxIsRef:()=>n1,stxDebouncedComputed:()=>kw,stxComputed:()=>QX,shallowRef:()=>Vw,ref:()=>G7,processWatchDirectives:()=>Nw,processComputedDirectives:()=>Tw,isRef:()=>n1,default:()=>dL,debouncedComputed:()=>kw,computed:()=>QX});function G7(X){let $=X,Z=new Set,Y={get value(){if(j1){let J=GX.get(Y);if(!J)J=new Set,GX.set(Y,J);J.add(j1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=GX.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function n1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function Ow(X){return n1(X)?X.value:X}function Fw(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=G7(X[Z]);return $}function Vw(X){return G7(X)}function QX(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let z=K.value;q.forEach((_)=>_(z))}};function U(){w.clear();let z=j1;j1=W,l8.push(W);try{return Z()}finally{l8.pop(),j1=z}}let K={get value(){if(j1){let z=GX.get(K);if(!z)z=new Set,GX.set(K,z);z.add(j1)}if(Q){let z=U();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return K}function Aw(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,U=()=>{if(n1(X))return J?F5(X.value):X.value;return X()},K=()=>{if(!q||W)return;let B=U();if(w!==void 0&&Object.is(w,B)&&!J)return;let j=()=>{if($(B,w),w=J?F5(B):B,Q)_()};if(G==="sync")j();else if(G==="post")queueMicrotask(j);else Promise.resolve().then(j)},z=null;if(n1(X))z=X.subscribe(()=>K());else z=QX(X).subscribe(()=>K());if(Y)w=void 0,K();else w=U();let _=()=>{if(q=!1,z)z(),z=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function Rw(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((K)=>n1(K)?K.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let K=X.map((z)=>n1(z)?z.value:void 0);if($(K,G),G=[...K],J)U()},W=X.map((K)=>{if(n1(K))return K.subscribe(()=>q());return()=>{}});if(Y)q();let U=()=>{Q=!1,W.forEach((K)=>K())};return U.pause=()=>{w=!0},U.resume=()=>{w=!1},U}function Mw(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let q=j1;j1=Q,l8.push(Q);try{Y=X()}finally{l8.pop(),j1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function Tw(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function Nw(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
14245
14245
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
14246
14246
  (function() {
14247
14247
  // Watch implementation for ${G}
@@ -14253,9 +14253,9 @@ else {
14253
14253
  }
14254
14254
  })();
14255
14255
  </script>
14256
- `})}function _5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>_5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(_5(J),_5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(_5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=_5(X[Z]);return $}function Aw(X,$=100){let Z=$7(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return YX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function Rw(X,$=100){let Z=$7(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return YX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,g8,ZX,xL;var Tw=E(()=>{g8=[],ZX=new WeakMap;xL={ref:$7,computed:YX,watch:Hw,watchMultiple:Lw,watchEffect:Ow,isRef:c1,unref:Bw,toRefs:_w,shallowRef:jw,debouncedComputed:Aw,throttledComputed:Rw,processComputedDirectives:Fw,processWatchDirectives:Vw}});function JX(X,$){let Z={};for(let Y of X)Z[Y]=m1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=m1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function fL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function A3(X,$){let Z=Object.keys(X),Y=JX(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=JX(Z,()=>[]),G=JX(Z,()=>!1),Q=JX(Z,()=>!1),w=JX(Z,()=>!1),q=m1(!1);async function W(L){w[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,w[L]=!1,F.length===0}async function U(){q.set(!0);let L=await Promise.all(Z.map(W));return q.set(!1),L.every(Boolean)}function K(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function z(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function _(L,F){Y[L]=F,Q[L]=!0}function B(L,F=!0){if(G[L]=F,F)W(L)}function j(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:w[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await U())await L(fL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return q()||Z.some((L)=>w[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:U,validateField:W,reset:K,setValues:z,setFieldValue:_,setFieldTouched:B,getFieldState:j,handleSubmit:H}}var Nw;var kw=E(()=>{T8();Nw=A3});var yw={};a(yw,{v:()=>gL,useForm:()=>A3,processHasErrorsDirective:()=>Dw,processFormValidationDirectives:()=>hL,processErrorsDirective:()=>Ew,processErrorDirective:()=>Iw,defineForm:()=>Nw,Validator:()=>Z7});class Z7{rules=[];defaultValue="";addRule(X){let $=new Z7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new Z7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new Z7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function Iw(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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 Q.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
14257
- `)}catch{return""}})}function Ew(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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)=>Q.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
14258
- `)}catch{return""}})}function Dw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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 Q}catch{return""}})}function hL(X,$,Z){let Y=X;return Y=Iw(Y,$,Z),Y=Ew(Y,$,Z),Y=Dw(Y,$,Z),Y}var gL;var bw=E(()=>{kw();gL=new Z7});var Pw={};a(Pw,{processXElementDirectives:()=>uL,hasXElementDirectives:()=>Cw,generateXElementRuntime:()=>Sw});function Sw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14256
+ `})}function F5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>F5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(F5(J),F5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(F5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=F5(X[Z]);return $}function kw(X,$=100){let Z=G7(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return QX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function Iw(X,$=100){let Z=G7(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return QX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var j1=null,l8,GX,dL;var Dw=E(()=>{l8=[],GX=new WeakMap;dL={ref:G7,computed:QX,watch:Aw,watchMultiple:Rw,watchEffect:Mw,isRef:n1,unref:Ow,toRefs:Fw,shallowRef:Vw,debouncedComputed:kw,throttledComputed:Iw,processComputedDirectives:Tw,processWatchDirectives:Nw}});function wX(X,$){let Z={};for(let Y of X)Z[Y]=p1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=p1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function mL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function E3(X,$){let Z=Object.keys(X),Y=wX(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=wX(Z,()=>[]),G=wX(Z,()=>!1),Q=wX(Z,()=>!1),w=wX(Z,()=>!1),q=p1(!1);async function W(L){w[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,w[L]=!1,F.length===0}async function U(){q.set(!0);let L=await Promise.all(Z.map(W));return q.set(!1),L.every(Boolean)}function K(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function z(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function _(L,F){Y[L]=F,Q[L]=!0}function B(L,F=!0){if(G[L]=F,F)W(L)}function j(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:w[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await U())await L(mL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return q()||Z.some((L)=>w[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:U,validateField:W,reset:K,setValues:z,setFieldValue:_,setFieldTouched:B,getFieldState:j,handleSubmit:H}}var yw;var bw=E(()=>{D8();yw=E3});var vw={};e(vw,{v:()=>lL,useForm:()=>E3,processHasErrorsDirective:()=>Pw,processFormValidationDirectives:()=>cL,processErrorsDirective:()=>Cw,processErrorDirective:()=>Sw,defineForm:()=>yw,Validator:()=>Q7});class Q7{rules=[];defaultValue="";addRule(X){let $=new Q7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new Q7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new Q7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function Sw(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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 Q.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
14257
+ `)}catch{return""}})}function Cw(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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)=>Q.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
14258
+ `)}catch{return""}})}function Pw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)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 Q}catch{return""}})}function cL(X,$,Z){let Y=X;return Y=Sw(Y,$,Z),Y=Cw(Y,$,Z),Y=Pw(Y,$,Z),Y}var lL;var xw=E(()=>{bw();lL=new Q7});var hw={};e(hw,{processXElementDirectives:()=>pL,hasXElementDirectives:()=>gw,generateXElementRuntime:()=>fw});function fw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14259
14259
  (function() {
14260
14260
  'use strict';
14261
14261
 
@@ -14539,16 +14539,16 @@ else {
14539
14539
  // Expose for manual initialization
14540
14540
  window.XElement = XElement;
14541
14541
  })();
14542
- </script>`}function Cw(X){return/\bx-data(?:\s|=)/.test(X)}function uL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!Cw(Y))return Y;let J=Z[0]?.trim()||Sw(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
14542
+ </script>`}function gw(X){return/\bx-data(?:\s|=)/.test(X)}function pL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!gw(Y))return Y;let J=Z[0]?.trim()||fw(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
14543
14543
  `+Y.slice(G);return Y+`
14544
- `+J}var vw={};a(vw,{rewriteImagesWithSiblings:()=>lL});import N1 from"path";async function lL(X,$){let Z=$.formats??mL;if(!$.publicDir)return X;let Y=iL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec(X))!==null){let K=w[0],z=K.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(nL(w.index,Y))continue;Q.push({idx:w.index,length:K.length,src:z[1],raw:K})}if(Q.length===0)return X;let q=await Promise.all(Q.map(async(K)=>{let z=await cL(K.src,$.publicDir,Z);return{match:K,sources:z}}));for(let{match:K,sources:z}of q){if(z.length===0)continue;let B=`<picture>${z.map((j)=>`<source type="${j.mime}" srcset="${rL(j.url)}">`).join("")}${K.raw}</picture>`;J.push({start:K.idx,end:K.idx+K.length,replacement:B})}if(J.length===0)return X;let W="",U=0;for(let K of J)W+=X.slice(U,K.start),W+=K.replacement,U=K.end;return W+=X.slice(U),W}async function cL(X,$,Z){if(!pL(X))return[];let Y=N1.extname(X).toLowerCase();if(!dL.has(Y))return[];if(!X.startsWith("/"))return[];let J=N1.join($,X.slice(1)),G=N1.dirname(J),Q=N1.basename(J,Y),w=N1.resolve(G),q=N1.resolve($);if(!w.startsWith(q))return[];let W=N1.posix.dirname(X),U=Z.map(async(z)=>{let _=N1.join(G,`${Q}${z.ext}`);if(!await Bun.file(_).exists())return null;return{url:N1.posix.join(W,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(U)).filter((z)=>z!==null)}function pL(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function iL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function nL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function rL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var dL,mL;var xw=E(()=>{dL=new Set([".jpg",".jpeg",".png",".gif"]),mL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var fw=()=>{};function R3(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}var gw=E(()=>{fw()});var hw={};a(hw,{injectPwaTags:()=>sL,generateThemeColorMeta:()=>tL,generateSwRegistrationScript:()=>oL,generatePwaTags:()=>h8,generateManifestLink:()=>aL});function h8(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=R3(X),G=`
14544
+ `+J}var uw={};e(uw,{rewriteImagesWithSiblings:()=>rL});import D1 from"path";async function rL(X,$){let Z=$.formats??nL;if(!$.publicDir)return X;let Y=aL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec(X))!==null){let K=w[0],z=K.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(tL(w.index,Y))continue;Q.push({idx:w.index,length:K.length,src:z[1],raw:K})}if(Q.length===0)return X;let q=await Promise.all(Q.map(async(K)=>{let z=await sL(K.src,$.publicDir,Z);return{match:K,sources:z}}));for(let{match:K,sources:z}of q){if(z.length===0)continue;let B=`<picture>${z.map((j)=>`<source type="${j.mime}" srcset="${eL(j.url)}">`).join("")}${K.raw}</picture>`;J.push({start:K.idx,end:K.idx+K.length,replacement:B})}if(J.length===0)return X;let W="",U=0;for(let K of J)W+=X.slice(U,K.start),W+=K.replacement,U=K.end;return W+=X.slice(U),W}async function sL(X,$,Z){if(!oL(X))return[];let Y=D1.extname(X).toLowerCase();if(!iL.has(Y))return[];if(!X.startsWith("/"))return[];let J=D1.join($,X.slice(1)),G=D1.dirname(J),Q=D1.basename(J,Y),w=D1.resolve(G),q=D1.resolve($);if(!w.startsWith(q))return[];let W=D1.posix.dirname(X),U=Z.map(async(z)=>{let _=D1.join(G,`${Q}${z.ext}`);if(!await Bun.file(_).exists())return null;return{url:D1.posix.join(W,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(U)).filter((z)=>z!==null)}function oL(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function aL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function tL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function eL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var iL,nL;var dw=E(()=>{iL=new Set([".jpg",".jpeg",".png",".gif"]),nL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var mw=()=>{};function D3(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}var lw=E(()=>{mw()});var cw={};e(cw,{injectPwaTags:()=>XO,generateThemeColorMeta:()=>YO,generateSwRegistrationScript:()=>$O,generatePwaTags:()=>c8,generateManifestLink:()=>ZO});function c8(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=D3(X),G=`
14545
14545
  <!-- stx PWA Meta Tags -->
14546
14546
  <link rel="manifest" href="/manifest.json">
14547
- <meta name="theme-color" content="${M3(Z?.themeColor||"#000000")}">
14547
+ <meta name="theme-color" content="${y3(Z?.themeColor||"#000000")}">
14548
14548
  <meta name="mobile-web-app-capable" content="yes">
14549
14549
  <meta name="apple-mobile-web-app-capable" content="yes">
14550
14550
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
14551
- <meta name="apple-mobile-web-app-title" content="${M3(Z?.shortName||Z?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)G+=`
14551
+ <meta name="apple-mobile-web-app-title" content="${y3(Z?.shortName||Z?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)G+=`
14552
14552
  <link rel="apple-touch-icon" href="${Y}/apple-touch-icon.png">
14553
14553
  <link rel="apple-touch-icon" sizes="120x120" href="${Y}/apple-touch-icon-120x120.png">
14554
14554
  <link rel="apple-touch-icon" sizes="152x152" href="${Y}/apple-touch-icon-152x152.png">
@@ -14585,12 +14585,12 @@ if ('serviceWorker' in navigator) {
14585
14585
  });
14586
14586
  }
14587
14587
  </script>
14588
- <!-- End stx PWA -->`,G}function sL(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=h8($);return X.slice(0,J)+G+`
14589
- `+X.slice(J)}return X+h8($)}let Y=h8($);return X.replace("</head>",`${Y}
14590
- </head>`)}function oL(X){if(!X.pwa?.enabled)return"";return`<script>
14588
+ <!-- End stx PWA -->`,G}function XO(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=c8($);return X.slice(0,J)+G+`
14589
+ `+X.slice(J)}return X+c8($)}let Y=c8($);return X.replace("</head>",`${Y}
14590
+ </head>`)}function $O(X){if(!X.pwa?.enabled)return"";return`<script>
14591
14591
  if ('serviceWorker' in navigator) {
14592
14592
  window.addEventListener('load', function() {
14593
- navigator.serviceWorker.register('/${R3(X)}')
14593
+ navigator.serviceWorker.register('/${D3(X)}')
14594
14594
  .then(function(registration) {
14595
14595
  console.log('[PWA] Service Worker registered:', registration.scope);
14596
14596
  })
@@ -14599,46 +14599,46 @@ if ('serviceWorker' in navigator) {
14599
14599
  });
14600
14600
  });
14601
14601
  }
14602
- </script>`}function aL(){return'<link rel="manifest" href="/manifest.json">'}function tL(X){return`<meta name="theme-color" content="${M3(X)}">`}function M3(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var uw=E(()=>{gw()});import eL from"fs";import E0 from"path";function dw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XO(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(w)=>w+9<=Z&&X[w]==="<"&&X[w+1]==="/"&&(X[w+2]==="s"||X[w+2]==="S")&&(X[w+3]==="c"||X[w+3]==="C")&&(X[w+4]==="r"||X[w+4]==="R")&&(X[w+5]==="i"||X[w+5]==="I")&&(X[w+6]==="p"||X[w+6]==="P")&&(X[w+7]==="t"||X[w+7]==="T")&&(X[w+8]===">"||/\s/.test(X[w+8]));while(Y<Z){let w=X[Y];if(Q(Y))return Y;if(w==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
14602
+ </script>`}function ZO(){return'<link rel="manifest" href="/manifest.json">'}function YO(X){return`<meta name="theme-color" content="${y3(X)}">`}function y3(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var pw=E(()=>{lw()});import JO from"fs";import S0 from"path";function iw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GO(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(w)=>w+9<=Z&&X[w]==="<"&&X[w+1]==="/"&&(X[w+2]==="s"||X[w+2]==="S")&&(X[w+3]==="c"||X[w+3]==="C")&&(X[w+4]==="r"||X[w+4]==="R")&&(X[w+5]==="i"||X[w+5]==="I")&&(X[w+6]==="p"||X[w+6]==="P")&&(X[w+7]==="t"||X[w+7]==="T")&&(X[w+8]===">"||/\s/.test(X[w+8]));while(Y<Z){let w=X[Y];if(Q(Y))return Y;if(w==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
14603
14603
  `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(w==="/"&&X[Y+1]==="*"){let q=X.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,J=!0;continue}if(w==="/"&&J){let q=Y+1,W=!1;while(q<Z){let U=X[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
14604
14604
  `){q=-1;break}q++}if(q===-1){Y++,J=!1;continue}while(q<Z&&/[a-z]/.test(X[q]))q++;Y=q,J=!1;continue}if(w==="'"||w==='"'){let q=w;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===q){Y++;break}if(X[Y]===`
14605
- `)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function Y7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function mw(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function $O(X){let $=Y7(X,"data-stx-runtime");if(!$)return X;let Z=mw(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=mw(J);if(G===-1)return Y+`
14605
+ `)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function w7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function nw(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function QO(X){let $=w7(X,"data-stx-runtime");if(!$)return X;let Z=nw(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=nw(J);if(G===-1)return Y+`
14606
14606
  `+J;return J.slice(0,G)+Y+`
14607
- `+J.slice(G)}async function R0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=O1(X);let G=!$.__stxProcessingDepth;if(G)s2($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!f7()&&!gX())&&Z&&Z.endsWith(".stx"))d9(X,Z);try{return await OZ.timeAsync("template-processing",async()=>{let Q=await ZO(X,$,Z,Y,J);if(G)Q=K3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},W=($.__stx_runtime_head||null)??k9(),U=($.__stx_head_raw||"").trim(),K,z=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)K=z[1].trim(),U=U.replace(z[0],"").trim();let _=$.__sections?.title,B=W.title||K||_,j=!W.title&&(!!K||!!_),H={...w,...B&&{title:B},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,U].filter(Boolean).join(`
14608
- `),...W.htmlAttrs&&{htmlAttrs:DG(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},O=u4(Q);if(Q=CG(Q,H,{...j&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),O)Q=SG(Q,w),Q=yG(Q,H.htmlAttrs);let L=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&Q.includes("<head")){let A=L[1],R=V7(A);Q=Q.replace(/<head\b[^>]*>/i,(M)=>`${M}
14609
- <meta name="stx-layout" content="${dw(A)}">
14610
- <meta name="stx-layout-group" content="${dw(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?x7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=vX(Q,(R,M)=>`<body${M} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=bG(Q);let w=Y.app?.colorMode;if(w)Q=TG(Q,w);Q=kG(Q),Q=$O(Q)}if(G)try{let{getStoreScript:w}=await t("stx/store-loader",()=>Promise.resolve().then(() => (VQ(),FQ))),q=Y.storesDir,W=await w(q);if(W){let U=`<script data-stx-stores>${W}</script>`,K=Y7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14611
- `+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (NQ(),TQ))),q=await w(Q);if(q){let W=Y7(Q,"data-stx-stores")||Y7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
14612
- `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (EQ(),IQ))),q=Y.composablesDir,W=await w(q);if(W){let U=`<script data-stx-composables>${W}</script>`,K=Y7(Q,"data-stx-stores")||Y7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14613
- `+U+Q.slice(K.end)}}catch{}if(G)Q=NG(Q);if(G&&$.__stx_inject_css!==!1)Q=await W9(Q,void 0,Y.buildMode==="serve");if(G)Q=MG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof mX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new J5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(J1.log(q,{filePath:Z,context:$}),V9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return O9.createFallbackContent("Template Processing",q)}}async function ZO(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await GO(Z,$),JO($,w),q=await x5(()=>sJ(q,$,Z,w),q,(F)=>{J1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Q1(q,b7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=zG(q),q=await _Q(q,Z,J);let _={};q=k4(q,_);let B={...$.__sections||{}},j="",H=cZ(lZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14607
+ `+J.slice(G)}async function N0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=A1(X);let G=!$.__stxProcessingDepth;if(G)XZ($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!u7()&&!lX())&&Z&&Z.endsWith(".stx"))r9(X,Z);try{return await MZ.timeAsync("template-processing",async()=>{let Q=await wO(X,$,Z,Y,J);if(G)Q=O3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},W=($.__stx_runtime_head||null)??C9(),U=($.__stx_head_raw||"").trim(),K,z=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)K=z[1].trim(),U=U.replace(z[0],"").trim();let _=$.__sections?.title,B=W.title||K||_,j=!W.title&&(!!K||!!_),H={...w,...B&&{title:B},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,U].filter(Boolean).join(`
14608
+ `),...W.htmlAttrs&&{htmlAttrs:PG(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},O=n4(Q);if(Q=gG(Q,H,{...j&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),O)Q=fG(Q,w),Q=vG(Q,H.htmlAttrs);let L=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&Q.includes("<head")){let A=L[1],R=T7(A);Q=Q.replace(/<head\b[^>]*>/i,(M)=>`${M}
14609
+ <meta name="stx-layout" content="${iw(A)}">
14610
+ <meta name="stx-layout-group" content="${iw(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?h7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=uX(Q,(R,M)=>`<body${M} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=xG(Q);let w=Y.app?.colorMode;if(w)Q=DG(Q,w);Q=bG(Q),Q=QO(Q)}if(G)try{let{getStoreScript:w}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (NQ(),TQ))),q=Y.storesDir,W=await w(q);if(W){let U=`<script data-stx-stores>${W}</script>`,K=w7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14611
+ `+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await $0("stx/framework-composables",()=>Promise.resolve().then(() => (yQ(),DQ))),q=await w(Q);if(q){let W=w7(Q,"data-stx-stores")||w7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
14612
+ `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (CQ(),SQ))),q=Y.composablesDir,W=await w(q);if(W){let U=`<script data-stx-composables>${W}</script>`,K=w7(Q,"data-stx-stores")||w7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14613
+ `+U+Q.slice(K.end)}}catch{}if(G)Q=yG(Q);if(G&&$.__stx_inject_css!==!1)Q=await H9(Q,void 0,Y.buildMode==="serve");if(G)Q=EG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof nX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new W5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(Q1.log(q,{filePath:Z,context:$}),I9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return N9.createFallbackContent("Template Processing",q)}}async function wO(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!S0.isAbsolute(Y.partialsDir)?S0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!S0.isAbsolute(Y.componentsDir)?S0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!S0.isAbsolute(Y.layoutsDir)?S0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await UO(Z,$),WO($,w),q=await u5(()=>XG(q,$,Z,w),q,(F)=>{Q1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=W1(q,v7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=LG(q),q=await FQ(q,Z,J);let _={};q=C4(q,_);let B={...$.__sections||{}},j="",H=sZ(rZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14614
14614
  ${q.trim()}
14615
- @endsection`}if(!j&&!O&&w.defaultLayout){let F=h4(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=E0.dirname(Z),M=w.layoutsDir?E0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let k=E0.join(R,"_layout.stx");if(await n(k)){A=k;break}let N=E0.dirname(R);if(N===R||N.length<M.length)break;R=N}if(A)j=A;else if(w.layoutsDir){let T=E0.isAbsolute(w.layoutsDir)?w.layoutsDir:E0.resolve(process.cwd(),w.layoutsDir),k=E0.join(T,`${w.defaultLayout}.stx`);if(await n(k))j=k}if(j&&!V)q=`@section('content')
14615
+ @endsection`}if(!j&&!O&&w.defaultLayout){let F=i4(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=S0.dirname(Z),M=w.layoutsDir?S0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let N=S0.join(R,"_layout.stx");if(await n(N)){A=N;break}let k=S0.dirname(R);if(k===R||k.length<M.length)break;R=k}if(A)j=A;else if(w.layoutsDir){let T=S0.isAbsolute(w.layoutsDir)?w.layoutsDir:S0.resolve(process.cwd(),w.layoutsDir),N=S0.join(T,`${w.defaultLayout}.stx`);if(await n(N))j=N}if(j&&!V)q=`@section('content')
14616
14616
  ${q.trim()}
14617
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=J0(A.trim(),$);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",j5);else B[V]=A.trim();return""}),$.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return B[V]||A||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=I4(q,_),j){let F=[],V=b1(q),A=Q1(V.output,b5,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let k=M==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
14617
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Q0(A.trim(),$);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",V5);else B[V]=A.trim();return""}),$.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return B[V]||A||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=P4(q,_),j){let F=[],V=U1(q),A=W1(V.output,P5,(R,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,M,T)=>{let N=M==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(N)F.push(N);return""}),F.length>0){let R=F.join(`
14618
14618
  `);B.content=B.content?`${B.content}
14619
- ${R}`:R,$.__sections=B}}if(j)try{let F;if(E0.isAbsolute(j))F=j,J.add(j);else F=await x5(()=>T3(j,Z,Q,J),null,()=>{throw new J5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let D=Q.layoutsDir;if(D){let I=E0.isAbsolute(D)?D:E0.resolve(process.cwd(),D);k=eL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let N=`Layout not found: ${j} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(J1.log(Error(N),{layoutPath:j,filePath:Z,available:k},"error"),console.error(`[stx] ${N}`),Q.debug)throw new J5(N,Z);return q}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new J5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},N=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,b,y)=>{return k[b]=y.trim(),""});for(let[C,b]of Object.entries(k))if(B[C]&&B[C].includes(j5)){let y=B[C].indexOf(j5);B[C]=B[C].slice(0,y)+b+B[C].slice(y+j5.length)}else if(!B[C])B[C]=b;let D={...$,__sections:B},I=`@layout('${A[1]}')${N}`;return await R0(I,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=k4(R,_),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,N,D)=>{return T[N]=D.trim(),`@slot('${N}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,N,D)=>{if(B[N]){let I=B[N];if(I.includes(j5)){let C=T[N]||"",b=I.indexOf(j5);I=I.slice(0,b)+C+I.slice(b+j5.length)}return I}return D||""}),M=YO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=I4(M,_),$.__originalFilePath=Z,q=await lw(M,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14620
- ${q}`,K(q)}catch(F){return J1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await lw(q,$,Z,Q,J))}function YO(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function JO(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function GO(X,$){await x5(()=>QG(X,$),void 0,(Z)=>{J1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function QO(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (n5(),W8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));J1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function wO(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await t("stx/expressions",()=>Promise.resolve().then(() => (w1(),jZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return J1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function lw(X,$,Z,Y,J){let G=X,Q=Y;if(await QO(G,$,Z),G=await wO(G,$,Z),G=await lJ(G,$,Z),G=await cJ(G,$,Z),G=await OY(G,$,Z,Q),O1(G))G=G3(G,$),G=w3(G,$);G=Q3(G);let{processStreamDirectives:w}=await t("stx/streaming",()=>Promise.resolve().then(() => (u9(),h9)));G=w(G,$),G=R4(G,$,Z,Q),G=await LG(G,$,Z,Q,J),G=await q8(G,$,Z,Q,J),G=m6(G,$,Z,Q);let{processDeferDirectives:q}=await t("stx/defer",()=>Promise.resolve().then(() => yQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await t("stx/teleport",()=>Promise.resolve().then(() => SQ));G=W(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await t("stx/transitions",()=>Promise.resolve().then(() => xQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => gQ));G=z(G,$,Z);let{processSuspenseDirectives:_}=await t("stx/suspense",()=>Promise.resolve().then(() => hQ));G=_(G,$,Z);let{processAsyncDirectives:B}=await t("stx/async-components",()=>Promise.resolve().then(() => lQ));G=B(G,$,Z);let{processKeepAliveDirectives:j}=await t("stx/keep-alive",()=>Promise.resolve().then(() => pQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (aQ(),oQ)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (zw(),Kw)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (Tw(),Mw)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:M}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (bw(),yw)));G=M(G,$,Z);let{processHeadDirective:T,processTitleDirective:k,processMetaDirective:N,resetHead:D}=await t("stx/head",()=>Promise.resolve().then(() => (d7(),E9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)D();let I=T(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14621
- `;if(G=k(G,$),G=N(G,$),G=tJ(G),G=R9(G,$),G=HY(G),G=nJ(G),G=await N4(G,$,Z,Q,J),G=await q8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=a2(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=K3(G),G=A1(G,$,Z),G=M9(G,$),G=T9(G,$),G=oX(G,$),G=EY(G,$),G=DY(G,$),G=await sZ(G,$,Z,Q),G=await cw(G,$,Z),G=await PY(G,$,Z,Q),G=v6(G,$,Z,Q),G=XG(G,$,Z,Q),G=$G(G,$,Z),G=ZG(G,$,Z,Q),G=BY(G,$,Z,Q),G=W3(G,$),G=U3(G),G=HQ(G),!Q.skipEventDirectives)G=E2(G,$,Z);if(G=nZ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),e=S8(X);if(r&&e)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14619
+ ${R}`:R,$.__sections=B}}if(j)try{let F;if(S0.isAbsolute(j))F=j,J.add(j);else F=await u5(()=>b3(j,Z,Q,J),null,()=>{throw new W5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let N=[];try{let D=Q.layoutsDir;if(D){let I=S0.isAbsolute(D)?D:S0.resolve(process.cwd(),D);N=JO.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${j} (referenced from ${Z})`+(N.length>0?`. Available layouts: ${N.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Q1.log(Error(k),{layoutPath:j,filePath:Z,available:N},"error"),console.error(`[stx] ${k}`),Q.debug)throw new W5(k,Z);return q}let V=await u5(()=>Bun.file(F).text(),"",()=>{throw new W5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let N={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return N[b]=y.trim(),""});for(let[S,b]of Object.entries(N))if(B[S]&&B[S].includes(V5)){let y=B[S].indexOf(V5);B[S]=B[S].slice(0,y)+b+B[S].slice(y+V5.length)}else if(!B[S])B[S]=b;let D={...$,__sections:B},I=`@layout('${A[1]}')${k}`;return await N0(I,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=C4(R,_),T={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,k,D)=>{return T[k]=D.trim(),`@slot('${k}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,k,D)=>{if(B[k]){let I=B[k];if(I.includes(V5)){let S=T[k]||"",b=I.indexOf(V5);I=I.slice(0,b)+S+I.slice(b+V5.length)}return I}return D||""}),M=qO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=P4(M,_),$.__originalFilePath=Z,q=await rw(M,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14620
+ ${q}`,K(q)}catch(F){return Q1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await rw(q,$,Z,Q,J))}function qO(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function WO(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function UO(X,$){await u5(()=>KG(X,$),void 0,(Z)=>{Q1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function KO(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (a5(),_8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));Q1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function zO(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await $0("stx/expressions",()=>Promise.resolve().then(() => (K1(),VZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return Q1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function rw(X,$,Z,Y,J){let G=X,Q=Y;if(await KO(G,$,Z),G=await zO(G,$,Z),G=await rJ(G,$,Z),G=await sJ(G,$,Z),G=await MY(G,$,Z,Q),A1(G))G=z3(G,$),G=_3(G,$);G=B3(G);let{processStreamDirectives:w}=await $0("stx/streaming",()=>Promise.resolve().then(() => (n9(),i9)));G=w(G,$),G=D4(G,$,Z,Q),G=await RG(G,$,Z,Q,J),G=await B8(G,$,Z,Q,J),G=s6(G,$,Z,Q);let{processDeferDirectives:q}=await $0("stx/defer",()=>Promise.resolve().then(() => vQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await $0("stx/teleport",()=>Promise.resolve().then(() => fQ));G=W(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await $0("stx/transitions",()=>Promise.resolve().then(() => dQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => lQ));G=z(G,$,Z);let{processSuspenseDirectives:_}=await $0("stx/suspense",()=>Promise.resolve().then(() => cQ));G=_(G,$,Z);let{processAsyncDirectives:B}=await $0("stx/async-components",()=>Promise.resolve().then(() => rQ));G=B(G,$,Z);let{processKeepAliveDirectives:j}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => oQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (Zw(),$w)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (Lw(),Hw)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await $0("stx/computed",()=>Promise.resolve().then(() => (Dw(),Ew)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:M}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (xw(),vw)));G=M(G,$,Z);let{processHeadDirective:T,processTitleDirective:N,processMetaDirective:k,resetHead:D}=await $0("stx/head",()=>Promise.resolve().then(() => (c7(),v9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)D();let I=T(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14621
+ `;if(G=N(G,$),G=k(G,$),G=YG(G),G=D9(G,$),G=AY(G),G=tJ(G),G=await S4(G,$,Z,Q,J),G=await B8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=ZZ(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=O3(G),G=T1(G,$,Z),G=y9(G,$),G=b9(G,$),G=$8(G,$),G=CY(G,$),G=PY(G,$),G=await XY(G,$,Z,Q),G=await sw(G,$,Z),G=await hY(G,$,Z,Q),G=m6(G,$,Z,Q),G=GG(G,$,Z,Q),G=QG(G,$,Z),G=wG(G,$,Z,Q),G=OY(G,$,Z,Q),G=H3(G,$),G=L3(G),G=AQ(G),!Q.skipEventDirectives)G=v2(G,$,Z);if(G=tZ(G,$,Z),Q.debug){let s=/\bx-data\s*=/.test(G),X0=f8(X);if(s&&X0)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14622
14622
  Both work on the same page, but they manage separate scopes.
14623
- Prefer signals (state/derived/effect) for new components.`)}G=WG(G,$),G=await S1(G,$,Z),G=LQ(G),G=OQ(G),G=hZ(G);let{processXElementDirectives:C}=await t("stx/x-element",()=>Promise.resolve().then(() => Pw));G=C(G);let b=$.__originalFilePath||Z,y=t1($);if(G=await q3(G,Q,b,y),G=MY(G,$),G=await oJ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:e}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (xw(),vw)));G=await e(G,{publicDir:r})}if(Q.seo?.enabled)G=YG(G,$,Q);let v=(r,e,W0=!0)=>{if(!e)return r;let S0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),j0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(S0&&j0){if(W0)r=r.replace(j0[0],S0[0]);if(e=e.replace(S0[0],"").trim(),!e)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${e}
14624
- </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
14625
- ${e}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
14623
+ Prefer signals (state/derived/effect) for new components.`)}G=_G(G,$),G=await v1(G,$,Z),G=RQ(G),G=MQ(G),G=cZ(G);let{processXElementDirectives:S}=await $0("stx/x-element",()=>Promise.resolve().then(() => hw));G=S(G);let b=$.__originalFilePath||Z,y=J5($);if(G=await j3(G,Q,b,y),G=EY(G,$),G=await $G(G,$,Z,Q),Q.media?.image?.autoSiblings){let s=Q.publicDir||"public",{rewriteImagesWithSiblings:X0}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (dw(),uw)));G=await X0(G,{publicDir:s})}if(Q.seo?.enabled)G=qG(G,$,Q);let P=(s,X0,U0=!0)=>{if(!X0)return s;let h0=X0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),E0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(h0&&E0){if(U0)s=s.replace(E0[0],h0[0]);if(X0=X0.replace(h0[0],"").trim(),!X0)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${X0}
14624
+ </head>`);if(/<head\b[^>]*>/i.test(s))return s.replace(/(<head\b[^>]*>)/i,`$1
14625
+ ${X0}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
14626
14626
  <head>
14627
- ${e}
14628
- </head>`);return r},{renderHead:x,getHead:g}=await t("stx/head",()=>Promise.resolve().then(() => (d7(),E9))),p=$.__stx_runtime_head??g();if(p.title||p.meta?.length||p.link?.length){let r=x(p);if(r)G=v(G,r)}if(I.headContent)G=v(G,I.headContent,!p.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=KY(G,Q.csp,$);if(Q.analytics?.enabled)G=dZ(G,Q);if(Q.heatmap?.enabled)G=B2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (uw(),hw)));G=r(G,Q)}let y0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),b0=/\bSTX\.\w+/.test(G),i0=/window\.STX\s*=/.test(G);if(y0&&b0&&!i0){let e=`<script data-stx-scoped data-stx-run="once">
14629
- ${vZ()}
14630
- </script>`;if(G.includes("</head>")){let W0=G.indexOf("</head>"),j0=G.slice(0,W0).indexOf("<script");if(j0!==-1){let P=G.slice(0,j0),S=G.slice(j0);G=P+e+`
14631
- `+S}else G=G.replace("</head>",`${e}
14627
+ ${X0}
14628
+ </head>`);return s},{renderHead:x,getHead:f}=await $0("stx/head",()=>Promise.resolve().then(() => (c7(),v9))),c=$.__stx_runtime_head??f();if(c.title||c.meta?.length||c.link?.length){let s=x(c);if(s)G=P(G,s)}if(I.headContent)G=P(G,I.headContent,!c.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=HY(G,Q.csp,$);if(Q.analytics?.enabled)G=iZ(G,Q);if(Q.heatmap?.enabled)G=V2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:s}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (pw(),cw)));G=s(G,Q)}let I0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),f0=/\bSTX\.\w+/.test(G),g0=/window\.STX\s*=/.test(G);if(I0&&f0&&!g0){let X0=`<script data-stx-scoped data-stx-run="once">
14629
+ ${uZ()}
14630
+ </script>`;if(G.includes("</head>")){let U0=G.indexOf("</head>"),E0=G.slice(0,U0).indexOf("<script");if(E0!==-1){let C=G.slice(0,E0),g=G.slice(E0);G=C+X0+`
14631
+ `+g}else G=G.replace("</head>",`${X0}
14632
14632
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
14633
- ${e}`);else G=e+`
14634
- `+G}{let{scanScriptTags:r}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (e7(),C8))),e=[];for(let W0 of r(G)){if(!/\bserver\b/i.test(W0.attrs))continue;let S0=W0.start+W0.fullMatch.indexOf(">")+1,j0=XO(G,S0);if(j0===-1)continue;let P=j0+9;while(P<G.length&&/\s/.test(G[P]))P++;e.push({start:W0.start,end:P})}for(let W0=e.length-1;W0>=0;W0--){let{start:S0,end:j0}=e[W0];G=G.substring(0,S0)+G.substring(j0)}}let K0=_8(G,Z);if(K0.hasScoped)G=K0.html;let $0=$.__stx_event_bindings||[],N0=!1,t0=[],k1=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:O5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (e7(),C8)));for(let r of O5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))t0.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:e,content:W0}of t0){N0=!0;let S0=W0;B3(W0,Z,Y.strict,$.__originalFilePath);let j0=await e1(W0,{eventBindings:$0,attrs:e,hasColonDirectives:k1,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:y});G=G.replace(r,()=>j0)}if(N0)$.__stx_event_bindings=[];if(!N0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let e=p$(r);if(e){let W0=G.lastIndexOf("</body>");G=W0===-1?G+e:G.slice(0,W0)+e+`
14635
- `+G.slice(W0)}$.__stx_event_bindings=[]}}if(!eG(G)&&XQ(G))G=await I8(G,Q);if(G=$Q(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=zY(G,$.cspNonce);return G}var j5="<!--PARENT_CONTENT_PLACEHOLDER-->";var eX=E(()=>{U9();z9();Z5();A$();xZ();uZ();mZ();d$();R$();i$();y5();rZ();oZ();u7();_Y();LY();VY();TY();V1();d7();w1();yY();vY();mJ();iJ();M4();N3();aJ();P5();eJ();D4();T0();wG();UG();BG();OG();C4();x4();PG();e7();L4();jQ();z3();_3();A0();m9();e$();R7();E8();E8();z3();_3()});var pw=()=>{};var k3={};a(k3,{renderSlot:()=>nw,processSlots:()=>sw,parseSlots:()=>iw,parseSlotElement:()=>zO,extractSlotContent:()=>jO,applySlots:()=>HO});function qO(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function UO(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function KO(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=UO(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let _=qO(X,Q);if(_!==-1){let B=z[1]||z[2]||z[3];$.push({start:G,end:_,slotName:B,content:X.slice(Q,_-11).trim(),propsBinding:z[4]||void 0}),J=_;continue}}}if(!/\/\s*>$/.test(w)&&!WO.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function iw(X){let $={default:"",named:new Map},Z=X,Y=KO(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,U,K,z,_]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+j).trim(),O=`<${W}${H?" "+H:""}>${_}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,U,K,z]=Q,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(_+B).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function zO(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function nw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,U]=q.split(":").map((z)=>z.trim()),K=U||W;if($[W]!==void 0)Q[K]=$[W]}}else Q[G]=$;J=BO(J,Q)}return J}function BO(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=rw(J,$);return $1(String(G??""))}catch{return`{{ ${Y} }}`}})}function rw(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!w0(X))return;return q0(X,Object.keys($))(...Object.values($))}catch{return}}async function sw(X,$,Z){let Y=X;Y=await _O(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let U=$.named.get(w),K=W?.trim()||"",z=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=B.exec(z))!==null){let H=j[1],O=j[2];_[H]=rw(O,Z)}return await nw(U,_,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function _O(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function jO(X){let $=iw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function HO(X,$,Z,Y){return await sw(X,{default:$,named:Z},Y)}var WO;var I3=E(()=>{w1();A0();WO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import LO from"fs";import h from"path";function FO(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function ow(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function X5(X){return!VO(X)}function $5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function AO(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14636
- `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of B)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Z.has(B))$.push(B),Z.add(B);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Z.has(B))$.push(B),Z.add(B);return}let _=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Z.has(B))$.push(B),Z.add(B)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function RO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function MO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function TO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of RO(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=MO(W);if(U===-1)continue;let K=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=W.slice(U+1).trim();if(!z)continue;try{let _=Object.keys($),B=Function(..._,`"use strict"; return (${z});`);$[K]=B(..._.map((j)=>$[j]))}catch{}}}catch{}}async function Q8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?h.resolve(J.root):void 0,K=U??h.dirname(Y),z=[],_=(H)=>{if(H&&!z.includes(H))z.push(H)},B=Z.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_($),_(J._rootComponentsDir),_(h.join(h.dirname(Y),"components")),_(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)_(typeof H==="string"?H:null);if(U)_(h.resolve(U,"resources/views/components")),_(h.resolve(U,"resources/components")),_(h.resolve(U,"src/components")),_(h.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return n(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of z){let O=h.isAbsolute(H)?H:h.resolve(K,H);for(let L of W)if(await n(h.join(O,L)))return!0}return!1}function NO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function kO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function IO(X){let $=new Set,Z=/\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 Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function U5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (n5(),W8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let _=z&&z!=="load"&&NO(z)?z:"";try{let B=(S)=>S.split("-").map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join(""),j=(S)=>S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let S=[H,H.toLowerCase(),B(H),j(H)];for(let f of S)if(L.has(f)){O=L.get(f);break}}let F=[];if(!O){let S=[`${H}.stx`,`${B(H)}.stx`,`${j(H)}.stx`],f=[...new Set(S)],l=J.__originalFilePath,d=[];if(l){let U0=h.join(h.dirname(l),"components");d.push(U0)}if(Y)d.push(Y);let Q0=Q._rootComponentsDir;if(typeof Q0==="string"&&!d.includes(Q0))d.push(Q0);let L0=h.join(h.dirname(G),"components");if(!d.includes(L0))d.push(L0);if(Q.componentsDir&&Q.componentsDir!==Y&&!d.includes(Q.componentsDir))d.push(Q.componentsDir);let z1=Q._pluginComponentDirs;if(Array.isArray(z1)){for(let U0 of z1)if(typeof U0==="string"&&!d.includes(U0))d.push(U0)}let n0=typeof Q.root==="string"?h.resolve(Q.root):void 0,v0=n0??h.dirname(G),e0=[];if(n0)e0.push(h.resolve(n0,"resources/views/components")),e0.push(h.resolve(n0,"resources/components")),e0.push(h.resolve(n0,"src/components")),e0.push(h.resolve(n0,"components"));e0.push(h.resolve(import.meta.dir,"components"));for(let U0 of e0)if(!d.includes(U0))d.push(U0);let n1=[...new Set(d.map((U0)=>{if(!U0)return U0;return h.isAbsolute(U0)?U0:h.resolve(v0,U0)}))];d.length=0,d.push(...n1);let I1=`${H}\x00${G}\x00${n1.join("\x00")}`,F5=d8.get(I1);if(F5)if(await n(F5))O=F5;else d8.delete(I1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=h.resolve(h.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let U0 of d){if(!U0)continue;for(let s of f){let u0=h.join(U0,s);if(F.push(u0),await n(u0)){O=u0;break}}if(O)break;if(!O)try{let s=await import("fs");if(!s.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let w7=8,V5=[{path:U0,depth:0}];while(V5.length>0&&!O){let B1=V5.pop();if(B1.depth>=w7)continue;let qX;try{qX=s.readdirSync(B1.path,{withFileTypes:!0})}catch{continue}for(let WX of qX){if(!WX.isDirectory())continue;if(WX.name==="node_modules"||WX.name.startsWith("."))continue;let K6=h.join(B1.path,WX.name);for(let BW of f){let H$=h.join(K6,BW);if(F.push(H$),await n(H$)){O=H$;break}}if(O)break;V5.push({path:K6,depth:B1.depth+1})}}}catch{}if(O)break}if(O)d8.set(I1,O)}if(!O||!await n(O)){let S=F.length>0?`
14633
+ ${X0}`);else G=X0+`
14634
+ `+G}{let{scanScriptTags:s}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (ZX(),g8))),X0=[];for(let U0 of s(G)){if(!/\bserver\b/i.test(U0.attrs))continue;let h0=U0.start+U0.fullMatch.indexOf(">")+1,E0=GO(G,h0);if(E0===-1)continue;let C=E0+9;while(C<G.length&&/\s/.test(G[C]))C++;X0.push({start:U0.start,end:C})}for(let U0=X0.length-1;U0>=0;U0--){let{start:h0,end:E0}=X0[U0];G=G.substring(0,h0)+G.substring(E0)}}let X1=F8(G,Z);if(X1.hasScoped)G=X1.html;let r=$.__stx_event_bindings||[],D0=!1,z0=[],o1=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:K7}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (ZX(),g8)));for(let s of K7(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:X0,content:U0}of z0){D0=!0;let h0=U0;V3(U0,Z,Y.strict,$.__originalFilePath);let E0=await G5(U0,{eventBindings:r,attrs:X0,hasColonDirectives:o1,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:y});G=G.replace(s,()=>E0)}if(D0)$.__stx_event_bindings=[];if(!D0&&$.__stxProcessingDepth===1){let s=$.__stx_event_bindings||[];if(s.length>0){let X0=a$(s);if(X0){let U0=G.lastIndexOf("</body>");G=U0===-1?G+X0:G.slice(0,U0)+X0+`
14635
+ `+G.slice(U0)}$.__stx_event_bindings=[]}}if(!JQ(G)&&GQ(G))G=await S8(G,Q);if(G=QQ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=LY(G,$.cspNonce);return G}var V5="<!--PARENT_CONTENT_PLACEHOLDER-->";var J8=E(()=>{L9();F9();P1();I$();dZ();pZ();nZ();n$();E$();t$();C5();eZ();$Y();l7();FY();RY();NY();DY();M1();c7();K1();vY();uY();nJ();aJ();y4();S3();ZG();g5();JG();x4();L0();zG();jG();OG();MG();u4();l4();hG();ZX();T4();VQ();F3();A3();T0();s9();Q9();k7();C8();C8();F3();A3()});var ow=()=>{};var C3={};e(C3,{renderSlot:()=>tw,processSlots:()=>Xq,parseSlots:()=>aw,parseSlotElement:()=>LO,extractSlotContent:()=>VO,applySlots:()=>AO});function BO(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function jO(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function HO(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=jO(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let _=BO(X,Q);if(_!==-1){let B=z[1]||z[2]||z[3];$.push({start:G,end:_,slotName:B,content:X.slice(Q,_-11).trim(),propsBinding:z[4]||void 0}),J=_;continue}}}if(!/\/\s*>$/.test(w)&&!_O.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function aw(X){let $={default:"",named:new Map},Z=X,Y=HO(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,U,K,z,_]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+j).trim(),O=`<${W}${H?" "+H:""}>${_}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,U,K,z]=Q,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(_+B).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function LO(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function tw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,U]=q.split(":").map((z)=>z.trim()),K=U||W;if($[W]!==void 0)Q[K]=$[W]}}else Q[G]=$;J=OO(J,Q)}return J}function OO(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=ew(J,$);return Y1(String(G??""))}catch{return`{{ ${Y} }}`}})}function ew(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0(X))return;return W0(X,Object.keys($))(...Object.values($))}catch{return}}async function Xq(X,$,Z){let Y=X;Y=await FO(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let U=$.named.get(w),K=W?.trim()||"",z=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=B.exec(z))!==null){let H=j[1],O=j[2];_[H]=ew(O,Z)}return await tw(U,_,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function FO(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function VO(X){let $=aw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function AO(X,$,Z,Y){return await Xq(X,{default:$,named:Z},Y)}var _O;var P3=E(()=>{K1();T0();_O=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import RO from"fs";import h from"path";function TO(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function $q(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function Q5(X){return!NO(X)}function I1(X){let $;try{$=JSON.stringify(X)}catch{return new Bun.Transpiler(X)}let Z=p8.get($);if(Z)return Z;if(p8.size>=16)p8.clear();let Y=new Bun.Transpiler(X);return p8.set($,Y),Y}function w5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=I1({loader:"ts",target:"browser",define:d0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function kO(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14636
+ `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of B)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let B=K[2];if(!Z.has(B))$.push(B),Z.add(B);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Z.has(B))$.push(B),Z.add(B);return}let _=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Z.has(B))$.push(B),Z.add(B)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function IO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function EO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function DO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of IO(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=EO(W);if(U===-1)continue;let K=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=W.slice(U+1).trim();if(!z)continue;try{let _=Object.keys($),B=Function(..._,`"use strict"; return (${z});`);$[K]=B(..._.map((j)=>$[j]))}catch{}}}catch{}}async function K8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?h.resolve(J.root):void 0,K=U??h.dirname(Y),z=[],_=(H)=>{if(H&&!z.includes(H))z.push(H)},B=Z.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_($),_(J._rootComponentsDir),_(h.join(h.dirname(Y),"components")),_(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)_(typeof H==="string"?H:null);if(U)_(h.resolve(U,"resources/views/components")),_(h.resolve(U,"resources/components")),_(h.resolve(U,"src/components")),_(h.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return n(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of z){let O=h.isAbsolute(H)?H:h.resolve(K,H);for(let L of W)if(await n(h.join(O,L)))return!0}return!1}function yO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function bO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function SO(X){let $=new Set,Z=/\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 Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function j5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (a5(),_8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let _=z&&z!=="load"&&yO(z)?z:"";try{let B=(v)=>v.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),j=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let v=[H,H.toLowerCase(),B(H),j(H)];for(let m of v)if(L.has(m)){O=L.get(m);break}}let F=[];if(!O){let v=[`${H}.stx`,`${B(H)}.stx`,`${j(H)}.stx`],m=[...new Set(v)],K0=J.__originalFilePath,Y0=[];if(K0){let B0=h.join(h.dirname(K0),"components");Y0.push(B0)}if(Y)Y0.push(Y);let A0=Q._rootComponentsDir;if(typeof A0==="string"&&!Y0.includes(A0))Y0.push(A0);let R0=h.join(h.dirname(G),"components");if(!Y0.includes(R0))Y0.push(R0);if(Q.componentsDir&&Q.componentsDir!==Y&&!Y0.includes(Q.componentsDir))Y0.push(Q.componentsDir);let y1=Q._pluginComponentDirs;if(Array.isArray(y1)){for(let B0 of y1)if(typeof B0==="string"&&!Y0.includes(B0))Y0.push(B0)}let u0=typeof Q.root==="string"?h.resolve(Q.root):void 0,P0=u0??h.dirname(G),q1=[];if(u0)q1.push(h.resolve(u0,"resources/views/components")),q1.push(h.resolve(u0,"resources/components")),q1.push(h.resolve(u0,"src/components")),q1.push(h.resolve(u0,"components"));q1.push(h.resolve(import.meta.dir,"components"));for(let B0 of q1)if(!Y0.includes(B0))Y0.push(B0);let a1=[...new Set(Y0.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(P0,B0)}))];Y0.length=0,Y0.push(...a1);let t=`${H}\x00${G}\x00${a1.join("\x00")}`,$1=n8.get(t);if($1)if(await n($1))O=$1;else n8.delete(t);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=h.resolve(h.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let B0 of Y0){if(!B0)continue;for(let t1 of m){let e1=h.join(B0,t1);if(F.push(e1),await n(e1)){O=e1;break}}if(O)break;if(!O)try{let t1=await import("fs");if(!t1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let KX=8,M5=[{path:B0,depth:0}];while(M5.length>0&&!O){let H1=M5.pop();if(H1.depth>=KX)continue;let zX;try{zX=t1.readdirSync(H1.path,{withFileTypes:!0})}catch{continue}for(let BX of zX){if(!BX.isDirectory())continue;if(BX.name==="node_modules"||BX.name.startsWith("."))continue;let O6=h.join(H1.path,BX.name);for(let OW of m){let R$=h.join(O6,OW);if(F.push(R$),await n(R$)){O=R$;break}}if(O)break;M5.push({path:O6,depth:H1.depth+1})}}}catch{}if(O)break}if(O)n8.set(t,O)}if(!O||!await n(O)){let v=F.length>0?`
14637
14637
  Searched paths:
14638
- ${F.map((f)=>` - ${f}`).join(`
14639
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${S}`}q.add(O);let V;if(u8.has(O))V=u8.get(O);else try{V=await Bun.file(O).text(),u8.set(O,V)}catch(S){return`[Error loading component: ${S instanceof Error?S.message:String(S)}]`}let A=new Set(["__originalFilePath","__importedComponents",IX,"__stx_client_signal_names"]),R={};for(let[S,f]of Object.entries(J))if(!S.startsWith("__")||A.has(S))R[S]=f;let{extractSlotContent:M}=await t("stx/slots",()=>Promise.resolve().then(() => (I3(),k3))),T=M(Z),k={};if(T.defaultSlot?.trim())k.default=T.defaultSlot;for(let[S,f]of T.namedSlots)k[S]=f.content;let N={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:K,__sections:{},__stx_signals_gate:O1(V)||kO(Z)};TO(V,N);let D=V,I=h5(D);if(I)D=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...V.matchAll(C)],y=[],v=b.some((S)=>/\bserver\b/.test(S[1]||"")&&/\bcache\b/.test(S[1]||""))&&b.every((S)=>/\bserver\b/.test(S[1]||"")),x=null,g=null;if(v){let S=FO({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(S!==null){x=`${O}\x00${S}`;let f=E3.get(x);if(f){for(let l of f.dependencies)q.add(l);return f.output}g=new Set(q)}}for(let S of b){let f=S[1]||"",l=S[2]||"",d=f.includes("server");if(X5(f)&&l.trim())l=$5(l);if(d&&l)try{await W(l,N,O)}catch(L0){}if(!d){let L0=l.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),z1=L0.includes("{{")&&L0.includes("}}"),n0=L0.includes("{!!")&&L0.includes("!!}");if(z1||n0)L0=SX(L0,N);let v0=f.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");y.push(`<script${v0}>${L0}</script>`)}}let c=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=c?c[1]:"",y0=c?c[2]:"",b0="",i0=p&&/\bscoped\b/i.test(p);if(c)b0=`<style${p}>${y0}</style>`;let K0=D;if(K0=K0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),c)K0=K0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let S=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,f=[];if(K0=K0.replace(S,(l,d)=>{let Q0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Q0)f.push(`<style${Q0[1]}>${Q0[2]}</style>`);return""}),K0=K0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),f.length>0)b0=`${b0}${f.join(`
14640
- `)}`}if(Z&&K0.includes("{{ text || slot }}"))K0=K0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:$0}=await t("stx/slots",()=>Promise.resolve().then(() => (I3(),k3))),{defaultSlot:N0,namedSlots:t0}=T;K0=await $0(K0,N0,t0,N);let k1=y.some((S)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(S)),O5=IO(y),r=Array.isArray(N.__stx_client_signal_names)?N.__stx_client_signal_names:[];if(O5.length>0||r.length>0)N.__stx_client_signal_names=[...new Set([...r,...O5])];let e={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:k1||y.length===0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let W0=await R0(K0,N,O,e,q),S0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let S of W0.matchAll(/\{\{([\s\S]*?)\}\}/g))S0.add(S[1].trim());if(S0.size>0)J.__stx_preserved_client_expressions=[...S0];let j0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++OO}_${Math.random().toString(36).slice(2,8)}`,P=W0;if(k1){let S="";if(Object.keys($).length>0)try{S=` data-stx-props="${ow(JSON.stringify($))}"`}catch{}let f=_?` stx-hydrate="${ow(_)}"`:"";P=`<div data-stx-scope="${j0}"${S}${f}>${W0}</div>`;let l=await Promise.all(y.map(async(d)=>{let Q0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Q0)return d;let[,L0,z1]=Q0,n0=TX(z1,{filePath:O,projectRoot:process.cwd()}),v0=n0.code,e0=NX(n0.styles);v0=D5(v0).code;let{hasUserImports:n1,bundleClientScript:I1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (E7(),I7)));if(n1(v0))v0=await I1(v0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:F5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (e7(),C8)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(B1,qX)=>F5(qX));let U0=m0(v0),s=AO(U0),u0=`function(__scopeId) {
14641
- ${k5("const",[...H2,...s],U0)}
14638
+ ${F.map((m)=>` - ${m}`).join(`
14639
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${v}`}q.add(O);let V;if(i8.has(O))V=i8.get(O);else try{V=await Bun.file(O).text(),i8.set(O,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",SX,"__stx_client_signal_names"]),R={};for(let[v,m]of Object.entries(J))if(!v.startsWith("__")||A.has(v))R[v]=m;let M=U1(Z),T=[],N=M.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,m)=>{let K0=M.scripts[Number(m)]||"",Y0=K0.match(/^<script\b([^>]*)>/i)?.[1]||"",A0=Y0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),R0=!A0||["module","text/javascript","application/javascript"].includes(A0);if(!/\bserver\b/i.test(Y0)&&R0)return T.push(K0),"";return K0}),{extractSlotContent:k}=await $0("stx/slots",()=>Promise.resolve().then(() => (P3(),C3))),D=k(N),I={};if(D.defaultSlot?.trim())I.default=D.defaultSlot;for(let[v,m]of D.namedSlots)I[v]=m.content;let S={...R,...$,props:$,slot:N,$slots:I,__processedComponents:K,__sections:{},__stx_signals_gate:A1(V)||bO(Z)};DO(V,S);let b=V,y=l5(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...V.matchAll(P)],f=[],i=x.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&x.every((v)=>/\bserver\b/.test(v[1]||"")),c=null,I0=null;if(i){let v=TO({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){c=`${O}\x00${v}`;let m=v3.get(c);if(m){for(let K0 of m.dependencies)q.add(K0);return m.output}I0=new Set(q)}}for(let v of x){let m=v[1]||"",K0=v[2]||"",Y0=m.includes("server");if(Q5(m)&&K0.trim())K0=w5(K0);if(Y0&&K0)try{await W(K0,S,O)}catch(R0){}if(!Y0){let R0=K0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),y1=R0.includes("{{")&&R0.includes("}}"),u0=R0.includes("{!!")&&R0.includes("!!}");if(y1||u0)R0=fX(R0,S);let P0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${P0}>${R0}</script>`)}}let f0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g0=f0?f0[1]:"",X1=f0?f0[2]:"",r="",D0=g0&&/\bscoped\b/i.test(g0);if(f0)r=`<style${g0}>${X1}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(z0=z0.replace(v,(K0,Y0)=>{let A0=Y0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(A0)m.push(`<style${A0[1]}>${A0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)r=`${r}${m.join(`
14640
+ `)}`}if(Z&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:o1}=await $0("stx/slots",()=>Promise.resolve().then(() => (P3(),C3))),{defaultSlot:K7,namedSlots:s}=D;z0=await o1(z0,K7,s,S);let X0=f.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),U0=SO(f),h0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(U0.length>0||h0.length>0)S.__stx_client_signal_names=[...new Set([...h0,...U0])];let E0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:X0||f.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let C=await N0(z0,S,O,E0,q),g=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let v of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(v[1].trim());if(g.size>0)J.__stx_preserved_client_expressions=[...g];let a=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++MO}_${Math.random().toString(36).slice(2,8)}`,l=C;if(X0){let v="";if(Object.keys($).length>0)try{v=` data-stx-props="${$q(JSON.stringify($))}"`}catch{}let m=_?` stx-hydrate="${$q(_)}"`:"";l=`<div data-stx-scope="${a}"${v}${m}>${C}</div>`;let K0=await Promise.all(f.map(async(Y0)=>{let A0=Y0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!A0)return Y0;let[,R0,y1]=A0,u0=DX(y1,{filePath:O,projectRoot:process.cwd()}),P0=u0.code,q1=yX(u0.styles);P0=S5(P0).code;let{hasUserImports:a1,bundleClientScript:t}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (S7(),b7)));if(a1(P0))P0=await t(P0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:$1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (ZX(),g8)));P0=P0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(H1,zX)=>$1(zX));let B0=i0(P0),t1=kO(B0),e1=`function(__scopeId) {
14641
+ ${D5("const",[...M2,...t1],B0)}
14642
14642
  const __scope = window.stx._scopes = window.stx._scopes || {};
14643
14643
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
14644
14644
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -14652,12 +14652,12 @@ ${F.map((f)=>` - ${f}`).join(`
14652
14652
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
14653
14653
 
14654
14654
  try {
14655
- ${U0}
14655
+ ${B0}
14656
14656
 
14657
14657
  // Register all defined signals and functions in this scope
14658
14658
  const __localVars = {};
14659
14659
  try {
14660
- ${s.map((B1)=>`if (typeof ${B1} !== 'undefined') __localVars['${B1}'] = ${B1};`).join(`
14660
+ ${t1.map((H1)=>`if (typeof ${H1} !== 'undefined') __localVars['${H1}'] = ${H1};`).join(`
14661
14661
  `)}
14662
14662
  }
14663
14663
  catch (e) {}
@@ -14666,29 +14666,31 @@ catch (e) {}
14666
14666
  finally {
14667
14667
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
14668
14668
  }
14669
- }`,w7=_?null:o2(J,u0),V5=w7?`window.__stxComponentFactories[${JSON.stringify(w7)}](${JSON.stringify(j0)});`:`(${u0})(${JSON.stringify(j0)});`;if(_)return`${e0}<script type="stx/island" data-stx-island="${j0}" data-stx-scoped${L0}>${V5}</script>`;return`${e0}<script data-stx-scoped data-stx-run="always"${L0}>${V5}</script>`}));if(P=P+`
14670
- `+l.join(`
14671
- `),b0)P+=`
14672
- `+b0}else{if(b0)P+=`
14673
- `+b0;if(y.length>0){let S=N.__stx_event_bindings||[],f=t1(N),l=await Promise.all(y.map(async(d)=>{let Q0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Q0)return d;return await e1(Q0[1],{eventBindings:S,templateContent:P,filePath:O,projectRoot:process.cwd(),serverData:f})}));P+=`
14674
- `+l.join(`
14675
- `),N.__stx_event_bindings=[]}}if(i0){let S=_8(P,O);if(S.hasScoped)P=S.html}if(x&&g)E3.set(x,{output:P,dependencies:[...q].filter((S)=>!g.has(S))});return P}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete(X)}}async function n(X){return Bun.file(X).exists()}function D3(X,$){let Z=h.resolve($),Y=h.resolve(X),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function T3(X,$,Z,Y){let J=await EO(X,$,Z,Y);if(J===null)return null;let G=D3(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(D3(J,q))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function EO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=h.dirname($),G=process.cwd();if(X.startsWith("/")){let z=h.join(G,X),_=D3(z,G);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&Y)Y.add(_);return _}let Q=h.join(J,X);if(await n(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let _=`${Q}${z}`;if(await n(_)){if(Z.debug)console.log(`Found direct path with extension: ${_}`);if(Y)Y.add(_);return _}}let w="",q=h.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let _=h.join(q,"layouts"),B=!1;try{B=LO.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){w=_;break}let j=h.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,_=h.join(w,z);if(await n(_)){if(Z.debug)console.log(`Found in current layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!z.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.layoutsDir){let z=h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir),_=X.startsWith("layouts/")?X.slice(8):X,B=h.join(z,_);if(await n(B)){if(Z.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!X.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),_=h.join(Z.partialsDir||J,"layouts",z[1]);if(await n(_)){if(Z.debug)console.log(`Found in layouts path: ${_}`);if(Y)Y.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Z.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.partialsDir){if(w=h.join(Z.partialsDir,"layouts"),await n(w)){let z=h.join(w,X);if(await n(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let _=`${z}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}}let U=Z.partialsDir||h.join(process.cwd(),"views"),K=h.join(U,X);if(await n(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await n(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=h.join(h.dirname(J),"layouts",X);if(await n(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let _=`${z}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function aw(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14669
+ }`,KX=_?null:$Z(J,e1),M5=KX?`window.__stxComponentFactories[${JSON.stringify(KX)}](${JSON.stringify(a)});`:`(${e1})(${JSON.stringify(a)});`;if(_)return`${q1}<script type="stx/island" data-stx-island="${a}" data-stx-scoped${R0}>${M5}</script>`;return`${q1}<script data-stx-scoped data-stx-run="always"${R0}>${M5}</script>`}));if(l=l+`
14670
+ `+K0.join(`
14671
+ `),r)l+=`
14672
+ `+r}else{if(r)l+=`
14673
+ `+r;if(f.length>0){let v=S.__stx_event_bindings||[],m=J5(S),K0=await Promise.all(f.map(async(Y0)=>{let A0=Y0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!A0)return Y0;return await G5(A0[1],{eventBindings:v,templateContent:l,filePath:O,projectRoot:process.cwd(),serverData:m})}));l+=`
14674
+ `+K0.join(`
14675
+ `),S.__stx_event_bindings=[]}}if(D0){let v=F8(l,O);if(v.hasScoped)l=v.html}if(c&&I0)v3.set(c,{output:l,dependencies:[...q].filter((v)=>!I0.has(v))});return T.length>0?`${l}
14676
+ ${T.join(`
14677
+ `)}`:l}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete(X)}}async function n(X){return Bun.file(X).exists()}function x3(X,$){let Z=h.resolve($),Y=h.resolve(X),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function b3(X,$,Z,Y){let J=await CO(X,$,Z,Y);if(J===null)return null;let G=x3(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(x3(J,q))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function CO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=h.dirname($),G=process.cwd();if(X.startsWith("/")){let z=h.join(G,X),_=x3(z,G);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&Y)Y.add(_);return _}let Q=h.join(J,X);if(await n(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let _=`${Q}${z}`;if(await n(_)){if(Z.debug)console.log(`Found direct path with extension: ${_}`);if(Y)Y.add(_);return _}}let w="",q=h.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let _=h.join(q,"layouts"),B=!1;try{B=RO.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){w=_;break}let j=h.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,_=h.join(w,z);if(await n(_)){if(Z.debug)console.log(`Found in current layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!z.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.layoutsDir){let z=h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir),_=X.startsWith("layouts/")?X.slice(8):X,B=h.join(z,_);if(await n(B)){if(Z.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!X.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),_=h.join(Z.partialsDir||J,"layouts",z[1]);if(await n(_)){if(Z.debug)console.log(`Found in layouts path: ${_}`);if(Y)Y.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Z.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.partialsDir){if(w=h.join(Z.partialsDir,"layouts"),await n(w)){let z=h.join(w,X);if(await n(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let _=`${z}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}}let U=Z.partialsDir||h.join(process.cwd(),"views"),K=h.join(U,X);if(await n(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await n(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=h.join(h.dirname(J),"layouts",X);if(await n(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let _=`${z}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function Zq(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14676
14678
  `),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=$){Y=q+1,J=Q[q].trim();let W=Math.max(0,q-2),U=Math.min(Q.length,q+3);G=Q.slice(W,U).map((K,z)=>{let _=W+z+1;return`${_===Y?"> ":" "}${_}: ${K}`}).join(`
14677
- `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return aw(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function z0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=aw(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let K=Y.lastIndexOf(`
14679
+ `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return Zq(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function _0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=Zq(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let K=Y.lastIndexOf(`
14678
14680
  `,Math.max(0,J-1));W=J-(K+1)+1}let U="";if(Q>0)U+=`
14679
14681
  ${Z}:${Q}${W>0?`:${W}`:""}: ${X.toLowerCase()} error: ${$}
14680
14682
  `;if(U+=`
14681
- ${Y0.bold}${Y0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Y0.reset}
14682
- `,U+=`${Y0.bold}${Y0.red}\u2502${Y0.reset} ${Y0.bold}${Y0.bgRed} ERROR ${Y0.reset} ${Y0.red}${X} Error${Y0.reset}${" ".repeat(Math.max(0,43-X.length))}${Y0.bold}${Y0.red}\u2502${Y0.reset}
14683
- `,U+=`${Y0.bold}${Y0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Y0.reset}
14683
+ ${G0.bold}${G0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${G0.reset}
14684
+ `,U+=`${G0.bold}${G0.red}\u2502${G0.reset} ${G0.bold}${G0.bgRed} ERROR ${G0.reset} ${G0.red}${X} Error${G0.reset}${" ".repeat(Math.max(0,43-X.length))}${G0.bold}${G0.red}\u2502${G0.reset}
14685
+ `,U+=`${G0.bold}${G0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${G0.reset}
14684
14686
  `,U+=`
14685
- ${Y0.cyan}${Y0.bold}File:${Y0.reset} ${Y0.dim}${q}${Y0.reset}`,Q>0)U+=` ${Y0.gray}(line ${Q}${W>0?`, col ${W}`:""})${Y0.reset}`;if(U+=`
14686
- ${Y0.yellow}${Y0.bold}Message:${Y0.reset} ${$}
14687
+ ${G0.cyan}${G0.bold}File:${G0.reset} ${G0.dim}${q}${G0.reset}`,Q>0)U+=` ${G0.gray}(line ${Q}${W>0?`, col ${W}`:""})${G0.reset}`;if(U+=`
14688
+ ${G0.yellow}${G0.bold}Message:${G0.reset} ${$}
14687
14689
  `,w)U+=`
14688
- ${Y0.blue}${Y0.bold}Context:${Y0.reset}
14689
- ${Y0.dim}${w}${Y0.reset}
14690
- `;return U}function tG(){u8.clear(),d8.clear(),E3.clear()}var u8,d8,E3,OO=0,Y0;var T0=E(()=>{y5();e$();w1();X1();P5();eX();D1();C4();aX();R7();pw();n5();u8=new Y5(500),d8=new Y5(1000),E3=new Y5(2000);Y0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function cw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=w+Q[0].length,K=1,z=U,_=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14691
- `||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){_=O;break}z=O+12}}if(_===-1)continue;let B=X.slice(U,_),j=X.slice(w,_+12);J.push({fullMatch:j,options:W,content:B,index:w}),G.lastIndex=_+12}for(let{fullMatch:w,options:q,content:W,index:U}of J)try{let K={};if(q)q.split(",").forEach((B)=>{let j=B.trim();if(j)K[j]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},_=s1(W.trim(),z);Y=Y.split(w).join(_)}catch(K){let z=K instanceof Error?K.message:String(K),_=z0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,U,w);Y=Y.split(w).join(_)}return Y}async function tw(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),s1(X.trim(),J)}var N3=E(()=>{T0()});function bO(X){if(DO.set(X.name,X),X.client)yO.set(X.name,X.client)}function m8(X){return bO(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=SO(Y,X.defaults);if(X.validate){let q=X.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${X.name}`;throw Error(W)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let q=X.clientScript(Q);w+=`<script>${q}</script>`}if(X.css){let q=X.css(Q);w+=`<style>${q}</style>`}return w}}}function SO(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+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{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!$||!(q in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var DO,yO;var y3=E(()=>{DO=new Map,yO=new Map});function b3(X,$=J7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${QX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function ew(X,$,Z=CO,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${QX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function S3(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function QX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function C3(X){return PO[X]||"application/octet-stream"}var J7,CO,GX,PO;var P3=E(()=>{J7=[320,480,640,768,1024,1280,1536,1920,2560],CO=[1,1.5,2,3],GX=["avif","webp","jpeg"],PO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function xO(){try{return await import("ts-images")}catch{return null}}async function fO(X,$={}){let Z={...vO,...$},Y=await xO();if(Y)try{return await gO(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return hO(X,Z)}async function gO(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function hO(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function Xq(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
14690
+ ${G0.blue}${G0.bold}Context:${G0.reset}
14691
+ ${G0.dim}${w}${G0.reset}
14692
+ `;return U}function YQ(){i8.clear(),n8.clear(),v3.clear()}var i8,n8,v3,MO=0,p8,G0;var L0=E(()=>{C5();Q9();K1();Z1();g5();J8();S1();u4();Z8();k7();P1();ow();a5();i8=new q5(500),n8=new q5(1000),v3=new q5(2000);p8=new Map;G0={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 sw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=w+Q[0].length,K=1,z=U,_=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14693
+ `||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){_=O;break}z=O+12}}if(_===-1)continue;let B=X.slice(U,_),j=X.slice(w,_+12);J.push({fullMatch:j,options:W,content:B,index:w}),G.lastIndex=_+12}for(let{fullMatch:w,options:q,content:W,index:U}of J)try{let K={};if(q)q.split(",").forEach((B)=>{let j=B.trim();if(j)K[j]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},_=$5(W.trim(),z);Y=Y.split(w).join(_)}catch(K){let z=K instanceof Error?K.message:String(K),_=_0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,U,w);Y=Y.split(w).join(_)}return Y}async function Yq(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),$5(X.trim(),J)}var S3=E(()=>{L0()});function xO(X){if(PO.set(X.name,X),X.client)vO.set(X.name,X.client)}function r8(X){return xO(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=fO(Y,X.defaults);if(X.validate){let q=X.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${X.name}`;throw Error(W)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let q=X.clientScript(Q);w+=`<script>${q}</script>`}if(X.css){let q=X.css(Q);w+=`<style>${q}</style>`}return w}}}function fO(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+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{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!$||!(q in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var PO,vO;var f3=E(()=>{PO=new Map,vO=new Map});function g3(X,$=q7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${WX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function Jq(X,$,Z=gO,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${WX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function h3(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function WX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function u3(X){return hO[X]||"application/octet-stream"}var q7,gO,qX,hO;var d3=E(()=>{q7=[320,480,640,768,1024,1280,1536,1920,2560],gO=[1,1.5,2,3],qX=["avif","webp","jpeg"],hO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function dO(){try{return await import("ts-images")}catch{return null}}async function mO(X,$={}){let Z={...uO,...$},Y=await dO();if(Y)try{return await lO(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return cO(X,Z)}async function lO(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function cO(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function Gq(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
14692
14694
  #${X} {
14693
14695
  --stx-img-transition-duration: ${Y}ms;
14694
14696
  --stx-img-transition-easing: ${J};
@@ -14705,7 +14707,7 @@ ${Y0.dim}${w}${Y0.reset}
14705
14707
  #${X}.stx-img-loaded img {
14706
14708
  opacity: 1;
14707
14709
  }
14708
- `.trim()}async function $q(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(v3.has(Z))return v3.get(Z);let Y=await fO(X,$);return v3.set(Z,Y),Y}var vO,x3,v3;var Zq=E(()=>{vO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},x3=`
14710
+ `.trim()}async function Qq(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(m3.has(Z))return m3.get(Z);let Y=await mO(X,$);return m3.set(Z,Y),Y}var uO,l3,m3;var wq=E(()=>{uO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},l3=`
14709
14711
  .stx-img-placeholder {
14710
14712
  position: relative;
14711
14713
  overflow: hidden;
@@ -14734,20 +14736,20 @@ ${Y0.dim}${w}${Y0.reset}
14734
14736
  filter: blur(0);
14735
14737
  transform: scale(1);
14736
14738
  }
14737
- `.trim();v3=new Map});import{createHash as Jq}from"crypto";import{readFile as uO,stat as Gq}from"fs/promises";async function P0(X){try{let $=await uO(X);return Jq("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function Yq(X){return Jq("sha256").update(X).digest("hex").slice(0,16)}function l8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${Yq(X)}-${Yq(Z)}`}async function f3(X){try{return(await Gq(X)).mtimeMs}catch{return 0}}async function D0(X){try{return await Gq(X),!0}catch{return!1}}var H5=()=>{};import{mkdir as dO,readFile as mO,writeFile as lO,readdir as mD,rm as cO,stat as lD}from"fs/promises";import{join as wq,dirname as pO}from"path";async function iO(X){try{await dO(X,{recursive:!0})}catch{}}function qq(X,$,Z){return wq(X,Z,`${$}.json`)}async function Qq(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await f3($)!==X.srcMtime)return!1;return!0}async function c8(X,$,Z,Y=g3){if(!Y.enabled)return null;let J=l8(X,$),G=G7.get(J);if(G){if(await Qq(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;G7.delete(J)}let Q=qq(Y.directory,J,Z);if(await D0(Q))try{let w=await mO(Q,"utf-8"),q=JSON.parse(w);if(await Qq(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),G7.set(J,q),q.data}catch{}return null}async function p8(X,$,Z,Y,J=g3){if(!J.enabled)return;let G=l8(X,$),Q=await P0(X),w=await f3(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:l8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};G7.set(G,q);let W=qq(J.directory,G,Y);try{await iO(pO(W)),await lO(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function i8(X,$=g3){if(X==="all")G7.clear();else G7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=wq($.directory,Y);try{await cO(J,{recursive:!0,force:!0})}catch{}}}var G7,g3;var h3=E(()=>{H5();G7=new Map,g3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class r8{config;constructor(X={}){this.config={...nO,...X}}async get(X,$){return c8(X,$,"image",this.config)}async set(X,$,Z){return p8(X,$,Z,"image",this.config)}async clear(){return i8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function u3(X){if(!n8)n8=new r8(X);else if(X)n8.updateConfig(X);return n8}async function s8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return u3(Y).get(X,$)}async function o8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return u3(J).set(X,$,Z)}async function Wq(){return u3().clear()}var nO,n8=null;var d3=E(()=>{h3();nO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as rO,basename as sO,extname as oO,join as aO}from"path";import{mkdir as tO}from"fs/promises";async function m3(){try{return await import("ts-images")}catch{return null}}function Uq(X){switch(X){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 eO(X,$){let Z=$?Uq($):Uq("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function Kq(X,$,Z){let Y=await m3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await s8(X,$,Z);if(J)return J;try{let G=rO(X);if(!await D0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=eO(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await tO(w,{recursive:!0});let W=await P0(G),U=sO(X,oO(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},_=null;if($.transformations&&$.transformations.length>0)_=await l3(G,$.transformations,Y);for(let B of K){let j=Q[B]||{},H=`${U}-${W}.${B}`,O=aO(w,H);try{let L=await Y.optimizeImage({input:_||G,output:O,format:B,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(G);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if($.useDominantColor)try{let B=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await o8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function zq(X,$,Z,Y){let J=await m3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function l3(X,$,Z){let Y=Z||await m3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var Bq=E(()=>{H5();d3()});import{resolve as XF,basename as $F,extname as ZF,join as YF}from"path";import{mkdir as JF}from"fs/promises";async function GF(){try{return await import("ts-images")}catch{return null}}async function _q(X,$,Z){let Y=await GF();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=XF(X);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||QF,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await JF(w,{recursive:!0});let W=await P0(J),U=$F(X,ZF(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let B of Q){z.byFormat[B]=[];let j=[];for(let H of G){let O=`${U}-${H}w-${W}.${B}`,L=YF(w,O),F=`${q}/${O}`;try{let V=K[B]?.quality||80;if(await D0(L)){z.byFormat[B].push({path:L,url:F,width:H,height:0,format:B,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:B,quality:V,resize:{width:H}});if(A)z.byFormat[B].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${H}w: ${V}`)}}z.srcsets[B]=j.join(", ")}let _=$.placeholder||Z.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await Y.generateThumbHash(J);z.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(J,{strategy:_,width:20});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=$.sizes||wF(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function wF(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function jq(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var QF;var Hq=E(()=>{H5();QF=[320,480,640,768,1024,1280,1536,1920]});var Lq={};a(Lq,{setCachedImageResult:()=>o8,processImage:()=>Kq,optimizeImage:()=>zq,getCachedImageResult:()=>s8,generateSrcset:()=>jq,generateResponsiveVariants:()=>_q,clearImageCache:()=>Wq,applyTransformations:()=>l3,ImageProcessorCache:()=>r8});var Oq=E(()=>{Bq();Hq();d3()});async function qF(){try{return await Promise.resolve().then(() => (Oq(),Lq))}catch(X){if(!Fq)console.warn("[stx-media] Image processor not available, some features disabled:",X),Fq=!0;return null}}async function a8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return zF(Y,Z)}if(Z.processedResult?.processed)return n3(X,Z.processedResult,$);if(Z.responsiveVariants)return Mq(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=J7,dpr:U,formats:K=GX,quality:z=c3,params:_={},placeholder:B="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":e8,decoding:F=t8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:M,referrerpolicy:T}=X,k=X.class,N=X.style,D=X.id,I=X.data||{},{isDev:C=!1,baseUrl:b=""}=$;if(C&&!$.optimize)return KF(X);let y,v,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await $q(J,{strategy:B,...j}),v=Xq(x,y,j)}catch{}let g=U!==void 0&&Q!==void 0,c;if(g)c=UF(X,x,y,$);else c=await WF(X,x,y,$);let p;if(O){let i0=K.includes("webp")?"webp":K[0],K0=b3(J,W,{..._,q:z},i0),$0=typeof q==="object"?S3(q):q||"100vw";p=`<link rel="preload" as="image" imagesrcset="${K0}" imagesizes="${$0}" />`}let y0=[];if(!Vq&&B!=="none")y0.push(x3),Vq=!0;if(v)y0.push(v);let b0=H?Rq(x):void 0;return{html:c,preloadLink:p,css:y0.length>0?y0.join(`
14738
- `):void 0,script:b0}}async function WF(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=J7,formats:U=GX,quality:K=c3,params:z={},lazy:_=!0,priority:B=!1,loading:j=B?"eager":e8,decoding:H=t8,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,M=X.style,T=X.data||{},k=typeof q==="object"?S3(q):q||"100vw",N=[];for(let C of U){let b=b3(J,W,{...z,q:K},C),y=C3(C);if(_&&!B)N.push(` <source type="${y}" data-srcset="${b}" data-sizes="${k}" />`);else N.push(` <source type="${y}" srcset="${b}" sizes="${k}" />`)}let D=p3({src:QX(J,{...z,q:K}),alt:G,width:Q,height:w,loading:B?void 0:j,decoding:H,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:Aq(R,Z),style:i3(M,L,F,Z),lazy:_&&!B,data:T}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
14739
+ `.trim();m3=new Map});import{createHash as Wq}from"crypto";import{readFile as pO,stat as Uq}from"fs/promises";async function x0(X){try{let $=await pO(X);return Wq("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function qq(X){return Wq("sha256").update(X).digest("hex").slice(0,16)}function s8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${qq(X)}-${qq(Z)}`}async function c3(X){try{return(await Uq(X)).mtimeMs}catch{return 0}}async function C0(X){try{return await Uq(X),!0}catch{return!1}}var A5=()=>{};import{mkdir as iO,readFile as nO,writeFile as rO,readdir as tD,rm as sO,stat as eD}from"fs/promises";import{join as zq,dirname as oO}from"path";async function aO(X){try{await iO(X,{recursive:!0})}catch{}}function Bq(X,$,Z){return zq(X,Z,`${$}.json`)}async function Kq(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await c3($)!==X.srcMtime)return!1;return!0}async function o8(X,$,Z,Y=p3){if(!Y.enabled)return null;let J=s8(X,$),G=W7.get(J);if(G){if(await Kq(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;W7.delete(J)}let Q=Bq(Y.directory,J,Z);if(await C0(Q))try{let w=await nO(Q,"utf-8"),q=JSON.parse(w);if(await Kq(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),W7.set(J,q),q.data}catch{}return null}async function a8(X,$,Z,Y,J=p3){if(!J.enabled)return;let G=s8(X,$),Q=await x0(X),w=await c3(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:s8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};W7.set(G,q);let W=Bq(J.directory,G,Y);try{await aO(oO(W)),await rO(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function t8(X,$=p3){if(X==="all")W7.clear();else W7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=zq($.directory,Y);try{await sO(J,{recursive:!0,force:!0})}catch{}}}var W7,p3;var i3=E(()=>{A5();W7=new Map,p3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class X${config;constructor(X={}){this.config={...tO,...X}}async get(X,$){return o8(X,$,"image",this.config)}async set(X,$,Z){return a8(X,$,Z,"image",this.config)}async clear(){return t8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function n3(X){if(!e8)e8=new X$(X);else if(X)e8.updateConfig(X);return e8}async function $$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return n3(Y).get(X,$)}async function Z$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n3(J).set(X,$,Z)}async function _q(){return n3().clear()}var tO,e8=null;var r3=E(()=>{i3();tO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as eO,basename as XF,extname as $F,join as ZF}from"path";import{mkdir as YF}from"fs/promises";async function s3(){try{return await import("ts-images")}catch{return null}}function jq(X){switch(X){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 JF(X,$){let Z=$?jq($):jq("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function Hq(X,$,Z){let Y=await s3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await $$(X,$,Z);if(J)return J;try{let G=eO(X);if(!await C0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=JF(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await YF(w,{recursive:!0});let W=await x0(G),U=XF(X,$F(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},_=null;if($.transformations&&$.transformations.length>0)_=await o3(G,$.transformations,Y);for(let B of K){let j=Q[B]||{},H=`${U}-${W}.${B}`,O=ZF(w,H);try{let L=await Y.optimizeImage({input:_||G,output:O,format:B,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(G);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if($.useDominantColor)try{let B=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await Z$(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function Lq(X,$,Z,Y){let J=await s3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function o3(X,$,Z){let Y=Z||await s3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var Oq=E(()=>{A5();r3()});import{resolve as GF,basename as QF,extname as wF,join as qF}from"path";import{mkdir as WF}from"fs/promises";async function UF(){try{return await import("ts-images")}catch{return null}}async function Fq(X,$,Z){let Y=await UF();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=GF(X);if(!await C0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||KF,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await WF(w,{recursive:!0});let W=await x0(J),U=QF(X,wF(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let B of Q){z.byFormat[B]=[];let j=[];for(let H of G){let O=`${U}-${H}w-${W}.${B}`,L=qF(w,O),F=`${q}/${O}`;try{let V=K[B]?.quality||80;if(await C0(L)){z.byFormat[B].push({path:L,url:F,width:H,height:0,format:B,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:B,quality:V,resize:{width:H}});if(A)z.byFormat[B].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${H}w: ${V}`)}}z.srcsets[B]=j.join(", ")}let _=$.placeholder||Z.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await Y.generateThumbHash(J);z.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(J,{strategy:_,width:20});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=$.sizes||zF(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function zF(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function Vq(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var KF;var Aq=E(()=>{A5();KF=[320,480,640,768,1024,1280,1536,1920]});var Rq={};e(Rq,{setCachedImageResult:()=>Z$,processImage:()=>Hq,optimizeImage:()=>Lq,getCachedImageResult:()=>$$,generateSrcset:()=>Vq,generateResponsiveVariants:()=>Fq,clearImageCache:()=>_q,applyTransformations:()=>o3,ImageProcessorCache:()=>X$});var Mq=E(()=>{Oq();Aq();r3()});async function BF(){try{return await Promise.resolve().then(() => (Mq(),Rq))}catch(X){if(!Tq)console.warn("[stx-media] Image processor not available, some features disabled:",X),Tq=!0;return null}}async function Y$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return LF(Y,Z)}if(Z.processedResult?.processed)return X6(X,Z.processedResult,$);if(Z.responsiveVariants)return Eq(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=q7,dpr:U,formats:K=qX,quality:z=a3,params:_={},placeholder:B="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":G$,decoding:F=J$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:M,referrerpolicy:T}=X,N=X.class,k=X.style,D=X.id,I=X.data||{},{isDev:S=!1,baseUrl:b=""}=$;if(S&&!$.optimize)return HF(X);let y,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!O)try{y=await Qq(J,{strategy:B,...j}),P=Gq(x,y,j)}catch{}let f=U!==void 0&&Q!==void 0,i;if(f)i=jF(X,x,y,$);else i=await _F(X,x,y,$);let c;if(O){let g0=K.includes("webp")?"webp":K[0],X1=g3(J,W,{..._,q:z},g0),r=typeof q==="object"?h3(q):q||"100vw";c=`<link rel="preload" as="image" imagesrcset="${X1}" imagesizes="${r}" />`}let I0=[];if(!Nq&&B!=="none")I0.push(l3),Nq=!0;if(P)I0.push(P);let f0=H?Iq(x):void 0;return{html:i,preloadLink:c,css:I0.length>0?I0.join(`
14740
+ `):void 0,script:f0}}async function _F(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=q7,formats:U=qX,quality:K=a3,params:z={},lazy:_=!0,priority:B=!1,loading:j=B?"eager":G$,decoding:H=J$,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,M=X.style,T=X.data||{},N=typeof q==="object"?h3(q):q||"100vw",k=[];for(let S of U){let b=g3(J,W,{...z,q:K},S),y=u3(S);if(_&&!B)k.push(` <source type="${y}" data-srcset="${b}" data-sizes="${N}" />`);else k.push(` <source type="${y}" srcset="${b}" sizes="${N}" />`)}let D=t3({src:WX(J,{...z,q:K}),alt:G,width:Q,height:w,loading:B?void 0:j,decoding:H,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:kq(R,Z),style:e3(M,L,F,Z),lazy:_&&!B,data:T}),I;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${S}">
14739
14741
  <picture>
14740
- ${N.join(`
14742
+ ${k.join(`
14741
14743
  `)}
14742
14744
  <img ${D} />
14743
14745
  </picture>
14744
14746
  </div>`}else I=`<picture${$?` id="${$}"`:""}>
14745
- ${N.join(`
14747
+ ${k.join(`
14746
14748
  `)}
14747
14749
  <img ${D} />
14748
- </picture>`;return I}function UF(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=c3,params:U={},lazy:K=!0,priority:z=!1,loading:_=z?"eager":e8,decoding:B=t8,fetchpriority:j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},M=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=ew(J,M,q,{...U,q:W}),k=p3({src:QX(J,{...U,w:M,q:W}),alt:G,width:Q,height:w,loading:z?void 0:_,decoding:B,fetchpriority:z?"high":j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:Aq(V,Z),style:i3(A,H,O,Z),lazy:K&&!z,data:R}),N=K&&!z?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${D}">
14749
- <img ${k} ${N} />
14750
- </div>`}return`<img ${$?`id="${$}" `:""}${k} ${N} />`}function KF(X){let{src:$,alt:Z,width:Y,height:J,loading:G=e8,decoding:Q=t8,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,priority:z=!1}=X,_=X.class,B=X.style,j=X.id,H=X.data||{};return{html:`<img ${p3({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,className:_,style:i3(B,q,W),id:j,data:H})} />`}}function p3(X){let $=[];if(X.lazy)$.push(`data-src="${G1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${G1(X.src)}"`);if($.push(`alt="${G1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${G1(X.className)}"`);if(X.style)$.push(`style="${G1(X.style)}"`);if(X.id)$.push(`id="${G1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${G1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function Aq(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function i3(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function G1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rq(X){return`
14750
+ </picture>`;return I}function jF(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=a3,params:U={},lazy:K=!0,priority:z=!1,loading:_=z?"eager":G$,decoding:B=J$,fetchpriority:j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},M=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=Jq(J,M,q,{...U,q:W}),N=t3({src:WX(J,{...U,w:M,q:W}),alt:G,width:Q,height:w,loading:z?void 0:_,decoding:B,fetchpriority:z?"high":j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:kq(V,Z),style:e3(A,H,O,Z),lazy:K&&!z,data:R}),k=K&&!z?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${D}">
14751
+ <img ${N} ${k} />
14752
+ </div>`}return`<img ${$?`id="${$}" `:""}${N} ${k} />`}function HF(X){let{src:$,alt:Z,width:Y,height:J,loading:G=G$,decoding:Q=J$,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,priority:z=!1}=X,_=X.class,B=X.style,j=X.id,H=X.data||{};return{html:`<img ${t3({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,className:_,style:e3(B,q,W),id:j,data:H})} />`}}function t3(X){let $=[];if(X.lazy)$.push(`data-src="${w1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${w1(X.src)}"`);if($.push(`alt="${w1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${w1(X.className)}"`);if(X.style)$.push(`style="${w1(X.style)}"`);if(X.id)$.push(`id="${w1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${w1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function kq(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function e3(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function w1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Iq(X){return`
14751
14753
  (function() {
14752
14754
  const container = document.getElementById('${X}');
14753
14755
  if (!container) return;
@@ -14784,7 +14786,7 @@ ${N.join(`
14784
14786
 
14785
14787
  observer.observe(container);
14786
14788
  })();
14787
- `.trim()}async function zF(X,$){let Z=await qF();if(!Z)return a8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return Mq(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return n3(X,G,$)}return a8({...X,process:!1},$)}async function n3(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K}=X,z=X.class,_=X.style,B=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((v)=>v.format==="jpeg")||H.find((v)=>v.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((v)=>v.format===(O?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),V=new Map;for(let v of H){if(!V.has(v.format))V.set(v.format,[]);V.get(v.format).push(v)}let A=[],R=["avif","webp","jpeg","png"];for(let v of R){let x=V.get(v);if(x&&x.length>0){let g=x.map((p)=>`${p.url} ${p.width}w`).join(", "),c=C3(v);if(Q&&!w)A.push(` <source type="${c}" data-srcset="${g}" />`);else A.push(` <source type="${c}" srcset="${g}" />`)}}let M=[];if(Q&&!w){if(M.push(`data-src="${G1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)M.push(`data-srcset="${F}"`)}else if(M.push(`src="${G1(L)}"`),F)M.push(`srcset="${F}"`);M.push(`alt="${G1(Y)}"`);let T=J||$.originalWidth,k=G||$.originalHeight;if(T)M.push(`width="${T}"`);if(k)M.push(`height="${k}"`);if(!w)M.push(`loading="${Q?"lazy":"eager"}"`);if(M.push('decoding="async"'),w)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(K)M.push(`referrerpolicy="${K}"`);let N=[];if(q)N.push(`object-fit: ${q}`);if(W)N.push(`object-position: ${W}`);if($.placeholder&&Q)N.push("opacity: 0; transition: opacity 300ms ease-out");if(_)N.push(_);if(N.length>0)M.push(`style="${N.join("; ")}"`);let D=[];if(z)D.push(z);if($.placeholder)D.push("stx-img-blur");if(D.length>0)M.push(`class="${D.join(" ")}"`);if(Q&&!w)M.push("data-stx-lazy");for(let[v,x]of Object.entries(j))M.push(`data-${v}="${G1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let v=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${B}" class="stx-img-placeholder" style="${v}">
14789
+ `.trim()}async function LF(X,$){let Z=await BF();if(!Z)return Y$({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return Eq(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return X6(X,G,$)}return Y$({...X,process:!1},$)}async function X6(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K}=X,z=X.class,_=X.style,B=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let f=x.map((c)=>`${c.url} ${c.width}w`).join(", "),i=u3(P);if(Q&&!w)A.push(` <source type="${i}" data-srcset="${f}" />`);else A.push(` <source type="${i}" srcset="${f}" />`)}}let M=[];if(Q&&!w){if(M.push(`data-src="${w1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)M.push(`data-srcset="${F}"`)}else if(M.push(`src="${w1(L)}"`),F)M.push(`srcset="${F}"`);M.push(`alt="${w1(Y)}"`);let T=J||$.originalWidth,N=G||$.originalHeight;if(T)M.push(`width="${T}"`);if(N)M.push(`height="${N}"`);if(!w)M.push(`loading="${Q?"lazy":"eager"}"`);if(M.push('decoding="async"'),w)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(K)M.push(`referrerpolicy="${K}"`);let k=[];if(q)k.push(`object-fit: ${q}`);if(W)k.push(`object-position: ${W}`);if($.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(_)k.push(_);if(k.length>0)M.push(`style="${k.join("; ")}"`);let D=[];if(z)D.push(z);if($.placeholder)D.push("stx-img-blur");if(D.length>0)M.push(`class="${D.join(" ")}"`);if(Q&&!w)M.push("data-stx-lazy");for(let[P,x]of Object.entries(j))M.push(`data-${P}="${w1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${B}" class="stx-img-placeholder" style="${P}">
14788
14790
  <picture>
14789
14791
  ${A.join(`
14790
14792
  `)}
@@ -14794,12 +14796,12 @@ ${A.join(`
14794
14796
  ${A.join(`
14795
14797
  `)}
14796
14798
  <img ${M.join(" ")} />
14797
- </picture>`;let C=[];if($.placeholder)C.push(x3);let b=Q?Rq(B):void 0,y;if(w&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:y,css:C.length>0?C.join(`
14798
- `):void 0,script:b}}async function Mq(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return n3(X,Y,Z)}var Fq=!1,c3=80,t8="async",e8="lazy",Vq=!1;var Tq=E(()=>{P3();Zq()});function BF(){return m8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=_F(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||J7,formats:Q.formats||GX,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await a8(w,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
14799
+ </picture>`;let S=[];if($.placeholder)S.push(l3);let b=Q?Iq(B):void 0,y;if(w&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:y,css:S.length>0?S.join(`
14800
+ `):void 0,script:b}}async function Eq(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return X6(X,Y,Z)}var Tq=!1,a3=80,J$="async",G$="lazy",Nq=!1;var Dq=E(()=>{d3();wq()});function OF(){return r8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=FF(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||q7,formats:Q.formats||qX,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await Y$(w,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
14799
14801
  `+U;if(W.css)U+=`
14800
14802
  <style>${W.css}</style>`;if(W.script)U+=`
14801
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function _F(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=jF(Y),G=r3(J[0],Z)||"",Q=r3(J[1],Z)||"",w={};if(J[2]){let q=r3(J[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function jF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function r3(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var Nq;var kq=E(()=>{y3();Tq();P3();Nq=BF()});class $${config;constructor(X={}){this.config={...HF,...X}}async get(X,$){return c8(X,$,"video",this.config)}async set(X,$,Z){return p8(X,$,Z,"video",this.config)}async clear(){return i8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function s3(X){if(!X$)X$=new $$(X);else if(X)X$.updateConfig(X);return X$}async function Z$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return s3(Y).get(X,$)}async function Y$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return s3(J).set(X,$,Z)}async function Iq(){return s3().clear()}var HF,X$=null;var o3=E(()=>{h3();HF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as a3,basename as t3,extname as e3,join as J$}from"path";import{mkdir as X6}from"fs/promises";async function $6(){try{return await import("ts-videos")}catch{return null}}async function G$(X,$,Z,Y){let J=await $6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=a3(X);if(!await D0(G))return null;await X6(Z,{recursive:!0});let Q=await P0(G),w=t3(X,e3(X)),q=$.format||"webp",W=$.timestamp||0,U=`${w}-poster-${Q}.${q}`,K=J$(Z,U),z=await J.extractThumbnails(G,{timestamps:[W],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(z&&z.length>0){let _=z[0];return{path:K,url:`${Y}/${U}`,width:_.width||$.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function Q$(X,$,Z,Y){let J=await $6();if(!J)return[];try{let G=a3(X);if(!await D0(G))return[];await X6(Z,{recursive:!0});let Q=await P0(G),w=t3(X,e3(X)),q=$.format||"webp",K=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,_=$.interval||K/z,B=[];for(let H=0;H<z&&H*_<K;H++)B.push(H*_);let j=await J.extractThumbnails(G,{timestamps:B,width:$.width||320,format:q,quality:$.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(j&&j.length>0)return j.map((H,O)=>({path:H.path||J$(Z,`${w}-thumb-${Q}-${O}.${q}`),url:`${Y}/${w}-thumb-${Q}-${O}.${q}`,width:H.width||$.width||320,height:H.height||180,timestamp:B[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function Eq(X,$,Z,Y){let J=await $6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=a3(X);if(!await D0(G))return null;await X6(Z,{recursive:!0});let Q=await P0(G),w=t3(X,e3(X)),U=(await new J.Input(G).getInfo()).duration||60,K=$.columns||10,z=$.interval||5,_=$.thumbnailWidth||160,B=$.thumbnailHeight||90,j=$.format||"jpeg",H=Math.ceil(U/z),O=Math.ceil(H/K),L=`${w}-sprite-${Q}.${j}`,F=J$(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:_,height:B,format:j,quality:$.quality||70,outputDir:J$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),M=K*_,T=O*B,k=await R.createSprite({images:A.map((N)=>N.path),columns:K,padding:0,outputPath:F,format:j,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:K,rows:O,thumbnailWidth:_,thumbnailHeight:B,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var Z6=E(()=>{H5()});import{resolve as yq,basename as bq,extname as Sq,join as L5}from"path";import{mkdir as w$,writeFile as Cq}from"fs/promises";async function Pq(){try{return await import("ts-videos")}catch{return null}}async function q$(X,$,Z,Y,J){let G=await Pq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=yq(X);if(!await D0(Q))return null;let w=await P0(Q),q=bq(X,Sq(X)),W=L5(Z,`${q}-${w}-hls`);await w$(W,{recursive:!0});let U=$.length>0?$:vq,K=J?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,j=[],H=0;for(let F of U){let V=L5(W,F.label);await w$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=L5(V,A);try{let M=await G.generateHLS(Q,{outputDir:V,segmentDuration:K,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(M)j.push({quality:F,url:`${Y}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=M.segmentCount||Math.ceil(B/K)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${M}`)}}if(j.length===0)return null;let O=L5(W,"master.m3u8"),L=LF(j,Y,q,w);return await Cq(O,L),{manifestUrl:`${Y}/${q}-${w}-hls/master.m3u8`,manifestPath:O,playlists:j,segmentCount:H,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function LF(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
14802
- `)}async function W$(X,$,Z,Y,J){let G=await Pq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=yq(X);if(!await D0(Q))return null;let w=await P0(Q),q=bq(X,Sq(X)),W=L5(Z,`${q}-${w}-dash`);await w$(W,{recursive:!0});let U=$.length>0?$:vq,K=J?.segmentDuration||4,z=J?.minBufferTime||2,j=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of U){let R=L5(W,A.label);await w$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:K,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${q}-${w}-dash/${A.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${M}`)}}if(H.length===0)return null;let L=L5(W,"manifest.mpd"),F=OF(H,O,j,K,z);await Cq(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${q}-${w}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function OF(X,$,Z,Y,J){let G=Dq(Z),Q=Dq(J),w=`<?xml version="1.0" encoding="UTF-8"?>
14803
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function FF(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=VF(Y),G=$6(J[0],Z)||"",Q=$6(J[1],Z)||"",w={};if(J[2]){let q=$6(J[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function VF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function $6(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var yq;var bq=E(()=>{f3();Dq();d3();yq=OF()});class w${config;constructor(X={}){this.config={...AF,...X}}async get(X,$){return o8(X,$,"video",this.config)}async set(X,$,Z){return a8(X,$,Z,"video",this.config)}async clear(){return t8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function Z6(X){if(!Q$)Q$=new w$(X);else if(X)Q$.updateConfig(X);return Q$}async function q$(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return Z6(Y).get(X,$)}async function W$(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Z6(J).set(X,$,Z)}async function Sq(){return Z6().clear()}var AF,Q$=null;var Y6=E(()=>{i3();AF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as J6,basename as G6,extname as Q6,join as U$}from"path";import{mkdir as w6}from"fs/promises";async function q6(){try{return await import("ts-videos")}catch{return null}}async function K$(X,$,Z,Y){let J=await q6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=J6(X);if(!await C0(G))return null;await w6(Z,{recursive:!0});let Q=await x0(G),w=G6(X,Q6(X)),q=$.format||"webp",W=$.timestamp||0,U=`${w}-poster-${Q}.${q}`,K=U$(Z,U),z=await J.extractThumbnails(G,{timestamps:[W],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(z&&z.length>0){let _=z[0];return{path:K,url:`${Y}/${U}`,width:_.width||$.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function z$(X,$,Z,Y){let J=await q6();if(!J)return[];try{let G=J6(X);if(!await C0(G))return[];await w6(Z,{recursive:!0});let Q=await x0(G),w=G6(X,Q6(X)),q=$.format||"webp",K=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,_=$.interval||K/z,B=[];for(let H=0;H<z&&H*_<K;H++)B.push(H*_);let j=await J.extractThumbnails(G,{timestamps:B,width:$.width||320,format:q,quality:$.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(j&&j.length>0)return j.map((H,O)=>({path:H.path||U$(Z,`${w}-thumb-${Q}-${O}.${q}`),url:`${Y}/${w}-thumb-${Q}-${O}.${q}`,width:H.width||$.width||320,height:H.height||180,timestamp:B[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function Cq(X,$,Z,Y){let J=await q6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=J6(X);if(!await C0(G))return null;await w6(Z,{recursive:!0});let Q=await x0(G),w=G6(X,Q6(X)),U=(await new J.Input(G).getInfo()).duration||60,K=$.columns||10,z=$.interval||5,_=$.thumbnailWidth||160,B=$.thumbnailHeight||90,j=$.format||"jpeg",H=Math.ceil(U/z),O=Math.ceil(H/K),L=`${w}-sprite-${Q}.${j}`,F=U$(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:_,height:B,format:j,quality:$.quality||70,outputDir:U$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),M=K*_,T=O*B,N=await R.createSprite({images:A.map((k)=>k.path),columns:K,padding:0,outputPath:F,format:j,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:K,rows:O,thumbnailWidth:_,thumbnailHeight:B,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var W6=E(()=>{A5()});import{resolve as vq,basename as xq,extname as fq,join as R5}from"path";import{mkdir as B$,writeFile as gq}from"fs/promises";async function hq(){try{return await import("ts-videos")}catch{return null}}async function _$(X,$,Z,Y,J){let G=await hq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=vq(X);if(!await C0(Q))return null;let w=await x0(Q),q=xq(X,fq(X)),W=R5(Z,`${q}-${w}-hls`);await B$(W,{recursive:!0});let U=$.length>0?$:uq,K=J?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,j=[],H=0;for(let F of U){let V=R5(W,F.label);await B$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=R5(V,A);try{let M=await G.generateHLS(Q,{outputDir:V,segmentDuration:K,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(M)j.push({quality:F,url:`${Y}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=M.segmentCount||Math.ceil(B/K)}catch(M){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${M}`)}}if(j.length===0)return null;let O=R5(W,"master.m3u8"),L=RF(j,Y,q,w);return await gq(O,L),{manifestUrl:`${Y}/${q}-${w}-hls/master.m3u8`,manifestPath:O,playlists:j,segmentCount:H,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function RF(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
14804
+ `)}async function j$(X,$,Z,Y,J){let G=await hq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=vq(X);if(!await C0(Q))return null;let w=await x0(Q),q=xq(X,fq(X)),W=R5(Z,`${q}-${w}-dash`);await B$(W,{recursive:!0});let U=$.length>0?$:uq,K=J?.segmentDuration||4,z=J?.minBufferTime||2,j=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of U){let R=R5(W,A.label);await B$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:K,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${q}-${w}-dash/${A.label}/audio`})}}catch(M){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${M}`)}}if(H.length===0)return null;let L=R5(W,"manifest.mpd"),F=MF(H,O,j,K,z);await gq(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${q}-${w}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function MF(X,$,Z,Y,J){let G=Pq(Z),Q=Pq(J),w=`<?xml version="1.0" encoding="UTF-8"?>
14803
14805
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
14804
14806
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14805
14807
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -14825,13 +14827,13 @@ ${A.join(`
14825
14827
  </Representation>
14826
14828
  `}w+=` </AdaptationSet>
14827
14829
  `}return w+=` </Period>
14828
- </MPD>`,w}function Dq(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var vq;var Y6=E(()=>{H5();vq=[{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 xq,basename as FF,extname as VF,join as AF}from"path";import{mkdir as RF}from"fs/promises";async function fq(){try{return await import("ts-videos")}catch{return null}}function MF(X){switch(X){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 TF(X){switch(X){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 J6(X){let $=await fq();if(!$)return null;try{let Z=xq(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function gq(X,$,Z,Y){let J=await fq();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await Z$(X,$,Z);if(G)return G;try{let Q=xq(X);if(!await D0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await RF(w,{recursive:!0});let W=await P0(Q),U=FF(X,VF(X)),K={src:X,processed:!0,hash:W};Y?.({percentage:5,stage:"analyzing"}),K.metadata=await J6(Q)||void 0;let z={};if($.quality)z.bitrate=MF($.quality);if($.platform)Object.assign(z,TF($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=AF(w,_);try{let j=await NF(Q,B,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(j)K.transcoded={path:B,url:`${q}/${_}`,duration:j.duration,size:j.size,video:{codec:z.codec||"h264",width:j.width,height:j.height,bitrate:j.bitrate,frameRate:j.frameRate},audio:j.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(j){K.errors=K.errors||[],K.errors.push(`Transcoding failed: ${j}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let _=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},B=await G$(Q,_,w,q);if(B)K.poster=B}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let _=await Q$(Q,Z.thumbnails,w,q);if(_.length>0)K.thumbnails=_}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let _=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await q$(Q,_.qualities||Z.streaming?.defaultQualities||[],w,q);if(B)K.streaming={...K.streaming,hls:B}}if(_.format==="dash"){let B=await W$(Q,_.qualities||Z.streaming?.defaultQualities||[],w,q);if(B)K.streaming={...K.streaming,dash:B}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await Y$(X,$,K,Z),K}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function NF(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var hq=E(()=>{H5();o3();Z6();Y6()});var uq={};a(uq,{setCachedVideoResult:()=>Y$,processVideo:()=>gq,getCachedVideoResult:()=>Z$,generateThumbnails:()=>Q$,generateSpriteSheet:()=>Eq,generatePoster:()=>G$,generateHLSManifest:()=>q$,generateDASHManifest:()=>W$,clearVideoCache:()=>Iq,analyzeVideo:()=>J6,VideoProcessorCache:()=>$$});var dq=E(()=>{hq();Z6();Y6();o3()});async function lq(){try{return await Promise.resolve().then(() => (dq(),uq))}catch(X){if(!mq)console.warn("[stx-media] Video processor not available, some features disabled:",X),mq=!0;return null}}async function U$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return bF(Y,Z)}if(Z.processedResult?.processed)return nq(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await SF(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=cq,autoplay:U=!1,muted:K=!1,loop:z=!1,preload:_=pq,playsinline:B=!0,lazy:j=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,M=J||w,T=X.class,k=X.style,N=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return EF(X,$);if(O&&O!=="video")return IF(G||"",O,X);let D=Q.length>0?Q:G?[{src:G,type:iq(G)}]:[],I=[`id="${N}"`];if(W)I.push("controls");if(U)I.push("autoplay");if(K)I.push("muted");if(z)I.push("loop");if(B)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(j){if(I.push(`data-preload="${_}"`),I.push('preload="none"'),M)I.push(`data-poster="${M0(M)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${_}"`),M)I.push(`poster="${M0(M)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${M0(T)}"`);if(k)I.push(`style="${M0(k)}"`);let C=D.map((v)=>{return` <source ${j?`data-src="${M0(v.src)}"`:`src="${M0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
14830
+ </MPD>`,w}function Pq(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var uq;var U6=E(()=>{A5();uq=[{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 dq,basename as TF,extname as NF,join as kF}from"path";import{mkdir as IF}from"fs/promises";async function mq(){try{return await import("ts-videos")}catch{return null}}function EF(X){switch(X){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 DF(X){switch(X){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 K6(X){let $=await mq();if(!$)return null;try{let Z=dq(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function lq(X,$,Z,Y){let J=await mq();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await q$(X,$,Z);if(G)return G;try{let Q=dq(X);if(!await C0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await IF(w,{recursive:!0});let W=await x0(Q),U=TF(X,NF(X)),K={src:X,processed:!0,hash:W};Y?.({percentage:5,stage:"analyzing"}),K.metadata=await K6(Q)||void 0;let z={};if($.quality)z.bitrate=EF($.quality);if($.platform)Object.assign(z,DF($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=kF(w,_);try{let j=await yF(Q,B,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(j)K.transcoded={path:B,url:`${q}/${_}`,duration:j.duration,size:j.size,video:{codec:z.codec||"h264",width:j.width,height:j.height,bitrate:j.bitrate,frameRate:j.frameRate},audio:j.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(j){K.errors=K.errors||[],K.errors.push(`Transcoding failed: ${j}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let _=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},B=await K$(Q,_,w,q);if(B)K.poster=B}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let _=await z$(Q,Z.thumbnails,w,q);if(_.length>0)K.thumbnails=_}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let _=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await _$(Q,_.qualities||Z.streaming?.defaultQualities||[],w,q);if(B)K.streaming={...K.streaming,hls:B}}if(_.format==="dash"){let B=await j$(Q,_.qualities||Z.streaming?.defaultQualities||[],w,q);if(B)K.streaming={...K.streaming,dash:B}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await W$(X,$,K,Z),K}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function yF(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var cq=E(()=>{A5();Y6();W6();U6()});var pq={};e(pq,{setCachedVideoResult:()=>W$,processVideo:()=>lq,getCachedVideoResult:()=>q$,generateThumbnails:()=>z$,generateSpriteSheet:()=>Cq,generatePoster:()=>K$,generateHLSManifest:()=>_$,generateDASHManifest:()=>j$,clearVideoCache:()=>Sq,analyzeVideo:()=>K6,VideoProcessorCache:()=>w$});var iq=E(()=>{cq();W6();U6();Y6()});async function rq(){try{return await Promise.resolve().then(() => (iq(),pq))}catch(X){if(!nq)console.warn("[stx-media] Video processor not available, some features disabled:",X),nq=!0;return null}}async function H$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return xF(Y,Z)}if(Z.processedResult?.processed)return tq(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await fF(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=sq,autoplay:U=!1,muted:K=!1,loop:z=!1,preload:_=oq,playsinline:B=!0,lazy:j=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,M=J||w,T=X.class,N=X.style,k=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return CF(X,$);if(O&&O!=="video")return SF(G||"",O,X);let D=Q.length>0?Q:G?[{src:G,type:aq(G)}]:[],I=[`id="${k}"`];if(W)I.push("controls");if(U)I.push("autoplay");if(K)I.push("muted");if(z)I.push("loop");if(B)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(j){if(I.push(`data-preload="${_}"`),I.push('preload="none"'),M)I.push(`data-poster="${k0(M)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${_}"`),M)I.push(`poster="${k0(M)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${k0(T)}"`);if(N)I.push(`style="${k0(N)}"`);let S=D.map((P)=>{return` <source ${j?`data-src="${k0(P.src)}"`:`src="${k0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
14829
14831
  `),b=`<video ${I.join(" ")}>
14830
- ${C}
14832
+ ${S}
14831
14833
  Your browser does not support the video tag.
14832
14834
  </video>`,y;if(j)y=`
14833
14835
  (function() {
14834
- var video = document.getElementById('${N}');
14836
+ var video = document.getElementById('${k}');
14835
14837
  if (!video) return;
14836
14838
 
14837
14839
  var observer = new IntersectionObserver(function(entries) {
@@ -14864,12 +14866,12 @@ ${C}
14864
14866
 
14865
14867
  observer.observe(video);
14866
14868
  })();
14867
- `.trim();return{html:b,script:y}}function IF(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch($){case"youtube":W=DF(X),q=W?`https://www.youtube-nocookie.com/embed/${W}`:X;break;case"vimeo":W=yF(X),q=W?`https://player.vimeo.com/video/${W}`:X;break;case"dailymotion":W=X.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=X.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=X}let U=[`id="${w}"`,`src="${M0(q)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)U.push(`class="${M0(G)}"`);if(Q)U.push(`style="${M0(Q)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
14869
+ `.trim();return{html:b,script:y}}function SF(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch($){case"youtube":W=PF(X),q=W?`https://www.youtube-nocookie.com/embed/${W}`:X;break;case"vimeo":W=vF(X),q=W?`https://player.vimeo.com/video/${W}`:X;break;case"dailymotion":W=X.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=X.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=X}let U=[`id="${w}"`,`src="${k0(q)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)U.push(`class="${k0(G)}"`);if(Q)U.push(`style="${k0(Q)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
14868
14870
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
14869
- </div>`}}function EF(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:K=!0,width:z,height:_}=X,B=X.class,j=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:q,muted:w,playsinline:U,preload:W,poster:J,controls:G,title:X.title},L=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",j||""].filter(Boolean).join("; "),F=`
14871
+ </div>`}}function CF(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:K=!0,width:z,height:_}=X,B=X.class,j=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:q,muted:w,playsinline:U,preload:W,poster:J,controls:G,title:X.title},L=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",j||""].filter(Boolean).join("; "),F=`
14870
14872
  <div
14871
14873
  id="${H}"
14872
- class="ts-video-player${B?" "+M0(B):""}"
14874
+ class="ts-video-player${B?" "+k0(B):""}"
14873
14875
  style="${L}"
14874
14876
  data-ts-video-player
14875
14877
  data-config='${JSON.stringify(O)}'
@@ -14877,7 +14879,7 @@ ${C}
14877
14879
  >
14878
14880
  <div class="ts-video-player__container">
14879
14881
  ${J?`
14880
- <div class="ts-video-player__placeholder" style="background-image: url('${M0(J)}');">
14882
+ <div class="ts-video-player__placeholder" style="background-image: url('${k0(J)}');">
14881
14883
  <button class="ts-video-player__play-button" aria-label="Play video">
14882
14884
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
14883
14885
  <path d="M8 5v14l11-7z"/>
@@ -14903,7 +14905,7 @@ ${C}
14903
14905
 
14904
14906
  // Load ts-video-player from CDN
14905
14907
  var script = document.createElement('script');
14906
- script.src = '${kF}';
14908
+ script.src = '${bF}';
14907
14909
  script.onload = initPlayer;
14908
14910
  script.onerror = function() {
14909
14911
  console.error('[stx] Failed to load ts-video-player');
@@ -15033,10 +15035,10 @@ else {
15033
15035
  .ts-video-player__play-button svg {
15034
15036
  margin-left: 4px;
15035
15037
  }
15036
- `.trim();return{html:F,script:V,css:A}}function iq(X){switch(X.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 DF(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function yF(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function M0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function bF(X,$){let Z=await lq();if(!Z)return U$({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return nq(X,J,$);return U$({...X,process:!1},$)}async function SF(X,$){let Z=await lq();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function nq(X,$,Z){let{controls:Y=cq,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=pq,playsinline:q=!0,lazy:W=!0,width:U,height:K,crossorigin:z,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=X,j=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=iq(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(_)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(W){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${M0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${M0(A)}"`);let M=U||$.metadata?.width,T=K||$.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(j)R.push(`class="${M0(j)}"`);if(H)R.push(`style="${M0(H)}"`);let N=` <source ${W?`data-src="${M0(L)}"`:`src="${M0(L)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
15037
- ${N}
15038
+ `.trim();return{html:F,script:V,css:A}}function aq(X){switch(X.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 PF(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function vF(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function xF(X,$){let Z=await rq();if(!Z)return H$({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return tq(X,J,$);return H$({...X,process:!1},$)}async function fF(X,$){let Z=await rq();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function tq(X,$,Z){let{controls:Y=sq,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=oq,playsinline:q=!0,lazy:W=!0,width:U,height:K,crossorigin:z,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=X,j=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=aq(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(_)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(W){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${k0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${k0(A)}"`);let M=U||$.metadata?.width,T=K||$.metadata?.height;if(M)R.push(`width="${M}"`);if(T)R.push(`height="${T}"`);if(j)R.push(`class="${k0(j)}"`);if(H)R.push(`style="${k0(H)}"`);let k=` <source ${W?`data-src="${k0(L)}"`:`src="${k0(L)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
15039
+ ${k}
15038
15040
  Your browser does not support the video tag.
15039
- </video>`;if($.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${M0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
15041
+ </video>`;if($.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${k0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
15040
15042
  ${D}
15041
15043
  </div>`;let I;if(W)I=`
15042
15044
  (function() {
@@ -15073,7 +15075,7 @@ ${D}
15073
15075
 
15074
15076
  observer.observe(video);
15075
15077
  })();
15076
- `.trim();let C;if(V)C=`
15078
+ `.trim();let S;if(V)S=`
15077
15079
  .stx-video-wrapper {
15078
15080
  position: relative;
15079
15081
  width: 100%;
@@ -15082,9 +15084,9 @@ ${D}
15082
15084
  width: 100%;
15083
15085
  height: auto;
15084
15086
  }
15085
- `.trim();return{html:D,script:I,css:C}}var mq=!1,cq=!0,pq="metadata",kF="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var rq=E(()=>{Q6()});function sq(){return m8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=CF(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await U$(Q,q),U=W.html;if(W.css)U+=`
15087
+ `.trim();return{html:D,script:I,css:S}}var nq=!1,sq=!0,oq="metadata",bF="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var eq=E(()=>{B6()});function XW(){return r8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=gF(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await H$(Q,q),U=W.html;if(W.css)U+=`
15086
15088
  <style>${W.css}</style>`;if(W.script)U+=`
15087
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function CF(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=PF(Y),G=oq(J[0],Z)||"",Q={};if(J[1]){let w=oq(J[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function PF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function oq(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var G6;var Q6=E(()=>{y3();rq();G6=sq()});function vF(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
15089
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function gF(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=hF(Y),G=$W(J[0],Z)||"",Q={};if(J[1]){let w=$W(J[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function hF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function $W(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var z6;var B6=E(()=>{f3();eq();z6=XW()});function uF(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
15088
15090
  ${X}
15089
15091
  </div>
15090
15092
  <script>
@@ -15129,7 +15131,7 @@ ${D}
15129
15131
  }
15130
15132
  }
15131
15133
  })();
15132
- </script>`}function xF(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
15134
+ </script>`}function dF(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
15133
15135
  <div class="stx-pwa-update-banner" style="
15134
15136
  position: fixed;
15135
15137
  bottom: 0;
@@ -15240,7 +15242,7 @@ else {
15240
15242
  // Also listen for custom event
15241
15243
  window.addEventListener('pwa-update-available', showUpdate);
15242
15244
  })();
15243
- </script>`}function fF(X,$){let Z=X.trim().length>0,Y=`
15245
+ </script>`}function mF(X,$){let Z=X.trim().length>0,Y=`
15244
15246
  <div class="stx-offline-indicator" style="
15245
15247
  position: fixed;
15246
15248
  top: 16px;
@@ -15301,7 +15303,7 @@ else {
15301
15303
  window.addEventListener('offline', updateStatus);
15302
15304
  updateStatus();
15303
15305
  })();
15304
- </script>`}function gF(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
15306
+ </script>`}function lF(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
15305
15307
  ${X}
15306
15308
  </div>
15307
15309
  <script>
@@ -15383,7 +15385,7 @@ catch (error) {
15383
15385
  init();
15384
15386
  }
15385
15387
  })();
15386
- </script>`}var hF,uF,dF,mF,aq;var tq=E(()=>{hF={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return vF(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},uF={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return xF(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},dF={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return fF(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},mF={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return gF(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},aq=[hF,uF,dF,mF]});import wX from"path";function lF(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let K=Y.match(/export\s+default\s+({[\s\S]*})/);if(K)try{let z=K[1],_=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)J=_[1];let B=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)G=B[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let j=z.match(/shadowDOM\s*:\s*(true|false)/);if(j)Q=j[1]==="true"}catch{}}let w=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:J,props:G,template:q,styles:U,script:Y,shadowDOM:Q}}function cF(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((K)=>K.charAt(0).toUpperCase()+K.slice(1)).join(""),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((K)=>`'${K}'`).join(", "),U=Z.map((K)=>`
15388
+ </script>`}var cF,pF,iF,nF,ZW;var YW=E(()=>{cF={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return uF(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},pF={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return dF(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},iF={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return mF(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},nF={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return lF(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},ZW=[cF,pF,iF,nF]});import UX from"path";function rF(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let K=Y.match(/export\s+default\s+({[\s\S]*})/);if(K)try{let z=K[1],_=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)J=_[1];let B=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)G=B[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let j=z.match(/shadowDOM\s*:\s*(true|false)/);if(j)Q=j[1]==="true"}catch{}}let w=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:J,props:G,template:q,styles:U,script:Y,shadowDOM:Q}}function sF(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((K)=>K.charAt(0).toUpperCase()+K.slice(1)).join(""),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((K)=>`'${K}'`).join(", "),U=Z.map((K)=>`
15387
15389
  get ${K}() {
15388
15390
  return this.getAttribute('${K}') || '';
15389
15391
  }
@@ -15434,9 +15436,9 @@ ${U}
15434
15436
  }
15435
15437
 
15436
15438
  customElements.define('${$}', ${Q});
15437
- `}async function eq(X,$,Z,Y){if($.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[wX.join(wX.dirname(Y),Q,`${J}.stx`),wX.join(process.cwd(),Q,`${J}.stx`),wX.join(wX.dirname(Y),`${J}.stx`)],q=null;for(let K of w)if(await n(K)){q=await Bun.file(K).text();break}if(!q)return Z0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let W=lF(q,J);return`<script type="module">
15438
- ${cF(W)}
15439
- </script>`}var XW=E(()=>{V1();T0()});var $W={};a($W,{timingPlugin:()=>sF,pluginManager:()=>pF,definePlugin:()=>K$,debugPlugin:()=>rF,createVariablesPlugin:()=>oF,createFilterPlugin:()=>nF,createDirectivePlugin:()=>iF,PluginManager:()=>w6});function K$(X){return X}class w6{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function iF(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function nF(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function oF(X){return K$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var pF,rF,sF;var ZW=E(()=>{pF=new w6;rF=K$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),sF=K$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var CZ={};a(CZ,{validateConfig:()=>YV,resolveStxDirectories:()=>GW,loadStxConfig:()=>d1,defineStxConfig:()=>ZV,defaultConfig:()=>M1,config:()=>D7});import z$ from"fs";import p0 from"path";import{loadConfigWithResult as aF}from"bunfig";function tF(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=p0.join(J,"resources","views"),Q=p0.join(J,"resources","layouts");if(z$.existsSync(G)&&z$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=p0.join(J,"resources","views","pages");if(z$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function eF(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function GW(X,$){let Z=!X.root,Y=tF(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!YW.has(J))YW.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(p0.isAbsolute(Q)||eF(Q,J))continue;X[G]=p0.join(J,Q)}}return X}function XV(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=p0.isAbsolute(J)?J:p0.join($,J);if(z$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function $V(X){if(b2(X.stateDir),X.stateDir=T7(),X.cachePath=k7(X.cachePath),X.build)X.build.cacheDir=k7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=k7(X.media.cache.directory);if(X.story)X.story.outDir=k7(X.story.outDir)}async function d1(X){if(!X){if(Q7)return Q7;if(B$)return B$}let $=X?p0.resolve(X):process.cwd(),Z=JW.get($);if(Z)return Z;let Y=(async()=>{let G=(await aF({name:"stx",alias:"ui",cwd:$,defaultConfig:M1,verbose:!1})).config;if($V(G),GW(G,$),XV(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (ZW(),$W)),w=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],K=typeof W==="string"?{}:W[1]||{};try{let z,_;try{z=await import(U),_=p0.dirname(X0.resolve(U))}catch{let j=p0.resolve(process.cwd(),U);z=await import(j),_=p0.dirname(j)}let B=z.default||z;if(Q.register(B,G),B.components){let j=Array.isArray(B.components)?B.components:[B.components];for(let H of j)w.push(p0.resolve(_,H))}if(B.pages){let j=p0.resolve(_,B.pages),H=K.path||"/";q.push({dir:j,prefix:H})}if(B.setup){let j={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:_,config:G};await B.setup(K,j)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(z){console.warn(`[stx] Failed to load plugin ${U}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(JW.set($,Y),!X)B$=Y,Y.then((J)=>{Q7=J}).catch(()=>{});return Y}function ZV(X){return X}function YV(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var M1,YW,Q7=null,JW,B$=null,D7;var L1=E(()=>{A$();R$();u$();d$();N3();kq();Q6();tq();D4();MX();XW();M1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:E5,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:tw,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:eq,hasEndTag:!1,description:"Include a web component in the template"},x6,f6,JG,GG,g6,u6,d6,h6,K2,_2,Nq,G6,...aq],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};YW=new Set;JW=new Map;D7=new Proxy(M1,{get(X,$){if(Q7&&$ in Q7)return Q7[$];if(!B$)d1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var NV=`
15439
+ `}async function JW(X,$,Z,Y){if($.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[UX.join(UX.dirname(Y),Q,`${J}.stx`),UX.join(process.cwd(),Q,`${J}.stx`),UX.join(UX.dirname(Y),`${J}.stx`)],q=null;for(let K of w)if(await n(K)){q=await Bun.file(K).text();break}if(!q)return J0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let W=rF(q,J);return`<script type="module">
15440
+ ${sF(W)}
15441
+ </script>`}var GW=E(()=>{M1();L0()});var QW={};e(QW,{timingPlugin:()=>XV,pluginManager:()=>oF,definePlugin:()=>L$,debugPlugin:()=>eF,createVariablesPlugin:()=>$V,createFilterPlugin:()=>tF,createDirectivePlugin:()=>aF,PluginManager:()=>_6});function L$(X){return X}class _6{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function aF(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function tF(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function $V(X){return L$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var oF,eF,XV;var wW=E(()=>{oF=new _6;eF=L$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),XV=L$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var gZ={};e(gZ,{validateConfig:()=>qV,resolveStxDirectories:()=>UW,loadStxConfig:()=>c1,defineStxConfig:()=>wV,defaultConfig:()=>k1,config:()=>C7});import O$ from"fs";import s0 from"path";import{loadConfigWithResult as ZV}from"bunfig";function YV(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=s0.join(J,"resources","views"),Q=s0.join(J,"resources","layouts");if(O$.existsSync(G)&&O$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=s0.join(J,"resources","views","pages");if(O$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function JV(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function UW(X,$){let Z=!X.root,Y=YV(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!qW.has(J))qW.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(s0.isAbsolute(Q)||JV(Q,J))continue;X[G]=s0.join(J,Q)}}return X}function GV(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=s0.isAbsolute(J)?J:s0.join($,J);if(O$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function QV(X){if(g2(X.stateDir),X.stateDir=E7(),X.cachePath=y7(X.cachePath),X.build)X.build.cacheDir=y7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=y7(X.media.cache.directory);if(X.story)X.story.outDir=y7(X.story.outDir)}async function c1(X){if(!X){if(U7)return U7;if(F$)return F$}let $=X?s0.resolve(X):process.cwd(),Z=WW.get($);if(Z)return Z;let Y=(async()=>{let G=(await ZV({name:"stx",alias:"ui",cwd:$,defaultConfig:k1,verbose:!1})).config;if(QV(G),UW(G,$),GV(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (wW(),QW)),w=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],K=typeof W==="string"?{}:W[1]||{};try{let z,_;try{z=await import(U),_=s0.dirname(Z0.resolve(U))}catch{let j=s0.resolve(process.cwd(),U);z=await import(j),_=s0.dirname(j)}let B=z.default||z;if(Q.register(B,G),B.components){let j=Array.isArray(B.components)?B.components:[B.components];for(let H of j)w.push(s0.resolve(_,H))}if(B.pages){let j=s0.resolve(_,B.pages),H=K.path||"/";q.push({dir:j,prefix:H})}if(B.setup){let j={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:_,config:G};await B.setup(K,j)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(z){console.warn(`[stx] Failed to load plugin ${U}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(WW.set($,Y),!X)F$=Y,Y.then((J)=>{U7=J}).catch(()=>{});return Y}function wV(X){return X}function qV(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var k1,qW,U7=null,WW,F$=null,C7;var V1=E(()=>{I$();E$();i$();n$();S3();bq();B6();YW();x4();IX();GW();k1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:b5,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:Yq,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:JW,hasEndTag:!1,description:"Include a web component in the template"},l6,c6,WG,UG,p6,n6,r6,i6,O2,A2,yq,z6,...ZW],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};qW=new Set;WW=new Map;C7=new Proxy(k1,{get(X,$){if(U7&&$ in U7)return U7[$];if(!F$)c1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var yV=`
15440
15442
  <script>
15441
15443
  (function() {
15442
15444
  'use strict';
@@ -15902,7 +15904,7 @@ else if (data.type === 'event' && data.method) {
15902
15904
  }
15903
15905
  })();
15904
15906
  </script>
15905
- `;function z6(X={}){let{debug:$=!1,timeout:Z=30000}=X;return`
15907
+ `;function F6(X={}){let{debug:$=!1,timeout:Z=30000}=X;return`
15906
15908
  <script>
15907
15909
  (function() {
15908
15910
  'use strict';
@@ -16368,14 +16370,14 @@ else if (data.type === 'event' && data.method) {
16368
16370
  }
16369
16371
  })();
16370
16372
  </script>
16371
- `.replace("debug: false,",`debug: ${$},`).replace("timeout: 30000",`timeout: ${Z}`)}function kV(){return!1}function IV(X,$={}){let Z=/@craft(?:\(([\s\S]*?)\))?/g;return X.replace(Z,(Y,J)=>{let G={};if(J)try{G=JSON.parse(J.replace(/'/g,'"'))}catch{try{G=Function(`return ${J}`)()}catch{console.warn(`[stx] Invalid @craft config: ${J}`)}}return z6(G)})}function B6(X,$={}){if(X.includes("__craftBridgeInitialized"))return X;let Z=z6($);if(X.includes("</head>"))return X.replace("</head>",`${Z}
16373
+ `.replace("debug: false,",`debug: ${$},`).replace("timeout: 30000",`timeout: ${Z}`)}function bV(){return!1}function SV(X,$={}){let Z=/@craft(?:\(([\s\S]*?)\))?/g;return X.replace(Z,(Y,J)=>{let G={};if(J)try{G=JSON.parse(J.replace(/'/g,'"'))}catch{try{G=Function(`return ${J}`)()}catch{console.warn(`[stx] Invalid @craft config: ${J}`)}}return F6(G)})}function V6(X,$={}){if(X.includes("__craftBridgeInitialized"))return X;let Z=F6($);if(X.includes("</head>"))return X.replace("</head>",`${Z}
16372
16374
  </head>`);if(X.includes("<body"))return X.replace(/(<body[^>]*>)/,`$1
16373
- ${Z}`);return Z+X}var LW=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 DV(X,$={}){let Z=performance.now(),Y={target:$.target||"universal",format:$.format||"zig",optimize:$.optimize??!0,treeShake:$.treeShake??!0,hotReload:$.hotReload??!1,debug:$.debug??!1,sourceMaps:$.sourceMaps??!1,bundle:$.bundle??!0,minify:$.minify??!1,components:$.components||LW},J=typeof X==="string"?OW(X):X,G=VW(J.tree,Y),Q=IW(G),w=Y.treeShake?DW(G,Q):G,q=new Map;if(Y.target==="universal"){let _=["macos","windows","linux","ios","android"];for(let B of _){let j=L$(w,{...Y,target:B});q.set(B,j)}}else{let _=L$(w,Y);q.set(Y.target,_)}let W=SW(w,Y,q),U=CW(J,w,Y),K={compilationTime:performance.now()-Z,totalComponents:O$(J.tree),nativeComponents:F$(w),webComponents:O$(J.tree)-F$(w),bundleSize:W.length,treeShakenSize:Y.treeShake?yW(G,w):W.length,warnings:[],errors:[]},z;if(Y.sourceMaps)z=PW(J,w);return{code:W,platformCode:q,dependencies:Q,manifest:U,sourceMaps:z,stats:K}}function OW(X){let $={type:"fragment",children:[]},Z=X.match(/<body[^>]*>([\s\S]*?)<\/body>/i),Y=Z?Z[1]:X;return j6(Y,$),{id:V6(),hash:A6(X),tree:$,scripts:fW(X),styles:gW(X),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:X.includes("{{"),hasEventHandlers:X.includes("onclick")||X.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:X.length}}}function j6(X,$){let Z=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q]=Y,w=J.startsWith("@craft-"),q={type:w?"component":"element",tag:w?J.slice(1):J,props:FW(G),children:[],componentName:w?J.slice(1):void 0};if(Q){let W=Q.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});j6(Q,q)}$.children=$.children??[],$.children.push(q)}}function FW(X){let $={},Z=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G]=Y;$[J]=G??!0}return $}function VW(X,$){return H6(X,$)}function H6(X,$){let Z=X.componentName?$.components?.get(X.componentName):void 0,Y="craft.View";if(Z)Y=Z.zigType;else if(X.type==="text")Y="craft.Text";else if(X.tag)Y=AW(X.tag);let J={};if(X.props)for(let[q,W]of Object.entries(X.props))J[q]=RW(W);let G=[];if(X.children)for(let q of X.children)G.push(H6(q,$));let Q=new Map;if(X.props){for(let[q,W]of Object.entries(X.props))if(q.startsWith("on")&&typeof W==="string")Q.set(q.slice(2).toLowerCase(),W)}let w=TW(X);return{type:MW(X,Z),zigType:Y,props:J,children:G,events:Q,styles:w,id:X.hydrationKey,key:X.props?.key}}function AW(X){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"}[X.toLowerCase()]||"craft.View"}function RW(X){if(typeof X==="string"){if(X.startsWith("{{")&&X.endsWith("}}"))return{type:"binding",path:X.slice(2,-2).trim()};if(X.includes("(")&&X.includes(")"))return{type:"callback",handler:X};return{type:"literal",value:X}}if(typeof X==="number"||typeof X==="boolean")return{type:"literal",value:X};return{type:"literal",value:String(X)}}function MW(X,$){if($){let Y=$.name.toLowerCase();if(Y.includes("button"))return"button";if(Y.includes("input")||Y.includes("text"))return"input";if(Y.includes("image")||Y.includes("avatar"))return"image";if(Y.includes("list")||Y.includes("table"))return"list";if(Y.includes("scroll"))return"scroll";return"custom"}if(X.type==="text")return"text";let Z=X.tag?.toLowerCase();if(Z==="button")return"button";if(Z==="input"||Z==="textarea")return"input";if(Z==="img")return"image";if(Z==="ul"||Z==="ol")return"list";return"view"}function TW(X){let $=X.props?.style,Z={},Y={};if($){let J=$.split(";").filter(Boolean);for(let G of J){let[Q,w]=G.split(":").map((q)=>q.trim());if(!Q||!w)continue;switch(Q){case"display":Z.display=w;break;case"flex-direction":Z.flexDirection=w;break;case"justify-content":Z.justifyContent=NW(w);break;case"align-items":Z.alignItems=kW(w);break;case"gap":Z.gap=Number.parseInt(w,10);break;case"padding":Z.padding=Number.parseInt(w,10);break;case"margin":Z.margin=Number.parseInt(w,10);break;case"width":Z.width=w==="auto"?"auto":Number.parseInt(w,10);break;case"height":Z.height=w==="auto"?"auto":Number.parseInt(w,10);break;case"background-color":case"background":Y.backgroundColor=w;break;case"border-color":Y.borderColor=w;break;case"border-width":Y.borderWidth=Number.parseInt(w,10);break;case"border-radius":Y.borderRadius=Number.parseInt(w,10);break;case"opacity":Y.opacity=Number.parseFloat(w);break}}}return{layout:Z,appearance:Y}}function NW(X){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[X]||"start"}function kW(X){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[X]||"start"}function IW(X){let $=[],Z=new Set;function Y(J,G){let Q=J.id||V6();if(Z.has(Q))return;Z.add(Q);let w={id:Q,type:"component",path:J.zigType,dependencies:G?[G]:[],size:L6(J),isStatic:EW(J)};$.push(w);for(let q of J.children)Y(q,Q)}return Y(X),$}function L6(X){let $=100;return $+=Object.keys(X.props).length*20,$+=X.events.size*50,$}function EW(X){for(let $ of Object.values(X.props))if($.type!=="literal")return!1;return X.events.size===0}function DW(X,$){return X}function yW(X,$){let Z=0;function Y(J){Z+=L6(J);for(let G of J.children)Y(G)}return Y($),Z}function L$(X,$){switch($.format){case"zig":return _6(X,$);case"typescript":return bW(X,$);case"json":return JSON.stringify(X,null,$.minify?0:2);default:return _6(X,$)}}function _6(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('const std = @import("std");'),Z.push('const craft = @import("craft");'),Z.push(""),Z.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Z.push(" return try build(allocator);"),Z.push("}"),Z.push(""),O6(X,Z,0),Z.join(`
16374
- `)}function O6(X,$,Z){let Y=" ".repeat(Z);if(Z===0)$.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Z}`;$.push(`${Y} var ${J} = try ${X.zigType}.init(allocator);`);for(let[G,Q]of Object.entries(X.props))if(Q.type==="literal"){let w=typeof Q.value==="string"?`"${Q.value}"`:String(Q.value);$.push(`${Y} ${J}.set${xW(G)}(${w});`)}for(let G=0;G<X.children.length;G++){let Q=X.children[G];if(Q.type==="text"){let w=Q.props.text?.type==="literal"?String(Q.props.text.value):"";$.push(`${Y} try ${J}.addChild(try craft.Text.init(allocator, "${w}"));`)}else O6(Q,$,Z+1),$.push(`${Y} try ${J}.addChild(node_${Z+1});`)}if(Z===0)$.push(` return ${J}.element();`),$.push("}")}function bW(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('import { Craft } from "@stacksjs/craft";'),Z.push(""),Z.push("export function render(): Craft.Element {"),Z.push(" return "+F6(X,1)+";"),Z.push("}"),Z.join(`
16375
- `)}function F6(X,$){let Z=" ".repeat($),Y=[];for(let[w,q]of Object.entries(X.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);Y.push(`${w}: ${W}`)}let J=Y.length>0?`{ ${Y.join(", ")} }`:"{}",G=X.children.map((w)=>w.type==="text"?`"${w.props.text?.type==="literal"?w.props.text.value:""}"`:F6(w,$+1)),Q=G.length>0?`,
16375
+ ${Z}`);return Z+X}var RW=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 PV(X,$={}){let Z=performance.now(),Y={target:$.target||"universal",format:$.format||"zig",optimize:$.optimize??!0,treeShake:$.treeShake??!0,hotReload:$.hotReload??!1,debug:$.debug??!1,sourceMaps:$.sourceMaps??!1,bundle:$.bundle??!0,minify:$.minify??!1,components:$.components||RW},J=typeof X==="string"?MW(X):X,G=NW(J.tree,Y),Q=SW(G),w=Y.treeShake?PW(G,Q):G,q=new Map;if(Y.target==="universal"){let _=["macos","windows","linux","ios","android"];for(let B of _){let j=M$(w,{...Y,target:B});q.set(B,j)}}else{let _=M$(w,Y);q.set(Y.target,_)}let W=fW(w,Y,q),U=gW(J,w,Y),K={compilationTime:performance.now()-Z,totalComponents:T$(J.tree),nativeComponents:N$(w),webComponents:T$(J.tree)-N$(w),bundleSize:W.length,treeShakenSize:Y.treeShake?vW(G,w):W.length,warnings:[],errors:[]},z;if(Y.sourceMaps)z=hW(J,w);return{code:W,platformCode:q,dependencies:Q,manifest:U,sourceMaps:z,stats:K}}function MW(X){let $={type:"fragment",children:[]},Z=X.match(/<body[^>]*>([\s\S]*?)<\/body>/i),Y=Z?Z[1]:X;return R6(Y,$),{id:I6(),hash:E6(X),tree:$,scripts:mW(X),styles:lW(X),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:X.includes("{{"),hasEventHandlers:X.includes("onclick")||X.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:X.length}}}function R6(X,$){let Z=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q]=Y,w=J.startsWith("@craft-"),q={type:w?"component":"element",tag:w?J.slice(1):J,props:TW(G),children:[],componentName:w?J.slice(1):void 0};if(Q){let W=Q.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});R6(Q,q)}$.children=$.children??[],$.children.push(q)}}function TW(X){let $={},Z=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G]=Y;$[J]=G??!0}return $}function NW(X,$){return M6(X,$)}function M6(X,$){let Z=X.componentName?$.components?.get(X.componentName):void 0,Y="craft.View";if(Z)Y=Z.zigType;else if(X.type==="text")Y="craft.Text";else if(X.tag)Y=kW(X.tag);let J={};if(X.props)for(let[q,W]of Object.entries(X.props))J[q]=IW(W);let G=[];if(X.children)for(let q of X.children)G.push(M6(q,$));let Q=new Map;if(X.props){for(let[q,W]of Object.entries(X.props))if(q.startsWith("on")&&typeof W==="string")Q.set(q.slice(2).toLowerCase(),W)}let w=DW(X);return{type:EW(X,Z),zigType:Y,props:J,children:G,events:Q,styles:w,id:X.hydrationKey,key:X.props?.key}}function kW(X){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"}[X.toLowerCase()]||"craft.View"}function IW(X){if(typeof X==="string"){if(X.startsWith("{{")&&X.endsWith("}}"))return{type:"binding",path:X.slice(2,-2).trim()};if(X.includes("(")&&X.includes(")"))return{type:"callback",handler:X};return{type:"literal",value:X}}if(typeof X==="number"||typeof X==="boolean")return{type:"literal",value:X};return{type:"literal",value:String(X)}}function EW(X,$){if($){let Y=$.name.toLowerCase();if(Y.includes("button"))return"button";if(Y.includes("input")||Y.includes("text"))return"input";if(Y.includes("image")||Y.includes("avatar"))return"image";if(Y.includes("list")||Y.includes("table"))return"list";if(Y.includes("scroll"))return"scroll";return"custom"}if(X.type==="text")return"text";let Z=X.tag?.toLowerCase();if(Z==="button")return"button";if(Z==="input"||Z==="textarea")return"input";if(Z==="img")return"image";if(Z==="ul"||Z==="ol")return"list";return"view"}function DW(X){let $=X.props?.style,Z={},Y={};if($){let J=$.split(";").filter(Boolean);for(let G of J){let[Q,w]=G.split(":").map((q)=>q.trim());if(!Q||!w)continue;switch(Q){case"display":Z.display=w;break;case"flex-direction":Z.flexDirection=w;break;case"justify-content":Z.justifyContent=yW(w);break;case"align-items":Z.alignItems=bW(w);break;case"gap":Z.gap=Number.parseInt(w,10);break;case"padding":Z.padding=Number.parseInt(w,10);break;case"margin":Z.margin=Number.parseInt(w,10);break;case"width":Z.width=w==="auto"?"auto":Number.parseInt(w,10);break;case"height":Z.height=w==="auto"?"auto":Number.parseInt(w,10);break;case"background-color":case"background":Y.backgroundColor=w;break;case"border-color":Y.borderColor=w;break;case"border-width":Y.borderWidth=Number.parseInt(w,10);break;case"border-radius":Y.borderRadius=Number.parseInt(w,10);break;case"opacity":Y.opacity=Number.parseFloat(w);break}}}return{layout:Z,appearance:Y}}function yW(X){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[X]||"start"}function bW(X){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[X]||"start"}function SW(X){let $=[],Z=new Set;function Y(J,G){let Q=J.id||I6();if(Z.has(Q))return;Z.add(Q);let w={id:Q,type:"component",path:J.zigType,dependencies:G?[G]:[],size:T6(J),isStatic:CW(J)};$.push(w);for(let q of J.children)Y(q,Q)}return Y(X),$}function T6(X){let $=100;return $+=Object.keys(X.props).length*20,$+=X.events.size*50,$}function CW(X){for(let $ of Object.values(X.props))if($.type!=="literal")return!1;return X.events.size===0}function PW(X,$){return X}function vW(X,$){let Z=0;function Y(J){Z+=T6(J);for(let G of J.children)Y(G)}return Y($),Z}function M$(X,$){switch($.format){case"zig":return A6(X,$);case"typescript":return xW(X,$);case"json":return JSON.stringify(X,null,$.minify?0:2);default:return A6(X,$)}}function A6(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('const std = @import("std");'),Z.push('const craft = @import("craft");'),Z.push(""),Z.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Z.push(" return try build(allocator);"),Z.push("}"),Z.push(""),N6(X,Z,0),Z.join(`
16376
+ `)}function N6(X,$,Z){let Y=" ".repeat(Z);if(Z===0)$.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Z}`;$.push(`${Y} var ${J} = try ${X.zigType}.init(allocator);`);for(let[G,Q]of Object.entries(X.props))if(Q.type==="literal"){let w=typeof Q.value==="string"?`"${Q.value}"`:String(Q.value);$.push(`${Y} ${J}.set${dW(G)}(${w});`)}for(let G=0;G<X.children.length;G++){let Q=X.children[G];if(Q.type==="text"){let w=Q.props.text?.type==="literal"?String(Q.props.text.value):"";$.push(`${Y} try ${J}.addChild(try craft.Text.init(allocator, "${w}"));`)}else N6(Q,$,Z+1),$.push(`${Y} try ${J}.addChild(node_${Z+1});`)}if(Z===0)$.push(` return ${J}.element();`),$.push("}")}function xW(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('import { Craft } from "@stacksjs/craft";'),Z.push(""),Z.push("export function render(): Craft.Element {"),Z.push(" return "+k6(X,1)+";"),Z.push("}"),Z.join(`
16377
+ `)}function k6(X,$){let Z=" ".repeat($),Y=[];for(let[w,q]of Object.entries(X.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);Y.push(`${w}: ${W}`)}let J=Y.length>0?`{ ${Y.join(", ")} }`:"{}",G=X.children.map((w)=>w.type==="text"?`"${w.props.text?.type==="literal"?w.props.text.value:""}"`:k6(w,$+1)),Q=G.length>0?`,
16376
16378
  ${Z} [${G.join(`,
16377
- ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,Z){if($.target==="universal"){let Y=[];Y.push("// Universal entry point"),Y.push("");for(let[J,G]of Z)Y.push(`// --- ${J.toUpperCase()} ---`),Y.push(`#if ${J.toUpperCase()}`),Y.push(G),Y.push("#endif"),Y.push("");return Y.join(`
16378
- `)}return Z.get($.target)||L$(X,$)}function CW(X,$,Z){let Y=[];function J(G){Y.push({name:G.zigType,hash:A6(JSON.stringify(G.props)),props:Object.keys(G.props),events:Array.from(G.events.keys()),slots:[],isNative:G.zigType.startsWith("craft.")});for(let Q of G.children)J(Q)}return J($),{version:"1.0.0",components:Y,entry:X.id,assets:[],styles:X.styles}}function PW(X,$){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var vW=0;function V6(){return`id_${++vW}`}function A6(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}function xW(X){return X.charAt(0).toUpperCase()+X.slice(1)}function fW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function gW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function O$(X){let $=X.type==="component"?1:0;if(X.children)for(let Z of X.children)$+=O$(Z);return $}function F$(X){let $=X.zigType.startsWith("craft.")?1:0;for(let Z of X.children)$+=F$(Z);return $}function yV(X){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:($)=>{console.log(`[craft-compiler] File changed: ${$}`)}}}var V$={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:(X,$)=>{let Z=X.checked?"checked":"",Y=X.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
16379
+ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function fW(X,$,Z){if($.target==="universal"){let Y=[];Y.push("// Universal entry point"),Y.push("");for(let[J,G]of Z)Y.push(`// --- ${J.toUpperCase()} ---`),Y.push(`#if ${J.toUpperCase()}`),Y.push(G),Y.push("#endif"),Y.push("");return Y.join(`
16380
+ `)}return Z.get($.target)||M$(X,$)}function gW(X,$,Z){let Y=[];function J(G){Y.push({name:G.zigType,hash:E6(JSON.stringify(G.props)),props:Object.keys(G.props),events:Array.from(G.events.keys()),slots:[],isNative:G.zigType.startsWith("craft.")});for(let Q of G.children)J(Q)}return J($),{version:"1.0.0",components:Y,entry:X.id,assets:[],styles:X.styles}}function hW(X,$){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var uW=0;function I6(){return`id_${++uW}`}function E6(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}function dW(X){return X.charAt(0).toUpperCase()+X.slice(1)}function mW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function lW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function T$(X){let $=X.type==="component"?1:0;if(X.children)for(let Z of X.children)$+=T$(Z);return $}function N$(X){let $=X.zigType.startsWith("craft.")?1:0;for(let Z of X.children)$+=N$(Z);return $}function vV(X){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:($)=>{console.log(`[craft-compiler] File changed: ${$}`)}}}var k$={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:(X,$)=>{let Z=X.checked?"checked":"",Y=X.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
16379
16381
  <input type="checkbox" class="craft-checkbox" ${Z} ${Y}>
16380
16382
  <span class="craft-checkbox-label">${$||X.label||""}</span>
16381
16383
  </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:(X,$)=>{let Z=X.min??0,Y=X.max??100,J=X.step??1,G=X.value??50,Q=X.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${Z}" max="${Y}" step="${J}" value="${G}" ${Q}>`}},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:(X,$)=>{let Z=X.size||40,Y=X.src,J=String(X.alt||""),G=X.fallback||(J?J.charAt(0).toUpperCase():"?");if(Y)return`<img class="craft-avatar" src="${Y}" alt="${J}" style="width:${Z}px;height:${Z}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${Z}px;height:${Z}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${G}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(X,$)=>{let Z=Number(X.value)||0,Y=Number(X.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,Z/Y*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(X,$)=>{let Z=X.size||24;return`<div class="craft-spinner" style="width:${Z}px;height:${Z}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:(X,$)=>{let Z=X.open?"open":"",Y=X.title||"";return`<dialog class="craft-modal" ${Z}>
@@ -16389,7 +16391,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,
16389
16391
  </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:(X,$)=>{let Z=X.variant||"info",Y=X.title||"";return`<div class="craft-alert craft-alert-${Z}" role="alert">
16390
16392
  ${Y?`<div class="craft-alert-title">${Y}</div>`:""}
16391
16393
  <div class="craft-alert-content">${$}</div>
16392
- </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:(X,$)=>{let Z=X.content||"",Y=X.position||"top";return`<span class="craft-tooltip" data-tooltip="${Z}" data-position="${Y}">${$}</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:hW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:uW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:dW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:mW},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:(X,$)=>{return`<input type="color" class="craft-color-picker" value="${X.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(X,$)=>{let Z=X.value||"",Y=X.min||"",J=X.max||"";return`<input type="date" class="craft-date-picker" value="${Z}" min="${Y}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(X,$)=>{return`<input type="time" class="craft-time-picker" value="${X.value||""}">`}}},R6=`
16394
+ </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:(X,$)=>{let Z=X.content||"",Y=X.position||"top";return`<span class="craft-tooltip" data-tooltip="${Z}" data-position="${Y}">${$}</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:cW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:pW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:iW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:nW},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:(X,$)=>{return`<input type="color" class="craft-color-picker" value="${X.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(X,$)=>{let Z=X.value||"",Y=X.min||"",J=X.max||"";return`<input type="date" class="craft-date-picker" value="${Z}" min="${Y}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(X,$)=>{return`<input type="time" class="craft-time-picker" value="${X.value||""}">`}}},D6=`
16393
16395
  <style id="craft-component-styles">
16394
16396
  /* Craft Component Base Styles */
16395
16397
  .craft-button {
@@ -16807,7 +16809,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,
16807
16809
  }
16808
16810
  }
16809
16811
  </style>
16810
- `,SV=`
16812
+ `,fV=`
16811
16813
  <script id="craft-component-runtime">
16812
16814
  (function() {
16813
16815
  if (window.__stxCraftComponentRuntime) return;
@@ -16911,7 +16913,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,
16911
16913
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
16912
16914
  })();
16913
16915
  </script>
16914
- `;function M6(X,$={}){let{classPrefix:Z="craft"}=$;if(!X.includes("craft-component-styles"))if(X.includes("</head>"))X=X.replace("</head>",`${`
16916
+ `;function y6(X,$={}){let{classPrefix:Z="craft"}=$;if(!X.includes("craft-component-styles"))if(X.includes("</head>"))X=X.replace("</head>",`${`
16915
16917
  <style id="craft-component-styles">
16916
16918
  /* Craft Component Base Styles */
16917
16919
  .craft-button {
@@ -18376,35 +18378,35 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,
18376
18378
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
18377
18379
  })();
18378
18380
  </script>
18379
- `;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return UX("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return UX("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return UX(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return UX(J,G,Q.trim(),$,Z)}),X}function UX(X,$,Z,Y,J){let G=Y.components?.[X]||V$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=KX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let q=oW(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${q}>`;return`<${G.fallbackTag} ${q}>${Z}</${G.fallbackTag}>`}function KX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,q=Q??w;if(J.startsWith(":"))$[G]=q;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=q;else if(q===void 0)$[G]=!0;else $[G]=q}return $}function hW(X,$){let Z=A5(String(X.id||`craft-sidebar-${rW($||JSON.stringify(X))}`)),Y=pW(X.spaces)||cW($),J=Y.length?[]:nW(X.sections)||T6($),G=String(X.selectedSpace||Y[0]?.id||""),Q=Y.find((B)=>B.id===G)||Y[0],w=String(X.selectedItem||X.selected||(Y.length?Q?.sections[0]?.items[0]?.id:J[0]?.items[0]?.id)||""),q={id:Z,variant:String(X.variant||"desktop"),material:String(X.material||"sidebar"),backgroundEffect:String(X.backgroundEffect||"shimmer"),allowsVibrancy:X.allowsVibrancy!==!1&&X.allowsVibrancy!=="false",materialOpacity:Number(X.materialOpacity??0.68),materialDarkOpacity:X.materialDarkOpacity===void 0?void 0:Number(X.materialDarkOpacity),minWidth:X.minWidth===void 0?240:Number(X.minWidth),maxWidth:X.maxWidth===void 0?340:Number(X.maxWidth),canCollapse:X.canCollapse!==!1&&X.canCollapse!=="false",searchPlaceholder:X.searchPlaceholder?String(X.searchPlaceholder):void 0,selectedItem:w,sections:J,spaces:Y,selectedSpace:G||void 0},W=String(X.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number(X.width||X.sidebarWidth||286),K=X.native===!1||X.native==="false"?"false":"true",z=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${_1(q.searchPlaceholder)}"></div>`:"",_;if(Y.length)_=iW(Y,G,w);else if(J.length)_=J.map((B)=>N6(B,w)).join("");else _=$;return`<aside class="${d0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${d0(Z)}" data-native="${K}" style="--craft-sidebar-width:${U}px">
18381
+ `;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return _X("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return _X("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return _X(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return _X(J,G,Q.trim(),$,Z)}),X}function _X(X,$,Z,Y,J){let G=Y.components?.[X]||k$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=jX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let q=$U(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${q}>`;return`<${G.fallbackTag} ${q}>${Z}</${G.fallbackTag}>`}function jX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,q=Q??w;if(J.startsWith(":"))$[G]=q;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=q;else if(q===void 0)$[G]=!0;else $[G]=q}return $}function cW(X,$){let Z=T5(String(X.id||`craft-sidebar-${eW($||JSON.stringify(X))}`)),Y=oW(X.spaces)||sW($),J=Y.length?[]:tW(X.sections)||b6($),G=String(X.selectedSpace||Y[0]?.id||""),Q=Y.find((B)=>B.id===G)||Y[0],w=String(X.selectedItem||X.selected||(Y.length?Q?.sections[0]?.items[0]?.id:J[0]?.items[0]?.id)||""),q={id:Z,variant:String(X.variant||"desktop"),material:String(X.material||"sidebar"),backgroundEffect:String(X.backgroundEffect||"shimmer"),allowsVibrancy:X.allowsVibrancy!==!1&&X.allowsVibrancy!=="false",materialOpacity:Number(X.materialOpacity??0.68),materialDarkOpacity:X.materialDarkOpacity===void 0?void 0:Number(X.materialDarkOpacity),minWidth:X.minWidth===void 0?240:Number(X.minWidth),maxWidth:X.maxWidth===void 0?340:Number(X.maxWidth),canCollapse:X.canCollapse!==!1&&X.canCollapse!=="false",searchPlaceholder:X.searchPlaceholder?String(X.searchPlaceholder):void 0,selectedItem:w,sections:J,spaces:Y,selectedSpace:G||void 0},W=String(X.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number(X.width||X.sidebarWidth||286),K=X.native===!1||X.native==="false"?"false":"true",z=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${L1(q.searchPlaceholder)}"></div>`:"",_;if(Y.length)_=aW(Y,G,w);else if(J.length)_=J.map((B)=>S6(B,w)).join("");else _=$;return`<aside class="${p0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${p0(Z)}" data-native="${K}" style="--craft-sidebar-width:${U}px">
18380
18382
  ${z}
18381
18383
  ${_}
18382
18384
  </aside>
18383
- <script type="application/json" data-craft-sidebar-config="${d0(Z)}">${sW(q)}</script>`}function uW(X,$){let Z=A5(String(X.id||X.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${d0(Z)}">
18384
- ${X.label?`<div class="craft-sidebar-space-title">${_1(String(X.label))}</div>`:""}
18385
+ <script type="application/json" data-craft-sidebar-config="${p0(Z)}">${XU(q)}</script>`}function pW(X,$){let Z=T5(String(X.id||X.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${p0(Z)}">
18386
+ ${X.label?`<div class="craft-sidebar-space-title">${L1(String(X.label))}</div>`:""}
18385
18387
  ${$}
18386
- </section>`}function dW(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${d0(String(X.id||"section"))}">
18387
- ${Z?`<div class="craft-sidebar-section-title">${_1(Z)}</div>`:""}
18388
+ </section>`}function iW(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${p0(String(X.id||"section"))}">
18389
+ ${Z?`<div class="craft-sidebar-section-title">${L1(Z)}</div>`:""}
18388
18390
  ${$}
18389
- </section>`}function mW(X,$){let Z={id:String(X.id||A5(String(X.label||$||"item"))),label:String(X.label||$||""),icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0};return k6(Z,String(X.selected||"")==="true")}function T6(X){let $=[],Z=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,Y;while((Y=Z.exec(X))!==null){let J=KX(Y[1]||""),G=Y[2]||"",Q=String(J.id||A5(String(J.header||J.title||`section-${$.length+1}`))),w=String(J.header||J.title||Q),q=lW(G);$.push({id:Q,header:w,title:w,items:q})}return $}function lW(X){let $=[],Z=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,Y;while((Y=Z.exec(X))!==null){let J=KX(Y[1]||""),G=String(J.label||(Y[2]||"").replace(/<[^>]*>/g,"").trim()),Q=String(J.id||A5(G||`item-${$.length+1}`));$.push({id:Q,label:G,icon:J.icon?String(J.icon):void 0,badge:J.badge?String(J.badge):void 0,tintColor:J.tintColor?String(J.tintColor):void 0})}return $}function cW(X){let $=[],Z=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,Y;while((Y=Z.exec(X))!==null){let J=KX(Y[1]||""),G=Y[2]||"",Q=String(J.label||J.title||`Space ${$.length+1}`);$.push({id:String(J.id||A5(Q)),label:Q,icon:J.icon?String(J.icon):void 0,tint:J.tint?String(J.tint):void 0,sections:T6(G)})}return $}function pW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function iW(X,$,Z){let Y=X.map((G)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${d0(G.id)}" data-selected="${G.id===$?"true":"false"}" title="${d0(G.label||G.id)}">${G.icon?`<span class="craft-sidebar-item-icon" data-icon="${d0(G.icon)}"></span>`:_1((G.label||G.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${X.map((G)=>`<section class="craft-sidebar-space" data-space-id="${d0(G.id)}" data-selected="${G.id===$?"true":"false"}">
18390
- ${G.label?`<div class="craft-sidebar-space-title">${_1(G.label)}</div>`:""}
18391
- ${G.sections.map((Q)=>N6(Q,Z)).join("")}
18391
+ </section>`}function nW(X,$){let Z={id:String(X.id||T5(String(X.label||$||"item"))),label:String(X.label||$||""),icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0};return C6(Z,String(X.selected||"")==="true")}function b6(X){let $=[],Z=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,Y;while((Y=Z.exec(X))!==null){let J=jX(Y[1]||""),G=Y[2]||"",Q=String(J.id||T5(String(J.header||J.title||`section-${$.length+1}`))),w=String(J.header||J.title||Q),q=rW(G);$.push({id:Q,header:w,title:w,items:q})}return $}function rW(X){let $=[],Z=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,Y;while((Y=Z.exec(X))!==null){let J=jX(Y[1]||""),G=String(J.label||(Y[2]||"").replace(/<[^>]*>/g,"").trim()),Q=String(J.id||T5(G||`item-${$.length+1}`));$.push({id:Q,label:G,icon:J.icon?String(J.icon):void 0,badge:J.badge?String(J.badge):void 0,tintColor:J.tintColor?String(J.tintColor):void 0})}return $}function sW(X){let $=[],Z=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,Y;while((Y=Z.exec(X))!==null){let J=jX(Y[1]||""),G=Y[2]||"",Q=String(J.label||J.title||`Space ${$.length+1}`);$.push({id:String(J.id||T5(Q)),label:Q,icon:J.icon?String(J.icon):void 0,tint:J.tint?String(J.tint):void 0,sections:b6(G)})}return $}function oW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function aW(X,$,Z){let Y=X.map((G)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${p0(G.id)}" data-selected="${G.id===$?"true":"false"}" title="${p0(G.label||G.id)}">${G.icon?`<span class="craft-sidebar-item-icon" data-icon="${p0(G.icon)}"></span>`:L1((G.label||G.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${X.map((G)=>`<section class="craft-sidebar-space" data-space-id="${p0(G.id)}" data-selected="${G.id===$?"true":"false"}">
18392
+ ${G.label?`<div class="craft-sidebar-space-title">${L1(G.label)}</div>`:""}
18393
+ ${G.sections.map((Q)=>S6(Q,Z)).join("")}
18392
18394
  </section>`).join("")}</div>
18393
- <div class="craft-sidebar-space-switcher">${Y}</div>`}function nW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function N6(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${d0(X.id)}">
18394
- <div class="craft-sidebar-section-title">${_1(Z)}</div>
18395
- ${X.items.map((Y)=>k6(Y,Y.id===$)).join("")}
18396
- </section>`}function k6(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${d0(X.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${d0(X.id)}" data-selected="${$?"true":"false"}">
18397
- ${X.icon?`<span class="craft-sidebar-item-icon" data-icon="${d0(X.icon)}"${Z}></span>`:""}
18398
- <span class="craft-sidebar-item-label">${_1(X.label)}</span>
18399
- ${X.badge?`<span class="craft-sidebar-item-badge">${_1(X.badge)}</span>`:""}
18400
- </button>`}function A5(X){return X.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function rW(X){let $=5381;for(let Z=0;Z<X.length;Z++)$=$*33^X.charCodeAt(Z);return($>>>0).toString(36)}function _1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d0(X){return _1(X).replace(/`/g,"&#96;")}function sW(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function oW(X,$,Z){let Y=[];Y.push(`class="${Z.join(" ")}"`),Y.push(`data-craft="${$.nativeType}"`);for(let[J,G]of Object.entries(X))if(G===!0)Y.push(J);else if(G!==!1&&G!==void 0&&G!==null){let Q=String(G).replace(/"/g,"&quot;");Y.push(`${J}="${Q}"`)}return Y.join(" ")}function CV(X,$){V$[X]=$}function PV(){return{...V$}}var q7=new Map,W7=new Map;function aW(X,$){let Z=$?.id||WU(X),Y=UU(X),J=q7.get(Z);if(J&&J.hash===Y)return J;let G=tW(X),Q=GU(X),w=QU(X),q=YU(G),{staticParts:W,dynamicParts:U}=JU(G),K=wU(X),z={id:Z,hash:Y,tree:G,scripts:Q,styles:w,staticParts:W,dynamicParts:U,dependencies:K,metadata:q};return q7.set(Z,z),z}async function xV(X,$={},Z={}){let Y=performance.now();if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`,q=W7.get(w);if(q&&Date.now()-q.timestamp<(Z.cacheTTL||60000))return{html:q.html,styles:X.styles.join(`
18395
+ <div class="craft-sidebar-space-switcher">${Y}</div>`}function tW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function S6(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${p0(X.id)}">
18396
+ <div class="craft-sidebar-section-title">${L1(Z)}</div>
18397
+ ${X.items.map((Y)=>C6(Y,Y.id===$)).join("")}
18398
+ </section>`}function C6(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${p0(X.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${p0(X.id)}" data-selected="${$?"true":"false"}">
18399
+ ${X.icon?`<span class="craft-sidebar-item-icon" data-icon="${p0(X.icon)}"${Z}></span>`:""}
18400
+ <span class="craft-sidebar-item-label">${L1(X.label)}</span>
18401
+ ${X.badge?`<span class="craft-sidebar-item-badge">${L1(X.badge)}</span>`:""}
18402
+ </button>`}function T5(X){return X.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function eW(X){let $=5381;for(let Z=0;Z<X.length;Z++)$=$*33^X.charCodeAt(Z);return($>>>0).toString(36)}function L1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p0(X){return L1(X).replace(/`/g,"&#96;")}function XU(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function $U(X,$,Z){let Y=[];Y.push(`class="${Z.join(" ")}"`),Y.push(`data-craft="${$.nativeType}"`);for(let[J,G]of Object.entries(X))if(G===!0)Y.push(J);else if(G!==!1&&G!==void 0&&G!==null){let Q=String(G).replace(/"/g,"&quot;");Y.push(`${J}="${Q}"`)}return Y.join(" ")}function gV(X,$){k$[X]=$}function hV(){return{...k$}}var z7=new Map,B7=new Map;function ZU(X,$){let Z=$?.id||_U(X),Y=jU(X),J=z7.get(Z);if(J&&J.hash===Y)return J;let G=YU(X),Q=UU(X),w=KU(X),q=qU(G),{staticParts:W,dynamicParts:U}=WU(G),K=zU(X),z={id:Z,hash:Y,tree:G,scripts:Q,styles:w,staticParts:W,dynamicParts:U,dependencies:K,metadata:q};return z7.set(Z,z),z}async function dV(X,$={},Z={}){let Y=performance.now();if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`,q=B7.get(w);if(q&&Date.now()-q.timestamp<(Z.cacheTTL||60000))return{html:q.html,styles:X.styles.join(`
18401
18403
  `),scripts:X.scripts.join(`
18402
- `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:X.metadata.componentCount}}}let J;if(Z.streaming)J=await XU(X.tree,$);else J=U7(X.tree,$);let G;if(Z.hydrate){let w=ZU(J,X,$);J=w.html,G=w.data}if(Z.minify)J=qU(J);if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`;W7.set(w,{html:J,timestamp:Date.now()})}let Q=performance.now()-Y;return{html:J,styles:X.styles.join(`
18404
+ `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:X.metadata.componentCount}}}let J;if(Z.streaming)J=await GU(X.tree,$);else J=_7(X.tree,$);let G;if(Z.hydrate){let w=wU(J,X,$);J=w.html,G=w.data}if(Z.minify)J=BU(J);if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`;B7.set(w,{html:J,timestamp:Date.now()})}let Q=performance.now()-Y;return{html:J,styles:X.styles.join(`
18403
18405
  `),scripts:X.scripts.join(`
18404
- `),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function fV(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return K7(X.tree,(w,q)=>{if(w.type==="component"&&w.componentName){if(C6(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let W=BU(w);if(W)Q.push(W);if(w.props){for(let[U,K]of Object.entries(w.props))if(U.startsWith("on")&&typeof K==="string"){let z=`handler_${G.size}`;G.set(z,K)}}}if(w.isStatic&&w.type==="element")Y.push(D6(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function gV(X,$={}){let Z=aW(X),Y=$U(Z,$),J=new Map,G=[];return K7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(C6(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function tW(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[W,U,K]=Q,z=eW(K),_=U.startsWith("@craft-"),B=_?U:U.toLowerCase(),j={type:_?"component":"element",tag:B,props:z,children:[],componentName:_?B.slice(1):void 0,isStatic:!I6(K),hydrationKey:zU()};if(Z.children=Z.children||[],Z.children.push(j),!G.has(B)&&!K.endsWith("/"))Y.push(j),Z=j;J=J.slice(W.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[W,U]=w,z=U.startsWith("@craft-")?U:U.toLowerCase();while(Y.length>1){let _=Y.pop();if(Z=Y[Y.length-1],_.tag===z)break}J=J.slice(W.length);continue}let q=J.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!I6(W)};Z.children=Z.children||[],Z.children.push(U)}J=J.slice(W.length);continue}J=J.slice(1)}return $}function eW(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,q=G??Q??w??!0;$[J]=q}return $}function K7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{K7(Y,$,[...Z,`${J}`])})}function U7(X,$){switch(X.type){case"text":return b6(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=y6(X.props||{},$),J=(X.children||[]).map((G)=>U7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>U7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function D6(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=y6(X.props||{},{});return`<${$}${Z}></${$}>`}function y6(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=b6(String(J),$);Z.push(` ${Y}="${S6(G)}"`)}return Z.join("")}async function XU(X,$){return U7(X,$)}function $U(X,$){let Z=[];return K7(X.tree,(Y)=>{if(Y.isStatic)Z.push(U7(Y,$))}),Z.join("")}function ZU(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
18406
+ `),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function mV(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return j7(X.tree,(w,q)=>{if(w.type==="component"&&w.componentName){if(u6(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let W=OU(w);if(W)Q.push(W);if(w.props){for(let[U,K]of Object.entries(w.props))if(U.startsWith("on")&&typeof K==="string"){let z=`handler_${G.size}`;G.set(z,K)}}}if(w.isStatic&&w.type==="element")Y.push(x6(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function lV(X,$={}){let Z=ZU(X),Y=QU(Z,$),J=new Map,G=[];return j7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(u6(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function YU(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[W,U,K]=Q,z=JU(K),_=U.startsWith("@craft-"),B=_?U:U.toLowerCase(),j={type:_?"component":"element",tag:B,props:z,children:[],componentName:_?B.slice(1):void 0,isStatic:!P6(K),hydrationKey:LU()};if(Z.children=Z.children||[],Z.children.push(j),!G.has(B)&&!K.endsWith("/"))Y.push(j),Z=j;J=J.slice(W.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[W,U]=w,z=U.startsWith("@craft-")?U:U.toLowerCase();while(Y.length>1){let _=Y.pop();if(Z=Y[Y.length-1],_.tag===z)break}J=J.slice(W.length);continue}let q=J.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!P6(W)};Z.children=Z.children||[],Z.children.push(U)}J=J.slice(W.length);continue}J=J.slice(1)}return $}function JU(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,q=G??Q??w??!0;$[J]=q}return $}function j7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{j7(Y,$,[...Z,`${J}`])})}function _7(X,$){switch(X.type){case"text":return g6(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=f6(X.props||{},$),J=(X.children||[]).map((G)=>_7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>_7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function x6(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=f6(X.props||{},{});return`<${$}${Z}></${$}>`}function f6(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=g6(String(J),$);Z.push(` ${Y}="${h6(G)}"`)}return Z.join("")}async function GU(X,$){return _7(X,$)}function QU(X,$){let Z=[];return j7(X.tree,(Y)=>{if(Y.isStatic)Z.push(_7(Y,$))}),Z.join("")}function wU(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
18405
18407
  <script data-craft-hydration>
18406
18408
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(Y)};
18407
- </script>`;return{html:X+J,data:Y}}function YU(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(q.children)q.children.forEach((U)=>w(U,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function JU(X){let $=new Map,Z=new Map;return K7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,D6(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function GU(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function QU(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function wU(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function I6(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function b6(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=E6(J.trim(),$);return S6(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=E6(J.trim(),$);return String(G??"")}catch{return""}}),Z}function E6(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function S6(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function qU(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function WU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function UU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var KU=0;function zU(){return`h_${++KU}`}function C6(X){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(X)}function BU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={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"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function _U(){q7.clear()}function jU(){W7.clear()}function hV(){_U(),jU()}function uV(){return{templateCacheSize:q7.size,renderCacheSize:W7.size,totalEntries:q7.size+W7.size}}import{existsSync as KW,mkdirSync as a0,copyFileSync as p1,chmodSync as i1}from"fs";import{join as u,basename as qV}from"path";import{spawn as j$,execSync as WV}from"child_process";import{tmpdir as zW,homedir as U6,platform as UV}from"os";L1();n5();eX();y5();aX();import{dirname as GV,resolve as qW}from"path";function QW(X){return X.endsWith(".md")||X.endsWith(".markdown")}function JV(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,U=W+q[0].length;if(w?.some((K)=>W>=K.start&&U<=K.end))continue;$.push({start:W,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function wW(X,$={}){let{data:Z,content:Y}=VX(X),G=await($.renderer??((Q)=>s1(Q)))(Y);return{html:JV(G),frontmatter:Z??{}}}function QV(X){let $=X,Z=h5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=Y.exec(X))!==null){let U=q[1],K=q[2],z=q[0],_=U.includes("server");if(w(K))Q.push(z);else if(_)G.push(K);else J.push(z)}let W=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(W))!==null){let _=K.index+K[0].length,B=W.indexOf("</script>",_);if(B===-1)continue;z.push({start:K.index,end:B+9}),U.lastIndex=B+9}for(let _=z.length-1;_>=0;_--)W=W.substring(0,z[_].start)+W.substring(z[_].end)}for(let U of J)W=W.replace(U,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function wV(X,$){return`<!DOCTYPE html>
18409
+ </script>`;return{html:X+J,data:Y}}function qU(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(q.children)q.children.forEach((U)=>w(U,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function WU(X){let $=new Map,Z=new Map;return j7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,x6(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function UU(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function KU(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function zU(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function P6(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function g6(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=v6(J.trim(),$);return h6(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=v6(J.trim(),$);return String(G??"")}catch{return""}}),Z}function v6(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function h6(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function BU(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function _U(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function jU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var HU=0;function LU(){return`h_${++HU}`}function u6(X){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(X)}function OU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={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"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function FU(){z7.clear()}function VU(){B7.clear()}function cV(){FU(),VU()}function pV(){return{templateCacheSize:z7.size,renderCacheSize:B7.size,totalEntries:z7.size+B7.size}}import{existsSync as HW,mkdirSync as e0,copyFileSync as r1,chmodSync as s1}from"fs";import{join as u,basename as BV}from"path";import{spawn as A$,execSync as _V}from"child_process";import{tmpdir as LW,homedir as L6,platform as jV}from"os";V1();a5();J8();C5();Z8();import{dirname as UV,resolve as BW}from"path";function KW(X){return X.endsWith(".md")||X.endsWith(".markdown")}function WV(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,U=W+q[0].length;if(w?.some((K)=>W>=K.start&&U<=K.end))continue;$.push({start:W,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function zW(X,$={}){let{data:Z,content:Y}=TX(X),G=await($.renderer??((Q)=>$5(Q)))(Y);return{html:WV(G),frontmatter:Z??{}}}function KV(X){let $=X,Z=l5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=Y.exec(X))!==null){let U=q[1],K=q[2],z=q[0],_=U.includes("server");if(w(K))Q.push(z);else if(_)G.push(K);else J.push(z)}let W=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(W))!==null){let _=K.index+K[0].length,B=W.indexOf("</script>",_);if(B===-1)continue;z.push({start:K.index,end:B+9}),U.lastIndex=B+9}for(let _=z.length-1;_>=0;_--)W=W.substring(0,z[_].start)+W.substring(z[_].end)}for(let U of J)W=W.replace(U,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function zV(X,$){return`<!DOCTYPE html>
18408
18410
  <html lang="en">
18409
18411
  <head>
18410
18412
  <meta charset="UTF-8">
@@ -18414,30 +18416,30 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function SW(X,$,
18414
18416
  <body>
18415
18417
  ${X}
18416
18418
  </body>
18417
- </html>`}function q6(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function WW(X,$={}){let Z=qW(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(QW(Z)){let Q=await wW(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=qW($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:q,injectCSS:W,...U}=$,K=await W6(J,Z,{...U,injectCSS:!1}),z=await w.text(),_={...$.context||{},content:K},B={...U,context:_,injectCSS:W};return W6(z,Q,B)}return W6(J,Z,$)}async function W6(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=QV(X),Q={...M1,...Z.options},w={__filename:$,__dirname:GV($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)q6(Z.context,"__stxResponseStatus",U)},notFound:(U=404)=>{let K=Number.isInteger(U)&&U>=400&&U<=599?U:404;q6(Z.context,"__stxResponseStatus",K)},setResponseHeader:(U,K)=>{if(!U)return;let z=Z.context?.__stxResponseHeaders||{};z[String(U)]=String(K),q6(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let U of J)await R1(U,w,$);let q=new Set,W=Y;if(W=await R0(W,w,$,Q,q),Z.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),G.length>0)W+=`
18419
+ </html>`}function j6(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function _W(X,$={}){let Z=BW(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(KW(Z)){let Q=await zW(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=BW($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:q,injectCSS:W,...U}=$,K=await H6(J,Z,{...U,injectCSS:!1}),z=await w.text(),_={...$.context||{},content:K},B={...U,context:_,injectCSS:W};return H6(z,Q,B)}return H6(J,Z,$)}async function H6(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=KV(X),Q={...k1,...Z.options},w={__filename:$,__dirname:UV($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)j6(Z.context,"__stxResponseStatus",U)},notFound:(U=404)=>{let K=Number.isInteger(U)&&U>=400&&U<=599?U:404;j6(Z.context,"__stxResponseStatus",K)},setResponseHeader:(U,K)=>{if(!U)return;let z=Z.context?.__stxResponseHeaders||{};z[String(U)]=String(K),j6(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let U of J)await N1(U,w,$);let q=new Set,W=Y;if(W=await N0(W,w,$,Q,q),Z.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),G.length>0)W+=`
18418
18420
  ${G.join(`
18419
- `)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=t1(w),_=(await Promise.all(G.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await e1(H[1],{eventBindings:U,templateContent:W,serverData:K,filePath:$})}))).join(`
18421
+ `)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=J5(w),_=(await Promise.all(G.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await G5(H[1],{eventBindings:U,templateContent:W,serverData:K,filePath:$})}))).join(`
18420
18422
  `);if(W.match(/(<\/body>)/i))W=W.replace(/(<\/body>)/i,`${_}
18421
18423
  $1`);else W+=`
18422
- ${_}`}W=await Z3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=wV(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (U9(),SZ));W=await U(W)}catch{}return W}async function Ib(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||_$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||_$(),Y=X.format||FV(Z),J=X.output||u(process.cwd(),"dist","native");if(!KW(J))a0(J,{recursive:!0});let G=await WW(X.input,{context:X.context,options:{isDev:!1}});if(G=B6(G,{debug:X.verbose}),G=M6(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${R6}
18423
- </head>`)}let Q=X.name||qV(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await OV();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await KV(G,Q,w,J,Y,X,q);break;case"windows":W=await _V(G,Q,w,J,Y,X,q);break;case"linux":W=await jV(G,Q,w,J,Y,X,q);break;case"ios":W=await HV(G,Q,w,J,X,q);break;case"android":W=await LV(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||_$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function KV(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=u(Y,`${$}.app`),W=u(q,"Contents"),U=u(W,"MacOS"),K=u(W,"Resources");a0(U,{recursive:!0}),a0(K,{recursive:!0});let z=u(K,"index.html");await Bun.write(z,X);let _="";if(G.sidebar?.enabled&&G.sidebar?.config)_=u(K,"sidebar-config.json"),await Bun.write(_,JSON.stringify(G.sidebar.config));let B=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await zV(Q)?"executable":"launcher"))==="executable"){let F=u(U,$);p1(Q,F),i1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(u(K,"craft.json"),`${JSON.stringify(V,null,2)}
18424
- `)}else{let F=u(U,"craft");p1(Q,F),i1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
18424
+ ${_}`}W=await W3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=zV(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (L9(),fZ));W=await U(W)}catch{}return W}async function fb(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||V$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||V$(),Y=X.format||TV(Z),J=X.output||u(process.cwd(),"dist","native");if(!HW(J))e0(J,{recursive:!0});let G=await _W(X.input,{context:X.context,options:{isDev:!1}});if(G=V6(G,{debug:X.verbose}),G=y6(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${D6}
18425
+ </head>`)}let Q=X.name||BV(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await MV();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await HV(G,Q,w,J,Y,X,q);break;case"windows":W=await FV(G,Q,w,J,Y,X,q);break;case"linux":W=await VV(G,Q,w,J,Y,X,q);break;case"ios":W=await AV(G,Q,w,J,X,q);break;case"android":W=await RV(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||V$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function HV(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=u(Y,`${$}.app`),W=u(q,"Contents"),U=u(W,"MacOS"),K=u(W,"Resources");e0(U,{recursive:!0}),e0(K,{recursive:!0});let z=u(K,"index.html");await Bun.write(z,X);let _="";if(G.sidebar?.enabled&&G.sidebar?.config)_=u(K,"sidebar-config.json"),await Bun.write(_,JSON.stringify(G.sidebar.config));let B=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await LV(Q)?"executable":"launcher"))==="executable"){let F=u(U,$);r1(Q,F),s1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(u(K,"craft.json"),`${JSON.stringify(V,null,2)}
18426
+ `)}else{let F=u(U,"craft");r1(Q,F),s1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
18425
18427
  set -euo pipefail
18426
18428
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
18427
18429
  RESOURCES="$DIR/../Resources"
18428
18430
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
18429
18431
  ${[`--title "${G.window?.title||$}"`,`--width ${G.window?.width||1200}`,`--height ${G.window?.height||800}`,j?"--menubar-only":G.systemTray?"--system-tray":"",G.devTools?"":"--no-devtools",G.window?.frameless?"--frameless":"",G.window?.transparent?"--transparent":"",G.window?.alwaysOnTop?"--always-on-top":"",G.window?.resizable===!1?"--no-resize":"",V].filter(Boolean).join(" \\\n ")}
18430
- `,M=u(U,$);await Bun.write(M,R),i1(M,493)}let O=Boolean(G.icon&&await Bun.file(G.icon).exists());if(O)p1(G.icon,u(K,"AppIcon.icns"));let L={CFBundleExecutable:$,CFBundleIdentifier:w,CFBundleName:$,CFBundleDisplayName:$,CFBundleShortVersionString:Z,CFBundleVersion:Z,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:G.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:G.menubarOnly??Boolean(G.systemTray),...O?{CFBundleIconFile:"AppIcon"}:{},...G.category?{LSApplicationCategoryType:G.category}:{},...G.copyright?{NSHumanReadableCopyright:G.copyright}:{},...G.infoPlist||{}};if(await Bun.write(u(W,"Info.plist"),BV(L)),J==="dmg"){let F=u(Y,`${$}-${Z}.dmg`),V=await VV(q,F,$);if(!V.success)return{success:!1,target:"macos",format:"dmg",error:V.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:q}}async function zV(X){try{let $=Bun.spawn([X,"--version"],{stdout:"pipe",stderr:"pipe"}),[Z,Y]=await Promise.all([new Response($.stdout).text(),new Response($.stderr).text()]);await $.exited;let G=`${Z}
18431
- ${Y}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!G)return!1;let[Q,w,q]=G.slice(1).map(Number);if(Q>0||w>0)return!0;return q>=57}catch{return!1}}function UW(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BV(X){return`<?xml version="1.0" encoding="UTF-8"?>
18432
+ `,M=u(U,$);await Bun.write(M,R),s1(M,493)}let O=Boolean(G.icon&&await Bun.file(G.icon).exists());if(O)r1(G.icon,u(K,"AppIcon.icns"));let L={CFBundleExecutable:$,CFBundleIdentifier:w,CFBundleName:$,CFBundleDisplayName:$,CFBundleShortVersionString:Z,CFBundleVersion:Z,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:G.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:G.menubarOnly??Boolean(G.systemTray),...O?{CFBundleIconFile:"AppIcon"}:{},...G.category?{LSApplicationCategoryType:G.category}:{},...G.copyright?{NSHumanReadableCopyright:G.copyright}:{},...G.infoPlist||{}};if(await Bun.write(u(W,"Info.plist"),OV(L)),J==="dmg"){let F=u(Y,`${$}-${Z}.dmg`),V=await NV(q,F,$);if(!V.success)return{success:!1,target:"macos",format:"dmg",error:V.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:q}}async function LV(X){try{let $=Bun.spawn([X,"--version"],{stdout:"pipe",stderr:"pipe"}),[Z,Y]=await Promise.all([new Response($.stdout).text(),new Response($.stderr).text()]);await $.exited;let G=`${Z}
18433
+ ${Y}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!G)return!1;let[Q,w,q]=G.slice(1).map(Number);if(Q>0||w>0)return!0;return q>=57}catch{return!1}}function jW(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OV(X){return`<?xml version="1.0" encoding="UTF-8"?>
18432
18434
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
18433
18435
  <plist version="1.0">
18434
18436
  <dict>
18435
- ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y==="number"?`<integer>${Y}</integer>`:`<string>${UW(String(Y))}</string>`;return` <key>${UW(Z)}</key>
18437
+ ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y==="number"?`<integer>${Y}</integer>`:`<string>${jW(String(Y))}</string>`;return` <key>${jW(Z)}</key>
18436
18438
  ${J}`}).join(`
18437
18439
  `)}
18438
18440
  </dict>
18439
18441
  </plist>
18440
- `}async function _V(X,$,Z,Y,J,G,Q){let w=u(Y,$);a0(w,{recursive:!0});let q=u(w,"index.html");await Bun.write(q,X),p1(Q,u(w,"craft.exe"));let W=`@echo off
18442
+ `}async function FV(X,$,Z,Y,J,G,Q){let w=u(Y,$);e0(w,{recursive:!0});let q=u(w,"index.html");await Bun.write(q,X),r1(Q,u(w,"craft.exe"));let W=`@echo off
18441
18443
  set DIR=%~dp0
18442
18444
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
18443
18445
  --title "${G.window?.title||$}" ^
@@ -18445,7 +18447,7 @@ set DIR=%~dp0
18445
18447
  --height ${G.window?.height||800} ^
18446
18448
  ${G.systemTray?"--system-tray":""} ^
18447
18449
  ${G.devTools?"":"--no-devtools"}
18448
- `;if(await Bun.write(u(w,`${$}.bat`),W),J==="zip"){let U=u(Y,`${$}-${Z}-windows.zip`),K=await AV(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function jV(X,$,Z,Y,J,G,Q){let w=u(Y,$);a0(w,{recursive:!0});let q=u(w,"index.html");await Bun.write(q,X);let W=u(w,"craft");p1(Q,W),i1(W,493);let U=`#!/bin/bash
18450
+ `;if(await Bun.write(u(w,`${$}.bat`),W),J==="zip"){let U=u(Y,`${$}-${Z}-windows.zip`),K=await kV(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function VV(X,$,Z,Y,J,G,Q){let w=u(Y,$);e0(w,{recursive:!0});let q=u(w,"index.html");await Bun.write(q,X);let W=u(w,"craft");r1(Q,W),s1(W,493);let U=`#!/bin/bash
18449
18451
  set -euo pipefail
18450
18452
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
18451
18453
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -18454,15 +18456,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
18454
18456
  --height ${G.window?.height||800} \\
18455
18457
  ${G.systemTray?"--system-tray":""} \\
18456
18458
  ${G.devTools?"":"--no-devtools"}
18457
- `,K=u(w,$.toLowerCase());await Bun.write(K,U),i1(K,493);let z=`[Desktop Entry]
18459
+ `,K=u(w,$.toLowerCase());await Bun.write(K,U),s1(K,493);let z=`[Desktop Entry]
18458
18460
  Type=Application
18459
18461
  Name=${$}
18460
18462
  Exec=${K}
18461
18463
  Terminal=false
18462
18464
  Categories=Utility;
18463
- `;if(await Bun.write(u(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let _=u(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),B=await RV(w,_,$,Z,G);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:_}}if(J==="appimage"){let _=u(Y,`${$}-${Z}-x86_64.AppImage`),B=await MV(w,_,$,G);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:_}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function HV(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function LV(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function OV(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[u(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),u(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),u(U6(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),u(U6(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",u(U6(),".local/bin/craft"),u(process.env.LOCALAPPDATA||"","craft","craft.exe"),u(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=WV("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
18464
- `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function _$(){switch(UV()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function FV(X){switch(X){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 VV(X,$,Z){return new Promise((Y)=>{let J=j$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function AV(X,$){return new Promise((Z)=>{let Y=j$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function RV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=u(zW(),`stx-deb-${Date.now()}`),w=u(Q,"DEBIAN"),q=u(Q,"usr","bin"),W=u(Q,"usr","share","applications"),U=u(Q,"usr","share",Z.toLowerCase());a0(w,{recursive:!0}),a0(q,{recursive:!0}),a0(W,{recursive:!0}),a0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let j of K)p1(u(X,j),u(U,j));let z=`#!/bin/bash
18465
- exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;X0("fs").writeFileSync(u(q,Z.toLowerCase()),z),i1(u(q,Z.toLowerCase()),493);let _=`Package: ${Z.toLowerCase()}
18465
+ `;if(await Bun.write(u(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let _=u(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),B=await IV(w,_,$,Z,G);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:_}}if(J==="appimage"){let _=u(Y,`${$}-${Z}-x86_64.AppImage`),B=await EV(w,_,$,G);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:_}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function AV(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function RV(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function MV(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[u(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),u(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),u(L6(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),u(L6(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",u(L6(),".local/bin/craft"),u(process.env.LOCALAPPDATA||"","craft","craft.exe"),u(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=_V("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
18466
+ `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function V$(){switch(jV()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function TV(X){switch(X){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 NV(X,$,Z){return new Promise((Y)=>{let J=A$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function kV(X,$){return new Promise((Z)=>{let Y=A$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function IV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=u(LW(),`stx-deb-${Date.now()}`),w=u(Q,"DEBIAN"),q=u(Q,"usr","bin"),W=u(Q,"usr","share","applications"),U=u(Q,"usr","share",Z.toLowerCase());e0(w,{recursive:!0}),e0(q,{recursive:!0}),e0(W,{recursive:!0}),e0(U,{recursive:!0});let K=Z0("fs").readdirSync(X);for(let j of K)r1(u(X,j),u(U,j));let z=`#!/bin/bash
18467
+ exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;Z0("fs").writeFileSync(u(q,Z.toLowerCase()),z),s1(u(q,Z.toLowerCase()),493);let _=`Package: ${Z.toLowerCase()}
18466
18468
  Version: ${Y}
18467
18469
  Section: utils
18468
18470
  Priority: optional
@@ -18470,16 +18472,16 @@ Architecture: amd64
18470
18472
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
18471
18473
  Maintainer: ${J.author||"Unknown"}
18472
18474
  Description: ${J.description||Z}
18473
- `;X0("fs").writeFileSync(u(w,"control"),_);let B=j$("dpkg-deb",["--build",Q,$]);B.on("close",(j)=>{if(X0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),B.on("error",(j)=>{X0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function MV(X,$,Z,Y){return new Promise((J)=>{try{let G=u(zW(),`stx-appimage-${Date.now()}`),Q=u(G,`${Z}.AppDir`),w=u(Q,"usr"),q=u(w,"bin"),W=u(w,"share");a0(q,{recursive:!0}),a0(W,{recursive:!0});let U=u(W,Z.toLowerCase());a0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let H of K)p1(u(X,H),u(U,H));let z=`#!/bin/bash
18475
+ `;Z0("fs").writeFileSync(u(w,"control"),_);let B=A$("dpkg-deb",["--build",Q,$]);B.on("close",(j)=>{if(Z0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),B.on("error",(j)=>{Z0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function EV(X,$,Z,Y){return new Promise((J)=>{try{let G=u(LW(),`stx-appimage-${Date.now()}`),Q=u(G,`${Z}.AppDir`),w=u(Q,"usr"),q=u(w,"bin"),W=u(w,"share");e0(q,{recursive:!0}),e0(W,{recursive:!0});let U=u(W,Z.toLowerCase());e0(U,{recursive:!0});let K=Z0("fs").readdirSync(X);for(let H of K)r1(u(X,H),u(U,H));let z=`#!/bin/bash
18474
18476
  SELF=$(readlink -f "$0")
18475
18477
  HERE=\${SELF%/*}
18476
18478
  export PATH="\${HERE}/usr/bin:\${PATH}"
18477
18479
  exec "\${HERE}/usr/share/${Z.toLowerCase()}/${Z.toLowerCase()}" "$@"
18478
- `;X0("fs").writeFileSync(u(Q,"AppRun"),z),i1(u(Q,"AppRun"),493);let _=`[Desktop Entry]
18480
+ `;Z0("fs").writeFileSync(u(Q,"AppRun"),z),s1(u(Q,"AppRun"),493);let _=`[Desktop Entry]
18479
18481
  Type=Application
18480
18482
  Name=${Z}
18481
18483
  Exec=${Z.toLowerCase()}
18482
18484
  Terminal=false
18483
18485
  Categories=Utility;
18484
18486
  Icon=${Z.toLowerCase()}
18485
- `;X0("fs").writeFileSync(u(Q,`${Z.toLowerCase()}.desktop`),_);let B=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(X0("fs").writeFileSync(u(Q,`${Z.toLowerCase()}.png`),B),Y.icon&&KW(Y.icon))p1(Y.icon,u(Q,`${Z.toLowerCase()}.png`));let j=j$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(X0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)i1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{X0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function Eb(){return[_$()]}function Db(X){switch(X){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{xV as renderSSR,CV as registerCraftComponent,IV as processCraftDirective,M6 as processCraftComponents,gV as prerenderForCraft,kV as isCraftEnvironment,B6 as injectCraftBridge,uV as getSSRCacheStats,PV as getCraftComponents,Eb as getAvailableTargets,Db as getAvailableFormats,fV as generateCraftOptimizations,z6 as generateCraftBridgeScript,yV as createHotReloadServer,DV as compileToNative,aW as compileTemplate,_U as clearTemplateCache,jU as clearRenderCache,hV as clearAllCaches,Ib as buildNative,LW as NATIVE_COMPONENTS,R6 as CRAFT_COMPONENT_STYLES,SV as CRAFT_COMPONENT_RUNTIME,V$ as CRAFT_COMPONENTS,NV as CRAFT_BRIDGE_SCRIPT};
18487
+ `;Z0("fs").writeFileSync(u(Q,`${Z.toLowerCase()}.desktop`),_);let B=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(Z0("fs").writeFileSync(u(Q,`${Z.toLowerCase()}.png`),B),Y.icon&&HW(Y.icon))r1(Y.icon,u(Q,`${Z.toLowerCase()}.png`));let j=A$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(Z0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)s1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{Z0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function gb(){return[V$()]}function hb(X){switch(X){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{dV as renderSSR,gV as registerCraftComponent,SV as processCraftDirective,y6 as processCraftComponents,lV as prerenderForCraft,bV as isCraftEnvironment,V6 as injectCraftBridge,pV as getSSRCacheStats,hV as getCraftComponents,gb as getAvailableTargets,hb as getAvailableFormats,mV as generateCraftOptimizations,F6 as generateCraftBridgeScript,vV as createHotReloadServer,PV as compileToNative,ZU as compileTemplate,FU as clearTemplateCache,VU as clearRenderCache,cV as clearAllCaches,fb as buildNative,RW as NATIVE_COMPONENTS,D6 as CRAFT_COMPONENT_STYLES,fV as CRAFT_COMPONENT_RUNTIME,k$ as CRAFT_COMPONENTS,yV as CRAFT_BRIDGE_SCRIPT};