@stacksjs/stx 0.2.171 → 0.2.172

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ssg.js CHANGED
@@ -1651,7 +1651,7 @@ else {
1651
1651
 
1652
1652
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1653
1653
  })();
1654
- `),V8}var V8;var F2={};a(F2,{setAppUrl:()=>I9,runMiddleware:()=>U7,route:()=>Y7,resolveLayoutChain:()=>j8,resetRoutes:()=>y9,registerMiddleware:()=>G7,patternToRegex:()=>J7,navigateTo:()=>S9,matchRoute:()=>U8,loadMiddlewareFromDirectory:()=>W7,isNonPageRoutePattern:()=>e5,isNonPageRoutePath:()=>F9,hasMiddleware:()=>v9,getRouterScript:()=>B7,getMiddlewareNames:()=>q7,getMiddleware:()=>F8,generateRouteTypes:()=>X7,generateRouteManifest:()=>Z7,formatRoutes:()=>k9,findErrorPage:()=>M9,filePathToPattern:()=>z8,extractLayoutMetadata:()=>L2,deriveLayoutGroup:()=>j7,defineRoutes:()=>D9,defineRoute:()=>E9,defineMiddleware:()=>P9,createStorageManager:()=>L8,createServerCookieManager:()=>H8,createRouter:()=>U2,createRouteLocation:()=>K7,createMiddlewareContext:()=>z7,createClientCookieManager:()=>O8,clearMiddleware:()=>w7,bracketPathToRegex:()=>K2,abortNavigation:()=>C9,Router:()=>F5,NON_PAGE_DIRS:()=>t5});var M1=D(()=>{j2();A9();B2();O2();N9();V9();K8()});function _7($,X={}){return new F5($,X).routes}var x9=D(()=>{M1();M1()});function V2($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function f9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=V2(Y)&&V2(Z[J])?f9(Z[J],Y):Y;return Z}function A2($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,q=f9(w,G),W=f9(Q||{},Y||{});if(Object.keys(W).length>0)q.extend=W;let K=[...$.safelist||[],...X.safelist||[]],z={...$.shortcuts||{},...X.shortcuts||{}},U=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:K,shortcuts:z,...U.length>0?{preflights:U}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:X.preflight!==!1,minify:X.minify===!0}}import H7 from"path";function N2($){R2=$?.trim()||null}function O7(){return process.env[uq]?.trim()||R2||A5}function B1($=process.cwd(),...X){let Z=O7();return H7.isAbsolute(Z)?H7.join(Z,...X):H7.join($,Z,...X)}function L7($){if(!$||H7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==A5&&!X.startsWith(`${A5}/`))return $;let Z=X.slice(A5.length+1);return Z?H7.join(O7(),Z):O7()}var A5=".stx",uq="STX_DIR",R2=null;var F7=()=>{};var H0;var T2=D(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function M2($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return Y=Y.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),Y=Y.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),Y}var k2,I2;var g9=D(()=>{k2={name:"a11y",handler:($,X,Z,J)=>{if(!X.length)return $;let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[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"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${$}`},hasEndTag:!1},I2={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function dq($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={..._1,...X};if($==="custom"&&Q)return Q;switch($){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);"}
1654
+ `),V8}var V8;var F2={};a(F2,{setAppUrl:()=>I9,runMiddleware:()=>U7,route:()=>Y7,resolveLayoutChain:()=>j8,resetRoutes:()=>y9,registerMiddleware:()=>G7,patternToRegex:()=>J7,navigateTo:()=>S9,matchRoute:()=>U8,loadMiddlewareFromDirectory:()=>W7,isNonPageRoutePattern:()=>e5,isNonPageRoutePath:()=>F9,hasMiddleware:()=>v9,getRouterScript:()=>B7,getMiddlewareNames:()=>q7,getMiddleware:()=>F8,generateRouteTypes:()=>X7,generateRouteManifest:()=>Z7,formatRoutes:()=>k9,findErrorPage:()=>M9,filePathToPattern:()=>z8,extractLayoutMetadata:()=>L2,deriveLayoutGroup:()=>j7,defineRoutes:()=>D9,defineRoute:()=>E9,defineMiddleware:()=>P9,createStorageManager:()=>L8,createServerCookieManager:()=>H8,createRouter:()=>U2,createRouteLocation:()=>K7,createMiddlewareContext:()=>z7,createClientCookieManager:()=>O8,clearMiddleware:()=>w7,bracketPathToRegex:()=>K2,abortNavigation:()=>C9,Router:()=>F5,NON_PAGE_DIRS:()=>t5});var k1=D(()=>{j2();A9();B2();O2();N9();V9();K8()});function _7($,X={}){return new F5($,X).routes}var x9=D(()=>{k1();k1()});function V2($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function f9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=V2(Y)&&V2(Z[J])?f9(Z[J],Y):Y;return Z}function A2($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,q=f9(w,G),W=f9(Q||{},Y||{});if(Object.keys(W).length>0)q.extend=W;let K=[...$.safelist||[],...X.safelist||[]],z={...$.shortcuts||{},...X.shortcuts||{}},U=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:K,shortcuts:z,...U.length>0?{preflights:U}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:X.preflight!==!1,minify:X.minify===!0}}import H7 from"path";function N2($){R2=$?.trim()||null}function O7(){return process.env[uq]?.trim()||R2||A5}function _1($=process.cwd(),...X){let Z=O7();return H7.isAbsolute(Z)?H7.join(Z,...X):H7.join($,Z,...X)}function L7($){if(!$||H7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==A5&&!X.startsWith(`${A5}/`))return $;let Z=X.slice(A5.length+1);return Z?H7.join(O7(),Z):O7()}var A5=".stx",uq="STX_DIR",R2=null;var F7=()=>{};var H0;var T2=D(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function M2($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return Y=Y.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),Y=Y.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),Y}var k2,I2;var g9=D(()=>{k2={name:"a11y",handler:($,X,Z,J)=>{if(!X.length)return $;let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[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"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${$}`},hasEndTag:!1},I2={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function dq($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...H1,...X};if($==="custom"&&Q)return Q;switch($){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);"}
1655
1655
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1656
1656
  @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);"}
1657
1657
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1886,9 +1886,9 @@ else {
1886
1886
  </script>
1887
1887
  `}function S2($,X,Z,J){let Y=$;if(J.animation?.enabled===!1)return Y;let G=Z.includes("test")&&Z.includes("animation");if(!lq(Y)&&!G)return Y;if(!Y.includes('<style id="stx-animation-base">')){let w=pq();Y=Y.replace("</head>",`${w}
1888
1888
  </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=cq(),W=Y.lastIndexOf("</body>");if(W!==-1)Y=Y.slice(0,W)+q+`
1889
- `+Y.slice(W)}}return Y}var _1,E2,D2,y2,b2;var h9=D(()=>{_1={duration:300,delay:0,ease:"ease",direction:"both"};E2={name:"transition",handler:($,X,Z,J)=>{if(X.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=X[0],G=X.length>1?Number.parseInt(X[1],10)||_1.duration:_1.duration,Q=X.length>2?X[2]||_1.ease:_1.ease,w=X.length>3?Number.parseInt(X[3],10)||_1.delay:_1.delay,q=X.length>4?X[4]||_1.direction:_1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=dq(Y,{duration:G,delay:w,ease:Q,direction:q}),z="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${W}" class="${z} ${U} ${q==="out"?"stx-out":""}"
1889
+ `+Y.slice(W)}}return Y}var H1,E2,D2,y2,b2;var h9=D(()=>{H1={duration:300,delay:0,ease:"ease",direction:"both"};E2={name:"transition",handler:($,X,Z,J)=>{if(X.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=X[0],G=X.length>1?Number.parseInt(X[1],10)||H1.duration:H1.duration,Q=X.length>2?X[2]||H1.ease:H1.ease,w=X.length>3?Number.parseInt(X[3],10)||H1.delay:H1.delay,q=X.length>4?X[4]||H1.direction:H1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=dq(Y,{duration:G,delay:w,ease:Q,direction:q}),z="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${W}" class="${z} ${U} ${q==="out"?"stx-out":""}"
1890
1890
  style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},D2={name:"scrollAnimate",handler:($,X,Z,J)=>{if(X.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=X[0],G=X.length>1?Number.parseInt(X[1],10)||300:300,Q=X.length>2?X[2]||"ease":"ease",w=X.length>3?Number.parseFloat(X[3])||0.2:0.2,q=X.length>4?Number.parseInt(X[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Y==="fade")z+=" stx-fade";else if(Y==="slide-up"||Y==="slide")z+=" stx-from-bottom";else if(Y==="slide-down")z+=" stx-from-top";else if(Y==="slide-left")z+=" stx-from-right";else if(Y==="slide-right")z+=" stx-from-left";else if(Y==="scale")z+=" stx-scale";else if(Y.includes("-"))z+=` stx-${Y}`;else z+=` stx-${Y}`;return`<div id="${W}" class="${z}" style="${K}" data-threshold="${w}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},y2={name:"animationGroup",handler:($,X,Z,J)=>{if(X.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=X[0],G=X.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=iq(Y,G,{staggerDelay:Q,sequence:w});return`${$}
1891
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},b2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=mq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var C2=D(()=>{M1();u9()});async function nq($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=B7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var P2;var u9=D(()=>{C2();P2={name:"stxRouter",handler:nq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function v2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...rq,...X};return`
1891
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},b2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=mq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var C2=D(()=>{k1();u9()});async function nq($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=B7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var P2;var u9=D(()=>{C2();P2={name:"stxRouter",handler:nq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function v2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...rq,...X};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 x2($,X){let Z=v2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function oq($){let X={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Z){let[Y,G]=J.split("="),Q=G?.replace(/["']/g,"");switch(Y){case"endpoint":X.endpoint=Q;break;case"samplingRate":X.samplingRate=Number.parseInt(Q,10);break;case"batchSize":X.batchSize=Number.parseInt(Q,10);break;case"trackMouse":X.trackMouse=Q==="true";break;case"trackClicks":X.trackClicks=Q==="true";break;case"trackScroll":X.trackScroll=Q==="true";break;case"honorDnt":X.honorDnt=Q==="true";break;case"debugOverlay":X.debugOverlay=Q==="true";break}}return X}var rq,f2;var d9=D(()=>{rq={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};f2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,X,Z,J)=>{let Y=Z.__stx_config||{};if(X.length>0){let G=oq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return v2(Y)}}});function k1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function g2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function h2($){let X=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(X);if(!Z)return{data:{},content:$.trim()};let J=Z[1],Y=$.slice(Z[0].length),G={};for(let Q of J.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(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:Y.trim()}}function V7($,X={}){let{gfm:Z=!0,breaks:J=!1}=X,Y=$,G=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let B=G.length,j=z?` class="language-${k1(z)}"`:"";return G.push(`<pre><code${j}>${k1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${k1(z)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${g2(U)?k1(U):""}" alt="${k1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${g2(U)?k1(U):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
2276
- `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),Z)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,U)=>{let j=`<tr>${z.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${k1(H)}</th>`).join("")}</tr>`,_=U.trim().split(`
2277
- `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${k1(O)}</td>`).join("")}</tr>`}).join(`
2274
+ `}function x2($,X){let Z=v2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function oq($){let X={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Z){let[Y,G]=J.split("="),Q=G?.replace(/["']/g,"");switch(Y){case"endpoint":X.endpoint=Q;break;case"samplingRate":X.samplingRate=Number.parseInt(Q,10);break;case"batchSize":X.batchSize=Number.parseInt(Q,10);break;case"trackMouse":X.trackMouse=Q==="true";break;case"trackClicks":X.trackClicks=Q==="true";break;case"trackScroll":X.trackScroll=Q==="true";break;case"honorDnt":X.honorDnt=Q==="true";break;case"debugOverlay":X.debugOverlay=Q==="true";break}}return X}var rq,f2;var d9=D(()=>{rq={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};f2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,X,Z,J)=>{let Y=Z.__stx_config||{};if(X.length>0){let G=oq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return v2(Y)}}});function I1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function g2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function h2($){let X=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(X);if(!Z)return{data:{},content:$.trim()};let J=Z[1],Y=$.slice(Z[0].length),G={};for(let Q of J.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(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:Y.trim()}}function V7($,X={}){let{gfm:Z=!0,breaks:J=!1}=X,Y=$,G=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let B=G.length,j=z?` class="language-${I1(z)}"`:"";return G.push(`<pre><code${j}>${I1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${I1(z)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${g2(U)?I1(U):""}" alt="${I1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${g2(U)?I1(U):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
2276
+ `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),Z)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,U)=>{let j=`<tr>${z.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${I1(H)}</th>`).join("")}</tr>`,_=U.trim().split(`
2277
+ `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${I1(O)}</td>`).join("")}</tr>`}).join(`
2278
2278
  `);return`<table>
2279
2279
  <thead>
2280
2280
  ${j}
@@ -2289,7 +2289,7 @@ ${_}
2289
2289
  `:`
2290
2290
  `)}</p>`);if(Y=w.join(`
2291
2291
  `),J)Y=Y.replace(/\n/g,`<br />
2292
- `);for(let K=0;K<G.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}function R5($="const",X=[],Z){let J=X.length?H1.filter((Y)=>!X.includes(Y)):H1;if(Z!==void 0)J=J.filter((Y)=>{let G=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${J.join(", ")} } = window.stx;`}function m9($){if(!$)return!1;return aq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function l9($){if(!$)return!1;let X=p2($);if(tq.some((Z)=>Z.test(X)))return!0;return m9(X)}function d2($){if(!$)return!1;return eq.test(p2($))||l9($)}function c2(){return`{${m2.map(($)=>`'${$}':1`).join(",")}}`}function p2($){if(!$)return $;let X=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(J,Y,G)=>Y??" ".repeat(G.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var H1,u2,sq,aq,tq,eq,m2,$W,l2;var Q1=D(()=>{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"],u2=["onMount","onDestroy"];sq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],aq=H1.filter(($)=>!sq.includes($));tq=[/@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/],eq=/\s@[a-z][\w.:-]*\s*=/i;m2=["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"],$W=["x-init","x-transition","x-effect","x-on"],l2=[...m2,...$W]});function r2($){let X={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let J=Z.toLowerCase();if(J==="prevent")X.prevent=!0;else if(J==="stop")X.stop=!0;else if(J==="once")X.once=!0;else if(J==="capture")X.capture=!0;else if(J==="self")X.self=!0;else if(J==="passive")X.passive=!0;else if(XW.has(J))X.systemKeys.push(J);else if(J in o2)X.mouse=J;else if(J in n2||/^[a-z]$/.test(J))X.keys.push(n2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);X.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);X.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return X}function s2($){let X=[],Z=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[G,Q,w]=Y,q=Y.index,W=q+G.length,K=`__stx_evt_${Z++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=U.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!i2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:r2(L.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!i2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:r2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:q,endIndex:W})}return X}function ZW($){let X=[],{modifiers:Z}=$;if(Z.self)X.push("if ($event.target !== $el) return");for(let J of Z.systemKeys)X.push(`if (!$event.${J}Key) return`);if(Z.keys.length>0){let J=Z.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");X.push(`if (!(${J})) return`)}if(Z.mouse!==null){let J=o2[Z.mouse];X.push(`if ($event.button !== ${J}) return`)}if(Z.prevent)X.push("$event.preventDefault()");if(Z.stop)X.push("$event.stopPropagation()");return X.join("; ")}function JW($,X){let Z=$;if(X.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${X.debounce})`;else if(X.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${X.throttle})`;return Z}function c9($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function YW($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=ZW($),Y=JW(c9($.handler),X),G=[];if(X.once)G.push("once: true");if(X.capture)G.push("capture: true");if(X.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2292
+ `);for(let K=0;K<G.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}function R5($="const",X=[],Z){let J=X.length?O1.filter((Y)=>!X.includes(Y)):O1;if(Z!==void 0)J=J.filter((Y)=>{let G=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${J.join(", ")} } = window.stx;`}function m9($){if(!$)return!1;return aq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function l9($){if(!$)return!1;let X=p2($);if(tq.some((Z)=>Z.test(X)))return!0;return m9(X)}function d2($){if(!$)return!1;return eq.test(p2($))||l9($)}function c2(){return`{${m2.map(($)=>`'${$}':1`).join(",")}}`}function p2($){if(!$)return $;let X=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(J,Y,G)=>Y??" ".repeat(G.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var O1,u2,sq,aq,tq,eq,m2,$W,l2;var Q1=D(()=>{O1=["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"],u2=["onMount","onDestroy"];sq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],aq=O1.filter(($)=>!sq.includes($));tq=[/@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/],eq=/\s@[a-z][\w.:-]*\s*=/i;m2=["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"],$W=["x-init","x-transition","x-effect","x-on"],l2=[...m2,...$W]});function r2($){let X={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let J=Z.toLowerCase();if(J==="prevent")X.prevent=!0;else if(J==="stop")X.stop=!0;else if(J==="once")X.once=!0;else if(J==="capture")X.capture=!0;else if(J==="self")X.self=!0;else if(J==="passive")X.passive=!0;else if(XW.has(J))X.systemKeys.push(J);else if(J in o2)X.mouse=J;else if(J in n2||/^[a-z]$/.test(J))X.keys.push(n2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);X.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);X.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return X}function s2($){let X=[],Z=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[G,Q,w]=Y,q=Y.index,W=q+G.length,K=`__stx_evt_${Z++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=U.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!i2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:r2(L.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!i2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:r2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:q,endIndex:W})}return X}function ZW($){let X=[],{modifiers:Z}=$;if(Z.self)X.push("if ($event.target !== $el) return");for(let J of Z.systemKeys)X.push(`if (!$event.${J}Key) return`);if(Z.keys.length>0){let J=Z.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");X.push(`if (!(${J})) return`)}if(Z.mouse!==null){let J=o2[Z.mouse];X.push(`if ($event.button !== ${J}) return`)}if(Z.prevent)X.push("$event.preventDefault()");if(Z.stop)X.push("$event.stopPropagation()");return X.join("; ")}function JW($,X){let Z=$;if(X.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${X.debounce})`;else if(X.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${X.throttle})`;return Z}function c9($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function YW($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=ZW($),Y=JW(c9($.handler),X),G=[];if(X.once)G.push("once: true");if(X.capture)G.push("capture: true");if(X.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2293
2293
  (function() {
2294
2294
  var $el = document.getElementById('${Z}');
2295
2295
  if (!$el) return;
@@ -2405,17 +2405,17 @@ else {
2405
2405
  `+Y.slice(Q);else Y+=G;return Y}var i2,n2,XW,o2;var i9=D(()=>{Q1();i2=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"]),n2={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"},XW=new Set(["ctrl","alt","shift","meta"]),o2={left:0,middle:1,right:2}});function l0($){let X=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(X,(J,Y)=>{return`const { ${Y.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 $=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
2407
  `}),$}function A8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function QW($,X){let Z=$[X],J=X+1;while(J<$.length){if($[J]==="\\"){J+=2;continue}if($[J]===Z)return J+1;J++}return $.length}function wW($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=R8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function R8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=QW($,J);continue}if(Y==="`"){J=wW($,J);continue}if(Y==="/"&&$[J+1]==="/"){while(J<$.length&&$[J]!==`
2408
- `)J++;continue}if(Y==="/"&&$[J+1]==="*"){J+=2;while(J<$.length&&$.slice(J,J+2)!=="*/")J++;J+=2;continue}if(Y==="{"){Z++,J++;continue}if(Y==="}"){if(Z--,Z===0)return J;J++;continue}J++}return $.length}function I1($){let X="",Z=0;while(Z<$.length){let J=$.slice(Z,Z+2);if(J==="//"){while(Z<$.length&&$[Z]!==`
2408
+ `)J++;continue}if(Y==="/"&&$[J+1]==="*"){J+=2;while(J<$.length&&$.slice(J,J+2)!=="*/")J++;J+=2;continue}if(Y==="{"){Z++,J++;continue}if(Y==="}"){if(Z--,Z===0)return J;J++;continue}J++}return $.length}function w1($){let X="",Z=0;while(Z<$.length){let J=$.slice(Z,Z+2);if(J==="//"){while(Z<$.length&&$[Z]!==`
2409
2409
  `)X+=" ",Z++;continue}if(J==="/*"){while(Z<$.length&&$.slice(Z,Z+2)!=="*/")X+=$[Z]===`
2410
2410
  `?`
2411
2411
  `:" ",Z++;X+=" ",Z+=2;continue}let Y=$[Z];if(Y==='"'||Y==="'"){let G=Y;X+=" ",Z++;while(Z<$.length&&$[Z]!==G){if($[Z]==="\\"){X+=" ",Z+=2;continue}X+=$[Z]===`
2412
2412
  `?`
2413
- `:" ",Z++}X+=" ",Z++;continue}if(Y==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=R8($,G);if(X+=" ",X+=I1($.slice(G,Q)),Q<$.length)X+=" ";Z=Q+1;continue}X+=$[Z]===`
2413
+ `:" ",Z++}X+=" ",Z++;continue}if(Y==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=R8($,G);if(X+=" ",X+=w1($.slice(G,Q)),Q<$.length)X+=" ";Z=Q+1;continue}X+=$[Z]===`
2414
2414
  `?`
2415
2415
  `:" ",Z++}X+=" ",Z++;continue}X+=Y,Z++}return X}function qW(){let $=globalThis;return $[t2]??=new Map,$[t2]}function e($,X){let Z=qW(),J=`${import.meta.url}\x00${$}`,Y=Z.get(J);if(Y)return Y;let G=X();return Z.set(J,G),G.catch(()=>{if(Z.get(J)===G)Z.delete(J)}),G}var t2;var A7=D(()=>{t2=Symbol.for("stx.lazy-module-promises")});function N5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(WW,"<\\/$1")}var WW;var n9=D(()=>{WW=/<\/(script)/gi});import KW from"process";function g0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(KW.env)){if(!J.startsWith($)||Y===void 0)continue;X[`import.meta.env.${J}`]=JSON.stringify(Y),Z[J]=Y}return X["import.meta.env"]=JSON.stringify(Z),X}var E1=()=>{};function zW($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function UW($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function r9($,X){let Z=[];for(let J of UW($)){if(zW(J)){let Y=J.position||void 0;Z.push({file:X||Y?.file,line:Y?.line,column:Y?.column,message:J.message??"",lineText:Y?.lineText});continue}Z.push({file:X,message:J instanceof Error?J.message:String(J)})}return Z}function e2($,X){return r9($,X).map((Z)=>{let J=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",Y=Z.lineText?`
2416
2416
  ${Z.lineText.trim()}`:"";return J?`${J}: ${Z.message}${Y}`:`${Z.message}${Y}`}).join(`
2417
- `)}var R7={};a(R7,{shouldLogBundlerDiagnostics:()=>J6,setBundlerFallbackMode:()=>HW,resolveBundlerFallback:()=>G6,recordBundleFailure:()=>Y6,queueClientBundleBuild:()=>Q6,hasUserImports:()=>OW,getBundleFailures:()=>BW,clearBundleFailures:()=>_W,bundleClientScript:()=>FW});import F0 from"path";import h0 from"fs";function J6($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function c1(...$){if(J6())console.log("[stx:bundler]",...$)}function Y6($,X,Z){a9.push({filePath:$||"<inline>",message:X,details:Z})}function BW(){return a9.slice()}function _W(){a9.length=0}function HW($){s9=$}function G6(){if(s9)return s9;try{let $=T7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function OW($){let X=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=X.exec($))!==null){let Y=Z[1];if(!$6.some((Q)=>Q.test(Y)))return c1("detected user import:",Y),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=J.exec($))!==null){let Y=Z[1];if(/\.css(?:\?.*)?$/.test(Y))continue;if(!$6.some((Q)=>Q.test(Y)))return c1("detected side-effect import:",Y),!0}return!1}function LW($,X,Z,J){let Y=(G,Q)=>{let w=G===Z?X:F0.dirname(G),q=F0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,F0.join(q,"index.ts"),F0.join(q,"index.tsx"),F0.join(q,"index.js"),F0.join(q,"index.mjs")];for(let K of W)try{if(h0.existsSync(K)&&h0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}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(h0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=Y(Q.importer,Q.path);return J.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=F0.resolve($,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,F0.join(w,"index.ts"),F0.join(w,"index.tsx"),F0.join(w,"index.js"),F0.join(w,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return c1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),J.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=F0.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)J.add(Q.path);return{contents:h0.readFileSync(Q.path,"utf8"),loader:q}})}}}function Q6($){let X=globalThis,J=(X[X6]??Promise.resolve()).then($,$);return X[X6]=J.then(()=>{return},()=>{return}),J}async function FW($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||B1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${jW}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),q=F0.join(G,`${w}.js`),W=F0.join(G,`${w}.deps.json`),K=Bun.file(q);if(await K.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==Z6||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(h0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return c1("cache hit:",w),await K.text();c1("cache invalidated by dep change:",w)}let z=o9.get(w);if(z)return await z;let U=Q6(()=>VW($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:q,depsPath:W}));o9.set(w,U);try{return await U}finally{o9.delete(w)}}async function VW($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=B1(J,"bundle-tmp"),K=F0.join(W,`${Q}.ts`),z=F0.join(W,"out",Q);h0.mkdirSync(W,{recursive:!0}),h0.mkdirSync(z,{recursive:!0});let U=F0.dirname(X),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec($))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec($))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
2418
- export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),c1("bundling:",Q,"from:",F0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[LW(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...g0()},root:J});if(!F.success){let I=F.logs.filter((S)=>S.level==="error").map((S)=>S.message).join(", ");return console.warn("[stx:bundler] build failed:",I),$}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 C=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))A.push([C,C])}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 N=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
2417
+ `)}var R7={};a(R7,{shouldLogBundlerDiagnostics:()=>J6,setBundlerFallbackMode:()=>HW,resolveBundlerFallback:()=>G6,recordBundleFailure:()=>Y6,queueClientBundleBuild:()=>Q6,hasUserImports:()=>OW,getBundleFailures:()=>BW,clearBundleFailures:()=>_W,bundleClientScript:()=>FW});import V0 from"path";import h0 from"fs";function J6($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function c1(...$){if(J6())console.log("[stx:bundler]",...$)}function Y6($,X,Z){a9.push({filePath:$||"<inline>",message:X,details:Z})}function BW(){return a9.slice()}function _W(){a9.length=0}function HW($){s9=$}function G6(){if(s9)return s9;try{let $=T7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function OW($){let X=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=X.exec($))!==null){let Y=Z[1];if(!$6.some((Q)=>Q.test(Y)))return c1("detected user import:",Y),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=J.exec($))!==null){let Y=Z[1];if(/\.css(?:\?.*)?$/.test(Y))continue;if(!$6.some((Q)=>Q.test(Y)))return c1("detected side-effect import:",Y),!0}return!1}function LW($,X,Z,J){let Y=(G,Q)=>{let w=G===Z?X:V0.dirname(G),q=V0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,V0.join(q,"index.ts"),V0.join(q,"index.tsx"),V0.join(q,"index.js"),V0.join(q,"index.mjs")];for(let K of W)try{if(h0.existsSync(K)&&h0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}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(h0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=Y(Q.importer,Q.path);return J.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=V0.resolve($,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,V0.join(w,"index.ts"),V0.join(w,"index.tsx"),V0.join(w,"index.js"),V0.join(w,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return c1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),J.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=V0.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)J.add(Q.path);return{contents:h0.readFileSync(Q.path,"utf8"),loader:q}})}}}function Q6($){let X=globalThis,J=(X[X6]??Promise.resolve()).then($,$);return X[X6]=J.then(()=>{return},()=>{return}),J}async function FW($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||_1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${jW}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),q=V0.join(G,`${w}.js`),W=V0.join(G,`${w}.deps.json`),K=Bun.file(q);if(await K.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==Z6||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(h0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return c1("cache hit:",w),await K.text();c1("cache invalidated by dep change:",w)}let z=o9.get(w);if(z)return await z;let U=Q6(()=>VW($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:q,depsPath:W}));o9.set(w,U);try{return await U}finally{o9.delete(w)}}async function VW($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=_1(J,"bundle-tmp"),K=V0.join(W,`${Q}.ts`),z=V0.join(W,"out",Q);h0.mkdirSync(W,{recursive:!0}),h0.mkdirSync(z,{recursive:!0});let U=V0.dirname(X),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec($))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec($))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
2418
+ export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),c1("bundling:",Q,"from:",V0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[LW(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...g0()},root:J});if(!F.success){let I=F.logs.filter((S)=>S.level==="error").map((S)=>S.message).join(", ");return console.warn("[stx:bundler] build failed:",I),$}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 C=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))A.push([C,C])}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 N=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
2419
2419
  `),k=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
2420
2420
  `);if(V=`${R.join(`
2421
2421
  `)}
@@ -2424,13 +2424,13 @@ var ${N} = (function() {
2424
2424
  ${V}
2425
2425
  return { ${T} };
2426
2426
  })();
2427
- ${k}`.trim(),c1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:h0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:Z6,files:y})),V}catch(F){let V=r9(F,X||void 0),A=e2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),Y6(X||"",A,V),G6()==="error")throw F;return $}finally{try{h0.rmSync(K,{force:!0}),h0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var jW=5,Z6=1,a9,s9,$6,o9,X6;var N7=D(()=>{E1();F7();O1();a9=[];$6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];o9=new Map,X6=Symbol.for("stx.client-bundle-build-queue")});var B6={};a(B6,{stripCommentsAndLiterals:()=>I1,renderVendorStyleTags:()=>T8,processClientScript:()=>I7,injectBrowserCoreAutoImports:()=>T5,generateServerDataBridge:()=>M8,generateBrowserAutoImportDestructuring:()=>DW,generateAutoImportDestructuring:()=>t9,findInterpolationEnd:()=>R8,extractBridgeData:()=>k7,extractAndStripCssImports:()=>N8,STX_AUTO_IMPORTS:()=>K6});import p1 from"path";import M7 from"fs";function RW($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Z=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let X=$.match(/^([^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}function NW($,X){let Z=X;while(!0){let J=p1.join(Z,"node_modules",$,"package.json");if(M7.existsSync(J))return p1.dirname(J);let Y=p1.dirname(Z);if(Y===Z)return null;Z=Y}}function TW($,X){if(!$||typeof $!=="object")return null;let Z=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return Z(Y.import);if(typeof Y.default==="object")return Z(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,X))return Z($[X]);let J=null;for(let Y of Object.keys($)){let G=Y.indexOf("*");if(G===-1)continue;let Q=Y.slice(0,G),w=Y.slice(G+1);if(!X.startsWith(Q)||!X.endsWith(w))continue;if(X.length<Q.length+w.length)continue;if(!J||Q.length>J.prefix.length)J={pattern:Y,prefix:Q,suffix:w}}if(J){let Y=X.slice(J.prefix.length,X.length-J.suffix.length),G=Z($[J.pattern]);if(G)return G.replace("*",Y)}return null}function MW($,X){let Z=RW($);if(!Z||!Z.subpath)return null;let J=NW(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(M7.readFileSync(p1.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=TW(Y.exports,G);if(!Q)return null;let w=p1.resolve(J,Q);return M7.existsSync(w)?w:null}function N8($,X){let Z=X.filePath?p1.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(AW,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:p1.resolve(Z,q),!M7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,J)}catch{K=MW(q,J)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=M7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:G}}function kW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${kW(X.source)}" data-stx-layer="vendor">
2427
+ ${k}`.trim(),c1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${V0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:h0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:Z6,files:y})),V}catch(F){let V=r9(F,X||void 0),A=e2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),Y6(X||"",A,V),G6()==="error")throw F;return $}finally{try{h0.rmSync(K,{force:!0}),h0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var jW=5,Z6=1,a9,s9,$6,o9,X6;var N7=D(()=>{E1();F7();L1();a9=[];$6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];o9=new Map,X6=Symbol.for("stx.client-bundle-build-queue")});var B6={};a(B6,{stripCommentsAndLiterals:()=>w1,renderVendorStyleTags:()=>T8,processClientScript:()=>I7,injectBrowserCoreAutoImports:()=>T5,generateServerDataBridge:()=>M8,generateBrowserAutoImportDestructuring:()=>DW,generateAutoImportDestructuring:()=>t9,findInterpolationEnd:()=>R8,extractBridgeData:()=>k7,extractAndStripCssImports:()=>N8,STX_AUTO_IMPORTS:()=>K6});import p1 from"path";import M7 from"fs";function RW($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Z=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let X=$.match(/^([^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}function NW($,X){let Z=X;while(!0){let J=p1.join(Z,"node_modules",$,"package.json");if(M7.existsSync(J))return p1.dirname(J);let Y=p1.dirname(Z);if(Y===Z)return null;Z=Y}}function TW($,X){if(!$||typeof $!=="object")return null;let Z=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return Z(Y.import);if(typeof Y.default==="object")return Z(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,X))return Z($[X]);let J=null;for(let Y of Object.keys($)){let G=Y.indexOf("*");if(G===-1)continue;let Q=Y.slice(0,G),w=Y.slice(G+1);if(!X.startsWith(Q)||!X.endsWith(w))continue;if(X.length<Q.length+w.length)continue;if(!J||Q.length>J.prefix.length)J={pattern:Y,prefix:Q,suffix:w}}if(J){let Y=X.slice(J.prefix.length,X.length-J.suffix.length),G=Z($[J.pattern]);if(G)return G.replace("*",Y)}return null}function MW($,X){let Z=RW($);if(!Z||!Z.subpath)return null;let J=NW(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(M7.readFileSync(p1.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=TW(Y.exports,G);if(!Q)return null;let w=p1.resolve(J,Q);return M7.existsSync(w)?w:null}function N8($,X){let Z=X.filePath?p1.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(AW,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:p1.resolve(Z,q),!M7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,J)}catch{K=MW(q,J)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=M7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:G}}function kW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${kW(X.source)}" data-stx-layer="vendor">
2428
2428
  @layer vendor {
2429
2429
  ${X.contents}
2430
2430
  }
2431
2431
  </style>`}).join(`
2432
2432
  `)}
2433
- `}function T5($){let X=I1($),Z=new Set;for(let w of $.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 J=new Set;for(let w of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(w[1]);for(let w of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=z6.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=U6(X).filter((w)=>!Z.has(w)&&!J.has(w));if(Y.length===0&&G.length===0)return{code:$,imports:Y,models:G};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2433
+ `}function T5($){let X=w1($),Z=new Set;for(let w of $.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 J=new Set;for(let w of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(w[1]);for(let w of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=z6.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=U6(X).filter((w)=>!Z.has(w)&&!J.has(w));if(Y.length===0&&G.length===0)return{code:$,imports:Y,models:G};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2434
2434
  `)}
2435
2435
  ${$}`,imports:Y,models:G}}function U6($){let X=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,J;while((J=Z.exec($))!==null)if(!IW.has(J[1]))X.add(J[1]);return Array.from(X)}function EW($){let X=new Set;for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Z[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function j6($){let X=new Set,Z=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=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($))!==null){let W=Q[1],K=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(Y.add(H),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(H);else Z.add(H);if(L!==H)z.push(`${L} = ${H}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let w=EW(J);for(let W of K6){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))X.add(W)}for(let W of z6){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))Z.add(W)}let q=U6(J);for(let W of q)if(!Y.has(W)&&!w.has(W))Z.add(W);return{code:J,stxImports:Array.from(X),browserImports:Array.from(Z)}}function t9($,X){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2436
2436
  ${Z.join(`
@@ -2444,7 +2444,7 @@ ${yW($,X)}`;return""}function DW($,X=[]){let{browserImports:Z}=j6($),J=new Set(X
2444
2444
  + 'or it should be imported from a relative path so the bundler includes it.'
2445
2445
  );
2446
2446
  });
2447
- `}function k7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let J={};for(let Y in X){let G=X[Y];if(typeof G==="function")continue;J[Y]=G}return J.__stxDeclaredPayload=!0,J}let Z={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;Z[J]=Y}return Z}function w6($,X){let Z=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(X){let G=Y.lastIndexOf(":");if(G!==-1)Y=Y.slice(G+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function bW($,X){if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(w6(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(w6(Z[1],!1).has(X))return!0;return!1}function SW($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function PW($,X){let Z=CW.test($),J=X.length>32768;if(!Z&&!J)return;if(q6.has($))return;if(q6.add($),Z)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(X.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function M8($,X){if(!X)return"";let Z=I1($),J=X.__stxDeclaredPayload===!0,Y=[];for(let[G,Q]of Object.entries(X)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!J&&!SW(Z,G))continue;if(bW($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;PW(G,w),Y.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2447
+ `}function k7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let J={};for(let Y in X){let G=X[Y];if(typeof G==="function")continue;J[Y]=G}return J.__stxDeclaredPayload=!0,J}let Z={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;Z[J]=Y}return Z}function w6($,X){let Z=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(X){let G=Y.lastIndexOf(":");if(G!==-1)Y=Y.slice(G+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function bW($,X){if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(w6(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(w6(Z[1],!1).has(X))return!0;return!1}function SW($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function PW($,X){let Z=CW.test($),J=X.length>32768;if(!Z&&!J)return;if(q6.has($))return;if(q6.add($),Z)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(X.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function M8($,X){if(!X)return"";let Z=w1($),J=X.__stxDeclaredPayload===!0,Y=[];for(let[G,Q]of Object.entries(X)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!J&&!SW(Z,G))continue;if(bW($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;PW(G,w),Y.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
2448
  ${Y.join(`
2449
2449
  `)}
2450
2450
  `}function xW($){let X=[];if($.self)X.push("if ($event.target !== $el) return");for(let Z of $.systemKeys)X.push(`if (!$event.${Z}Key) return`);if($.keys.length>0){let Z=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");X.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=vW[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function fW($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=c9($.handler),Q=xW(Y),w=[];if(Y.once)w.push("once: true");if(Y.capture)w.push("capture: true");if(Y.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
@@ -2508,7 +2508,7 @@ ${z}${F}`)}
2508
2508
  'use strict';
2509
2509
  ${N5(`${J}${Z}
2510
2510
  ${z}`)}
2511
- })()</script>`}var AW,K6,z6,IW,CW,q6,vW,hW;var E7=D(()=>{i9();k0();A7();Q1();n9();AW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;K6=H1,z6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];IW=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"]);CW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,q6=new Set;vW={left:0,middle:1,right:2};hW=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 dW}from"crypto";function _6($){let X=$[k8];return X instanceof Map?X:null}function H6($){$[k8]=new Map}function O6($,X){let Z=_6($);if(!Z)return null;let J=dW("sha256").update(X).digest("hex").slice(0,16),Y=Z.get(J);if(Y)Y.instances++;else Z.set(J,{body:X,instances:1});return J}function L6($,X){let Z=_6(X);if(!Z?.size)return $;let J=$;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${W.body})(${U});`)}let Y=[...Z].filter(([,q])=>q.instances>1);if(Y.length===0)return J;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2511
+ })()</script>`}var AW,K6,z6,IW,CW,q6,vW,hW;var E7=D(()=>{i9();k0();A7();Q1();n9();AW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;K6=O1,z6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];IW=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"]);CW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,q6=new Set;vW={left:0,middle:1,right:2};hW=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 dW}from"crypto";function _6($){let X=$[k8];return X instanceof Map?X:null}function H6($){$[k8]=new Map}function O6($,X){let Z=_6($);if(!Z)return null;let J=dW("sha256").update(X).digest("hex").slice(0,16),Y=Z.get(J);if(Y)Y.instances++;else Z.set(J,{body:X,instances:1});return J}function L6($,X){let Z=_6(X);if(!Z?.size)return $;let J=$;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${W.body})(${U});`)}let Y=[...Z].filter(([,q])=>q.instances>1);if(Y.length===0)return J;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
  ${Y.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2528,7 +2528,7 @@ catch (e) {
2528
2528
  }
2529
2529
  throw e;
2530
2530
  }
2531
- `),w=Q([]);if(G.length===X.length)return F6(w,G,Q);return F6((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function F6($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,w=[],q=new Set(X);return(...W)=>{for(let K=0;K<=8;K++)try{return Q(...W)}catch(z){let U=z instanceof Error?z.message:"",B=G.exec(U);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||N6.has(j))return;q.add(j),w.push(j),Q=Z(w),J?.(w)}return}}function E8($){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 J of Z)if(J.test(X))return!1;return!0}var mW,V6,A6,lW,R6,cW,N6;var T0=D(()=>{mW={maxSanitizeDepth:10,allowBracketNotation:!1},V6={...mW},A6=[/\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/],lW=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"]),R6=new Set(["__proto__","constructor","prototype"]),cW=/[\w)\]]\s*\[\s*['"]/;N6=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 D8($,X){let Z=oW++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return sW.set(J,{type:$,expression:X}),J}var oW=0,sW;var T6=D(()=>{sW=new Map});function D6($,X,Z,J){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)return-1;J.lastIndex=Z.lastIndex;let G=J.exec($);if(!G)return-1;return G.index+G[0].length}function D1($,X){return D6($,X,M6,k6)}function M5($,X){return D6($,X,I6,E6)}function D7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function aW($,X){if($.startsWith("<!--",X)){let Z=D7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[M6,k6],[I6,E6]]){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)continue;J.lastIndex=Z.lastIndex;let G=J.exec($);return G?G.index+G[0].length:$.length}return-1}function XX($,X){let Z=[],J=0,Y=$.length,G=!1,Q=null;while(J<Y){let w=$[J];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;J++;continue}if(w!=="<"){J++;continue}let q=X($,J);if(q>J){Z.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let W=aW($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function w1($,X,Z){let J=XX($,X);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((w)=>w.token),G="",Q=0;for(let w=0;w<J.length;w++){let q=J[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:Y}}function y1($){let{output:X,tokens:Z}=w1($,D1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function y7($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var M6,k6,I6,E6;var r1=D(()=>{M6=/<script\b[^>]*>/iy,k6=/<\/script\s*>/ig,I6=/<style\b[^>]*>/iy,E6=/<\/style\s*>/ig});var x6={};a(x6,{usesSignalsInScript:()=>L1,unescapeHtml:()=>QK,registerFilters:()=>eW,registerFilter:()=>S6,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>ZK,interpolateScriptExpressions:()=>y8,interpolateScriptAttributes:()=>P6,getAllFilters:()=>C6,evaluateExpression:()=>u0,escapeHtml:()=>a0,defaultFilters:()=>S7,clearCustomFilters:()=>$K,applyFilters:()=>v6});function tW($){let X=y6.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),y6.set($,X)}return X.lastIndex=0,X}function S6($,X){if($ in S7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);b7[$]=X}function eW($){for(let[X,Z]of Object.entries($))S6(X,Z)}function C6(){return{...S7,...b7}}function $K(){for(let $ of Object.keys(b7))delete b7[$]}function a0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L1($){let{scripts:X}=y1($);for(let Z of X){let J=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function b6($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",G=!1,Q=0;for(let W=0;W<J.length;W++){let K=J[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[W+1]==="{"){Q++,W++,Y+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){Y+=K;continue}continue}Y+=K}J=Y;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function XK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=I1($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function y8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=u0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=u0(Y,X);if(Q===void 0)return J;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return J}}),Z}function P6($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=u0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=u0(Y,X);if(Q===void 0)return J;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),Z}function ZK($,X,Z={}){let{output:J,scripts:Y}=y1($),G=Y.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 K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${P6(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+y8(z,X)+Q.slice(W)});return y7(J,G)}function b1($,X,Z){let J=$,Y=(z,U)=>{let B=M5(z,U);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,B))?-1:B},G=(z,U,B,j)=>{let _=B.length,{output:H,tokens:L}=w1(z,U,(O,F)=>j(_+F));return B.push(...L),H},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];J=G(J,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||L1($),W=new Set(Array.isArray(X?.__stx_client_signal_names)?X.__stx_client_signal_names:[]),K=new Set(Array.isArray(X?.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,B)=>{try{let j=u0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=u0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return D8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return D8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),J=G(J,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,B)=>{let j=U.trim();if(K.has(j))return z;let _=["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_$]*)/,O=j.match(H)?.[1],F=O&&((O in X)||_.includes(O)),V=Boolean(O&&W.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=u0(U,X);if(V)return z;if(q&&!b6(j,X))return z;if(X.__stx_buildMode==="compile"&&!q&&(T===void 0||XK(j,X)))return D8("expr",j);return T!==void 0&&T!==null?a0(String(T)):""}catch(T){if(V)return z;if(q&&!b6(j,X))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return z0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,$,B,z)}});for(let z=0;z<w.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>w[z]);for(let z=0;z<Q.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return J}function v6($,X,Z){if(!X.trim())return $;let J=$,Y=X.trim();while(Y.length>0){let G=Y.match(/^(\w+)/);if(!G)break;let Q=G[1];Y=Y.substring(Q.length).trim();let w=b7[Q]||S7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(C6()).join(", ")}`);let q=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[u0(`(${z})`,Z,!0)];else{let U=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){U.push(B),B="";continue}B+=V}if(B)U.push(B);q=U.map((F)=>{let V=F.trim();return u0(V,Z,!0)})}}catch{q=[z]}Y=Y.substring(K).trim()}}try{J=w(J,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function JK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let w=0;w<$.length;w++){let q=$[w],W=$[w+1];if(X&&Q){Q=!1;continue}if(X&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!X)X=!0,Z=q;else if(q===Z)X=!1,Z="";continue}if(X&&Z==="`"&&q==="$"&&W==="{"){let K=1;w+=2;while(w<$.length&&K>0){if($[w]==="{")K++;else if($[w]==="}")K--;if(K>0)w++}continue}if(X)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&J===0&&Y===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function u0($,X,Z=!1){try{let J=$.trim(),Y=JK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=u0(G,X,!0);return v6(w,Q,X)}if(!q0(J)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,X)}try{let G=Object.keys(X),Q=Object.values(X);return W0(J,G)(...Q)}catch{return J0(J,X)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let G=Y[1],Q=YK(G,Object.keys(X));if(Q&&Q!==G)J.message=`${J.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,J);throw J}}function YK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=GK($,Y);if(Z===null||G<Z.dist)Z={key:Y,dist:G}}if(!Z)return null;let J=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/J<=0.35)return Z.key;return null}function GK($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,J]=$.length<X.length?[$,X]:[X,$],Y=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)Y[Q]=Q;for(let Q=1;Q<=J.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===J[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,Y[w]+1,Y[w-1]+q)}for(let w=0;w<=Z.length;w++)Y[w]=G[w]}return Y[Z.length]}function QK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,y6,S7;var q1=D(()=>{T0();k0();T6();r1();b7={},y6=new Map;S7={uppercase:($,X)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,X)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,X)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,X,Z=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let J=X.__translations,Y=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=J;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return Y?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(tW(q),String(W))}),w},t:($,X,Z={})=>{return S7.translate($,X,Z)},truncate:($,X,Z=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=Z)return Y;if(Z<=J.length)return J.substring(0,Z);return Y.substring(0,Z-J.length)+J},date:($,X,Z="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);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 Y.toISOString();return new Intl.DateTimeFormat(J,G[Z]||G.short).format(Y)}catch{return String($)}},currency:($,X,Z="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Z}).format(Y)}catch{return String($)}},pluralize:($,X,Z,J)=>{let Y=Number($);if(Number.isNaN(Y))return Z;let G=J||`${Z}s`;return Y===1?Z:G},first:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,X)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,X,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,X,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,X,Z=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,J);return $},replace:($,X,Z,J="")=>{if($===void 0||$===null)return"";let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,X)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,X)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,X)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,X,Z=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**Z;return Math.round(J*Y)/Y}}});class o1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let X=this.cache.get($);return this.cache.delete($),this.cache.set($,X),X}set($,X){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function I5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!k5.has(Z)){if(k5.size>=wK){let J=k5.keys().next().value;if(J)k5.delete(J)}k5.set(Z,new RegExp($,X))}return k5.get(Z)}class f6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),J=this.pool.find((w)=>w.context.join(",")===Z);if(J)return J.func;let Y=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,K=Y.get(W);if(!K){if(Y.size>=G){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...X,`
2531
+ `),w=Q([]);if(G.length===X.length)return F6(w,G,Q);return F6((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function F6($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,w=[],q=new Set(X);return(...W)=>{for(let K=0;K<=8;K++)try{return Q(...W)}catch(z){let U=z instanceof Error?z.message:"",B=G.exec(U);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||N6.has(j))return;q.add(j),w.push(j),Q=Z(w),J?.(w)}return}}function E8($){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 J of Z)if(J.test(X))return!1;return!0}var mW,V6,A6,lW,R6,cW,N6;var T0=D(()=>{mW={maxSanitizeDepth:10,allowBracketNotation:!1},V6={...mW},A6=[/\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/],lW=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"]),R6=new Set(["__proto__","constructor","prototype"]),cW=/[\w)\]]\s*\[\s*['"]/;N6=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 D8($,X){let Z=oW++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return sW.set(J,{type:$,expression:X}),J}var oW=0,sW;var T6=D(()=>{sW=new Map});function D6($,X,Z,J){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)return-1;J.lastIndex=Z.lastIndex;let G=J.exec($);if(!G)return-1;return G.index+G[0].length}function D1($,X){return D6($,X,M6,k6)}function M5($,X){return D6($,X,I6,E6)}function D7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function aW($,X){if($.startsWith("<!--",X)){let Z=D7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[M6,k6],[I6,E6]]){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)continue;J.lastIndex=Z.lastIndex;let G=J.exec($);return G?G.index+G[0].length:$.length}return-1}function XX($,X){let Z=[],J=0,Y=$.length,G=!1,Q=null;while(J<Y){let w=$[J];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;J++;continue}if(w!=="<"){J++;continue}let q=X($,J);if(q>J){Z.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let W=aW($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function q1($,X,Z){let J=XX($,X);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((w)=>w.token),G="",Q=0;for(let w=0;w<J.length;w++){let q=J[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:Y}}function y1($){let{output:X,tokens:Z}=q1($,D1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function y7($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var M6,k6,I6,E6;var r1=D(()=>{M6=/<script\b[^>]*>/iy,k6=/<\/script\s*>/ig,I6=/<style\b[^>]*>/iy,E6=/<\/style\s*>/ig});var x6={};a(x6,{usesSignalsInScript:()=>F1,unescapeHtml:()=>QK,registerFilters:()=>eW,registerFilter:()=>S6,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>ZK,interpolateScriptExpressions:()=>y8,interpolateScriptAttributes:()=>P6,getAllFilters:()=>C6,evaluateExpression:()=>u0,escapeHtml:()=>a0,defaultFilters:()=>S7,clearCustomFilters:()=>$K,applyFilters:()=>v6});function tW($){let X=y6.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),y6.set($,X)}return X.lastIndex=0,X}function S6($,X){if($ in S7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);b7[$]=X}function eW($){for(let[X,Z]of Object.entries($))S6(X,Z)}function C6(){return{...S7,...b7}}function $K(){for(let $ of Object.keys(b7))delete b7[$]}function a0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F1($){let{scripts:X}=y1($);for(let Z of X){let J=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function b6($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",G=!1,Q=0;for(let W=0;W<J.length;W++){let K=J[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[W+1]==="{"){Q++,W++,Y+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){Y+=K;continue}continue}Y+=K}J=Y;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function XK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=w1($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function y8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=u0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=u0(Y,X);if(Q===void 0)return J;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return J}}),Z}function P6($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=u0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=u0(Y,X);if(Q===void 0)return J;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),Z}function ZK($,X,Z={}){let{output:J,scripts:Y}=y1($),G=Y.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 K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${P6(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+y8(z,X)+Q.slice(W)});return y7(J,G)}function b1($,X,Z){let J=$,Y=(z,U)=>{let B=M5(z,U);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,B))?-1:B},G=(z,U,B,j)=>{let _=B.length,{output:H,tokens:L}=q1(z,U,(O,F)=>j(_+F));return B.push(...L),H},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];J=G(J,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||F1($),W=new Set(Array.isArray(X?.__stx_client_signal_names)?X.__stx_client_signal_names:[]),K=new Set(Array.isArray(X?.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,B)=>{try{let j=u0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=u0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return D8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return D8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),J=G(J,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,B)=>{let j=U.trim();if(K.has(j))return z;let _=["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_$]*)/,O=j.match(H)?.[1],F=O&&((O in X)||_.includes(O)),V=Boolean(O&&W.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=u0(U,X);if(V)return z;if(q&&!b6(j,X))return z;if(X.__stx_buildMode==="compile"&&!q&&(T===void 0||XK(j,X)))return D8("expr",j);return T!==void 0&&T!==null?a0(String(T)):""}catch(T){if(V)return z;if(q&&!b6(j,X))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return z0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,$,B,z)}});for(let z=0;z<w.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>w[z]);for(let z=0;z<Q.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return J}function v6($,X,Z){if(!X.trim())return $;let J=$,Y=X.trim();while(Y.length>0){let G=Y.match(/^(\w+)/);if(!G)break;let Q=G[1];Y=Y.substring(Q.length).trim();let w=b7[Q]||S7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(C6()).join(", ")}`);let q=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[u0(`(${z})`,Z,!0)];else{let U=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){U.push(B),B="";continue}B+=V}if(B)U.push(B);q=U.map((F)=>{let V=F.trim();return u0(V,Z,!0)})}}catch{q=[z]}Y=Y.substring(K).trim()}}try{J=w(J,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function JK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let w=0;w<$.length;w++){let q=$[w],W=$[w+1];if(X&&Q){Q=!1;continue}if(X&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!X)X=!0,Z=q;else if(q===Z)X=!1,Z="";continue}if(X&&Z==="`"&&q==="$"&&W==="{"){let K=1;w+=2;while(w<$.length&&K>0){if($[w]==="{")K++;else if($[w]==="}")K--;if(K>0)w++}continue}if(X)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&J===0&&Y===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function u0($,X,Z=!1){try{let J=$.trim(),Y=JK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=u0(G,X,!0);return v6(w,Q,X)}if(!q0(J)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,X)}try{let G=Object.keys(X),Q=Object.values(X);return W0(J,G)(...Q)}catch{return J0(J,X)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let G=Y[1],Q=YK(G,Object.keys(X));if(Q&&Q!==G)J.message=`${J.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,J);throw J}}function YK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=GK($,Y);if(Z===null||G<Z.dist)Z={key:Y,dist:G}}if(!Z)return null;let J=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/J<=0.35)return Z.key;return null}function GK($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,J]=$.length<X.length?[$,X]:[X,$],Y=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)Y[Q]=Q;for(let Q=1;Q<=J.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===J[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,Y[w]+1,Y[w-1]+q)}for(let w=0;w<=Z.length;w++)Y[w]=G[w]}return Y[Z.length]}function QK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,y6,S7;var W1=D(()=>{T0();k0();T6();r1();b7={},y6=new Map;S7={uppercase:($,X)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,X)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,X)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,X,Z=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let J=X.__translations,Y=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=J;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return Y?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(tW(q),String(W))}),w},t:($,X,Z={})=>{return S7.translate($,X,Z)},truncate:($,X,Z=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=Z)return Y;if(Z<=J.length)return J.substring(0,Z);return Y.substring(0,Z-J.length)+J},date:($,X,Z="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);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 Y.toISOString();return new Intl.DateTimeFormat(J,G[Z]||G.short).format(Y)}catch{return String($)}},currency:($,X,Z="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Z}).format(Y)}catch{return String($)}},pluralize:($,X,Z,J)=>{let Y=Number($);if(Number.isNaN(Y))return Z;let G=J||`${Z}s`;return Y===1?Z:G},first:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,X)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,X,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,X,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,X,Z=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,J);return $},replace:($,X,Z,J="")=>{if($===void 0||$===null)return"";let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,X)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,X)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,X)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,X,Z=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**Z;return Math.round(J*Y)/Y}}});class o1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let X=this.cache.get($);return this.cache.delete($),this.cache.set($,X),X}set($,X){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function I5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!k5.has(Z)){if(k5.size>=wK){let J=k5.keys().next().value;if(J)k5.delete(J)}k5.set(Z,new RegExp($,X))}return k5.get(Z)}class f6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),J=this.pool.find((w)=>w.context.join(",")===Z);if(J)return J.func;let Y=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,K=Y.get(W);if(!K){if(Y.size>=G){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...X,`
2532
2532
  'use strict';
2533
2533
  try {
2534
2534
  return ${q};
@@ -2545,19 +2545,19 @@ catch (e) {
2545
2545
  `)})}else X.push({selector:`@${K} ${z.trim()}`,declarations:U.trim()})}Q="",G=!1}else if(Y.trim()){Y+=q;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(G)Q+=q;else Y+=q}return X}function m6($,X,Z,J,Y,G){let{selector:Q,declarations:w}=$;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let K=Q.replace("@keyframes ","").trim();return`@keyframes ${Y.get(K)||K} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=JX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>m6(U,X,Z,J,Y,G)).join(`
2546
2546
  `);return`${Q} {
2547
2547
  ${z}
2548
- }`}return`${Q} { ${w} }`}let q=WK(Q,X,Z,J),W=w;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)W=W.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${q} { ${W} }`}function WK($,X,Z,J){let Y=$.split(",").map((Q)=>Q.trim()),G=[];for(let Q of Y){if(Q.startsWith(":host")){if(J)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${X}`);continue}let w=Z?`${Z} .${X}`:`.${X}`;G.push(`${w} ${Q}`);let q=KK(Q,X);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function KK($,X){let Z=0,J=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){J=q;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,w=0;for(let q=0;q<Y.length;q++){let W=Y[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function c6($){let X=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let J=Z.trim();if(X.has(J))return"";return X.add(J),Z})}function b8($,X){if(!zK.test($))return{html:$,hasScoped:!1};let Z=u6(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${YX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,q,W)=>{Q=!0;let K=UK(W,J),z=q.replace(new RegExp(YX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=BK(Y,J),{html:Y,hasScoped:!0}}function UK($,X){return d6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function BK($,X){let Z=w1($,(Y,G)=>{let Q=D1(Y,G);return Q>G?Q:M5(Y,G)},(Y,G)=>jK(G)),J=_K(Z.output,X);return l6.lastIndex=0,J.replace(l6,(Y,G)=>Z.tokens[Number(G)])}function _K($,X){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,G)=>{if(Z.has(Y.toLowerCase()))return J;if(J.includes(X))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(G)return J.replace(`<${Y}${G}`,`<${Y} ${X}${G}`);if(J.endsWith("/>"))return`<${Y} ${X} />`;return`<${Y} ${X}>`})}var YX,zK,jK=($)=>`\x00stx-scope-mask-${$}\x00`,l6;var GX=D(()=>{r1();YX=String.raw`(?<![\w-])scoped(?![\w-])`,zK=new RegExp(`<style\\s+[^>]*${YX}`,"i");l6=/\u0000stx-scope-mask-(\d+)\u0000/g});function OK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return HK.test(X)}function S8($){C7.lastIndex=0;let X;while((X=C7.exec($))!==null){if(X[0].startsWith("</")||OK(X[0]))continue;let Z=X.index,J=C7.lastIndex,Y=1,G;while((G=C7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:C7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var C7,HK;var QX=D(()=>{C7=/<\/?template\b[^>]*>/gi,HK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var p6=()=>{};function E0($,X,Z,J=0){let Y=0,G=J,Q=null,w=0,q=!1;while(G<$.length){let W=$[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==="$"&&$[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===X)Y++;else if(W===Z){if(Y--,Y===0)return G}G++}return-1}var WX={};a(WX,{useTitle:()=>RK,useSeoMeta:()=>i6,usePageTitle:()=>RK,useHead:()=>qX,seoMetaToHeadConfig:()=>P8,resetHead:()=>VK,renderHtmlAttrs:()=>TK,renderHead:()=>NK,renderBodyAttrs:()=>MK,processTitleDirective:()=>EK,processMetaDirective:()=>DK,processHeadDirective:()=>IK,mergeHeadConfigs:()=>D5,getPageMeta:()=>FK,getHead:()=>wX,definePageMeta:()=>AK,applyHead:()=>kK});function wX(){return S1}function FK(){return C8}function VK(){S1={},LK.length=0,C8={}}function qX($){S1=D5(S1,$)}function D5($,X){return{title:X.title??$.title,titleTemplate:X.titleTemplate??$.titleTemplate,base:X.base??$.base,meta:[...$.meta||[],...X.meta||[]],link:[...$.link||[],...X.link||[]],script:[...$.script||[],...X.script||[]],style:[...$.style||[],...X.style||[]],htmlAttrs:{...$.htmlAttrs,...X.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...X.bodyAttrs}}}function i6($){qX(P8($))}function P8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:q})}if($.author)X.push({name:"author",content:$.author});if($.robots)X.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Z)X.push({property:"og:title",content:Z});if(J)X.push({property:"og:description",content:J});if($.ogImage)X.push({property:"og:image",content:$.ogImage});if($.ogUrl)X.push({property:"og:url",content:$.ogUrl});if($.ogType)X.push({property:"og:type",content:$.ogType});if($.ogSiteName)X.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)X.push({property:"og:locale",content:$.ogLocale});let Y=$.twitterTitle??$.title,G=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)X.push({name:"twitter:card",content:$.twitterCard});if(Y)X.push({name:"twitter:title",content:Y});if(G)X.push({name:"twitter:description",content:G});if(Q)X.push({name:"twitter:image",content:Q});if($.twitterSite)X.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)X.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)X.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)X.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)X.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)X.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)X.push({property:"article:tag",content:q});let w=[];if($.canonical)w.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:w}}function AK($){if(C8={...C8,...$},$.title||$.description)i6({title:$.title,description:$.description})}function RK($){let X=typeof $==="function"?$():$;qX({title:X})}function NK($=S1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${s1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${s1(Y)}"`).join(" ");X.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>{return`${Y==="httpEquiv"?"http-equiv":Y}="${s1(String(G))}"`}).join(" ");X.push(`<meta ${J}>`)}for(let Z of $.link||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>`${Y}="${s1(String(G))}"`).join(" ");X.push(`<link ${J}>`)}for(let Z of $.script||[]){let{content:J,...Y}=Z,G=Object.entries(Y).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${s1(String(w))}"`}).filter(Boolean).join(" ");if(J)X.push(`<script ${G}>${J}</script>`);else X.push(`<script ${G}></script>`)}for(let Z of $.style||[]){let J=Z.type?` type="${Z.type}"`:"";X.push(`<style${J}>${Z.content}</style>`)}return X.join(`
2548
+ }`}return`${Q} { ${w} }`}let q=WK(Q,X,Z,J),W=w;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)W=W.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${q} { ${W} }`}function WK($,X,Z,J){let Y=$.split(",").map((Q)=>Q.trim()),G=[];for(let Q of Y){if(Q.startsWith(":host")){if(J)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${X}`);continue}let w=Z?`${Z} .${X}`:`.${X}`;G.push(`${w} ${Q}`);let q=KK(Q,X);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function KK($,X){let Z=0,J=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){J=q;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,w=0;for(let q=0;q<Y.length;q++){let W=Y[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function c6($){let X=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let J=Z.trim();if(X.has(J))return"";return X.add(J),Z})}function b8($,X){if(!zK.test($))return{html:$,hasScoped:!1};let Z=u6(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${YX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,q,W)=>{Q=!0;let K=UK(W,J),z=q.replace(new RegExp(YX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=BK(Y,J),{html:Y,hasScoped:!0}}function UK($,X){return d6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function BK($,X){let Z=q1($,(Y,G)=>{let Q=D1(Y,G);return Q>G?Q:M5(Y,G)},(Y,G)=>jK(G)),J=_K(Z.output,X);return l6.lastIndex=0,J.replace(l6,(Y,G)=>Z.tokens[Number(G)])}function _K($,X){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,G)=>{if(Z.has(Y.toLowerCase()))return J;if(J.includes(X))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(G)return J.replace(`<${Y}${G}`,`<${Y} ${X}${G}`);if(J.endsWith("/>"))return`<${Y} ${X} />`;return`<${Y} ${X}>`})}var YX,zK,jK=($)=>`\x00stx-scope-mask-${$}\x00`,l6;var GX=D(()=>{r1();YX=String.raw`(?<![\w-])scoped(?![\w-])`,zK=new RegExp(`<style\\s+[^>]*${YX}`,"i");l6=/\u0000stx-scope-mask-(\d+)\u0000/g});function OK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return HK.test(X)}function S8($){C7.lastIndex=0;let X;while((X=C7.exec($))!==null){if(X[0].startsWith("</")||OK(X[0]))continue;let Z=X.index,J=C7.lastIndex,Y=1,G;while((G=C7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:C7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var C7,HK;var QX=D(()=>{C7=/<\/?template\b[^>]*>/gi,HK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var p6=()=>{};function E0($,X,Z,J=0){let Y=0,G=J,Q=null,w=0,q=!1;while(G<$.length){let W=$[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==="$"&&$[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===X)Y++;else if(W===Z){if(Y--,Y===0)return G}G++}return-1}var WX={};a(WX,{useTitle:()=>RK,useSeoMeta:()=>i6,usePageTitle:()=>RK,useHead:()=>qX,seoMetaToHeadConfig:()=>P8,resetHead:()=>VK,renderHtmlAttrs:()=>TK,renderHead:()=>NK,renderBodyAttrs:()=>MK,processTitleDirective:()=>EK,processMetaDirective:()=>DK,processHeadDirective:()=>IK,mergeHeadConfigs:()=>D5,getPageMeta:()=>FK,getHead:()=>wX,definePageMeta:()=>AK,applyHead:()=>kK});function wX(){return S1}function FK(){return C8}function VK(){S1={},LK.length=0,C8={}}function qX($){S1=D5(S1,$)}function D5($,X){return{title:X.title??$.title,titleTemplate:X.titleTemplate??$.titleTemplate,base:X.base??$.base,meta:[...$.meta||[],...X.meta||[]],link:[...$.link||[],...X.link||[]],script:[...$.script||[],...X.script||[]],style:[...$.style||[],...X.style||[]],htmlAttrs:{...$.htmlAttrs,...X.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...X.bodyAttrs}}}function i6($){qX(P8($))}function P8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:q})}if($.author)X.push({name:"author",content:$.author});if($.robots)X.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Z)X.push({property:"og:title",content:Z});if(J)X.push({property:"og:description",content:J});if($.ogImage)X.push({property:"og:image",content:$.ogImage});if($.ogUrl)X.push({property:"og:url",content:$.ogUrl});if($.ogType)X.push({property:"og:type",content:$.ogType});if($.ogSiteName)X.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)X.push({property:"og:locale",content:$.ogLocale});let Y=$.twitterTitle??$.title,G=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)X.push({name:"twitter:card",content:$.twitterCard});if(Y)X.push({name:"twitter:title",content:Y});if(G)X.push({name:"twitter:description",content:G});if(Q)X.push({name:"twitter:image",content:Q});if($.twitterSite)X.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)X.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)X.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)X.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)X.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)X.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)X.push({property:"article:tag",content:q});let w=[];if($.canonical)w.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:w}}function AK($){if(C8={...C8,...$},$.title||$.description)i6({title:$.title,description:$.description})}function RK($){let X=typeof $==="function"?$():$;qX({title:X})}function NK($=S1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${s1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${s1(Y)}"`).join(" ");X.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>{return`${Y==="httpEquiv"?"http-equiv":Y}="${s1(String(G))}"`}).join(" ");X.push(`<meta ${J}>`)}for(let Z of $.link||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>`${Y}="${s1(String(G))}"`).join(" ");X.push(`<link ${J}>`)}for(let Z of $.script||[]){let{content:J,...Y}=Z,G=Object.entries(Y).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${s1(String(w))}"`}).filter(Boolean).join(" ");if(J)X.push(`<script ${G}>${J}</script>`);else X.push(`<script ${G}></script>`)}for(let Z of $.style||[]){let J=Z.type?` type="${Z.type}"`:"";X.push(`<style${J}>${Z.content}</style>`)}return X.join(`
2549
2549
  `)}function TK($=S1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${s1(Z)}"`).join(" ")}function MK($=S1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${s1(Z)}"`).join(" ")}function s1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function kK($=S1){if(typeof document>"u")return;if($.title){let X=$.title;if($.titleTemplate)X=typeof $.titleTemplate==="function"?$.titleTemplate(X):$.titleTemplate.replace("%s",X);document.title=X}for(let X of $.meta||[]){let Z=X.name?`meta[name="${X.name}"]`:X.property?`meta[property="${X.property}"]`:null;if(Z){let J=document.querySelector(Z);if(!J){if(J=document.createElement("meta"),X.name)J.setAttribute("name",X.name);if(X.property)J.setAttribute("property",X.property);document.head.appendChild(J)}J.setAttribute("content",X.content)}}for(let X of $.link||[]){let Z=`link[rel="${X.rel}"]${X.href?`[href="${X.href}"]`:""}`,J=document.querySelector(Z);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Y,G]of Object.entries(X))if(G!==void 0)J.setAttribute(Y,String(G))}if($.htmlAttrs)for(let[X,Z]of Object.entries($.htmlAttrs))if(X==="class")for(let J of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(X,Z);if($.bodyAttrs)for(let[X,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(X,Z)}function IK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2550
2550
  `,""}),headContent:X.trim()}}function EK($,X){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,J,Y,G)=>{let Q=J?Y:X[(G||"").trim()]??G,w=X.__stx_runtime_head??{};return X.__stx_runtime_head=D5(w,{title:Q}),""})}function DK($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,J,Y,G,Q,w)=>{let q=G?Q:w,W=G?q:X[(q||"").trim()]??q,z=Y.includes(":")?{property:Y,content:W}:{name:Y,content:W},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=D5(U,{meta:[z]}),""})}var S1,LK,C8;var P7=D(()=>{S1={},LK=[],C8={}});var v8={};a(v8,{stripTypeScript:()=>e6,splitDeclaration:()=>GZ,isModuleResolutionFailure:()=>$Z,isMissingBindingFailure:()=>XZ,isCompleteImport:()=>ZZ,hasVariables:()=>WZ,extractVariables:()=>a1,extractScriptFromTemplate:()=>qZ,convertToCommonJS:()=>UX,STX_ENGINE_BINDING_NAMES:()=>zX});import C1 from"path";import y5 from"process";function bK($){let X=[],Z=0,J=$.split(`
2551
2551
  `);for(let Y of J){let G=Z,Q=null,w=!1;for(let q=0;q<Y.length;q++){let W=Y[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<Y.length&&Y[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)X.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)X.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((U)=>{let B=U.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((U)=>/^\w+$/.test(U));X.push(...z)}}}}return[...new Set(X)]}function e6($){let X=$;X=X.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),X=X.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),X=X.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),X=X.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),X=X.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(J){if(!J.includes(":"))return J;let Y=[],G="",Q=0,w=0,q=null;for(let W=0;W<J.length;W++){let K=J[W];if(q){if(G+=K,K===q)q=null;continue}if(K==='"'||K==="'"||K==="`"){q=K,G+=K;continue}if(K==="<")Q++;else if(K===">"&&Q>0)Q--;else if(K==="(")w++;else if(K===")")w--;if(K===","&&Q===0&&w===0){Y.push(G),G="";continue}G+=K}if(G)Y.push(G);return Y.map((W)=>{let K=W.trim(),z=K.startsWith("..."),U=z?K.slice(3):K,B=-1,j=0;for(let A=0;A<U.length;A++)if(U[A]==="<")j++;else if(U[A]===">")j--;else if(U[A]===":"&&j===0){B=A;break}if(B===-1)return W;let H=U.substring(0,B).trim().replace(/\?$/,""),L=U.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=z?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).join(", ")}X=X.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,G)=>{if(!G.includes(":"))return J;return`${Y}(${Z(G)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,G=[];while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,w=1,q=Q+1,W=0,K=null;while(q<X.length&&w>0){let B=X[q];if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let z=X.substring(Q+1,q);if(!z.includes(":"))continue;let U=Z(z);G.push({start:Q+1,end:q,replacement:U})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];X=X.substring(0,w)+W+X.substring(q)}}return X=X.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.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(", ")}) =>`}),X=X.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"),X=X.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),X=X.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),X=X.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),X=X.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),X=X.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),X=X.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),X=X.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),X=X.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),X=X.replace(/\n\s*\n\s*\n/g,`
2552
2552
 
2553
2553
  `),X}function $Z($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function XZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function a1($,X,Z,J={}){if(!$.trim())return;let Y;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=E.transformSync(v)}catch{Y=e6($)}let G={exports:{}},Q=G.exports,w=y5.cwd(),q={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=C1.resolve(w,"node_modules",E),m=C1.join(v,"package.json"),g=JSON.parse(j0("fs").readFileSync(m,"utf8")),r=g.main||"index.js";if(g.exports){let Q0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Q0==="string")r=Q0;else if(Q0?.bun)r=Q0.bun;else if(Q0?.import)r=Q0.import;else if(Q0?.default)r=Q0.default}q[E]=await import(C1.resolve(v,r))}catch{}let K=(E)=>{if(q[E])return q[E];return j0(E)},z=X.props||{},U=(E)=>{if(!E)return z;let v={};for(let[m,g]of Object.entries(E)){let r=z[m];if(r!==void 0)v[m]=r;else if(typeof g==="function")v[m]=g();else v[m]=g}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(U,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(U,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return z;let v={...z};for(let[m,g]of Object.entries(E)){let r=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[m]===void 0&&r.default!==void 0)v[m]=typeof r.default==="function"?r.default():r.default}return v},j=()=>X.slots||{},_=(E,v)=>{let m={...E};for(let[g,r]of Object.entries(v))if(m[g]===void 0)if(typeof r==="function")m[g]=r();else m[g]=r;return m},H=(E)=>{let v=()=>E;return v.set=(m)=>{},v.update=(m)=>{},v},L=(E)=>{let v,m=!1;return()=>{if(!m)try{v=E(),m=!0}catch{v=void 0}return v}},O=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function N(E){if(!E||typeof E!=="object")return;let v=X.__stxClientPayload??{};Object.assign(v,E),X.__stxClientPayload=v}let T=()=>{let E=X.__stxServeContext,v=X.__stxServeSearch??E?.search??"",m=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),r=X.query,Q0=Object.keys(g).length>0?g:r??{},o0=v||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:X.params??{},query:Q0,path:m,name:"",fullPath:m+o0,hash:"",matched:[]}},M=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),k=(E)=>{let v=X.__stx_runtime_head||{};X.__stx_runtime_head=D5(v,E||{})},y=(E)=>{k(P8(E||{}))},I=(E)=>({value:E}),S=(E)=>E,b=(E)=>({value:typeof E==="function"?E():E}),C=(E,v)=>{},P=(E)=>{},x=(E)=>{},f=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...m)=>{},$0=(E)=>{},C0=(E,v)=>{},U0=(E,v)=>v,A0=()=>({value:"light"}),u=()=>H(!1),t=(E)=>H(!1),R0=()=>H(!1),P0=()=>t("(prefers-color-scheme: dark)"),j5=()=>t("(prefers-color-scheme: light)"),B5=()=>t("(prefers-reduced-motion: reduce)"),n=()=>t("(prefers-contrast: more)"),s={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:{}},K0=new Proxy(s,{get(E,v){if(v in E)return E[v];return},set(E,v,m){return E[v]=m,!0}}),I0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=UX(Y,Z),v=new Set(Object.keys(z)),m=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(X).filter((i)=>!v.has(i)&&i!=="props"&&m(i)),r=g.map((i)=>X[i]);if(!g.includes("__stxServeContext"))g.push("__stxServeContext"),r.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"]),o0=[],f0=[];for(let[i,G1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Q0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;o0.push(i),f0.push(G1)}let s0=bK(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
2554
- `),_5=X.params??{},N1=[],T1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;N1.push(g[i]),T1.push(r[i])}let Y1=await Function(...zX,...o0,...N1,`return (async () => {
2554
+ `),_5=X.params??{},T1=[],M1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;T1.push(g[i]),M1.push(r[i])}let Y1=await Function(...zX,...o0,...T1,`return (async () => {
2555
2555
  ${E}
2556
2556
  ${s0}
2557
2557
  return module.exports
2558
- })()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,T,M,k,y,I,S,b,C,P,x,f,l,$0,j,C0,U0,A0,u,t,R0,P0,j5,B5,n,K0,I0,w0,s.confirm,s.alert,s.fetch,_5,...f0,...T1);if(J.preserveExisting){for(let[i,G1]of Object.entries(Y1))if(!(i in X)||X[i]===void 0)X[i]=G1}else Object.assign(X,Y1);for(let[i,G1]of Object.entries(z))if(!(i in X))X[i]=G1}catch(E){let v=E instanceof Error?E.message:String(E);if($Z(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(XZ(v))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: ${v}`);else if(y5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await fK(Y,X,Z)}catch(m){if(y5.env.STX_DEBUG){let g=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${g}`)}}}}function ZZ($){let X=0,Z=null,J=!1,Y=!1;for(let G=0;G<$.length;G++){let Q=$[G];if(Z){if(Q===Z){if(Z=null,J||X===0)Y=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")X++;else if(Q==="}")X--;else if($.startsWith("from",G)&&X===0)J=!0}return Z===null&&X===0&&Y}function UX($,X){let Z=X?C1.dirname(X):y5.cwd(),J=y5.cwd(),Y=$.split(`
2558
+ })()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,T,M,k,y,I,S,b,C,P,x,f,l,$0,j,C0,U0,A0,u,t,R0,P0,j5,B5,n,K0,I0,w0,s.confirm,s.alert,s.fetch,_5,...f0,...M1);if(J.preserveExisting){for(let[i,G1]of Object.entries(Y1))if(!(i in X)||X[i]===void 0)X[i]=G1}else Object.assign(X,Y1);for(let[i,G1]of Object.entries(z))if(!(i in X))X[i]=G1}catch(E){let v=E instanceof Error?E.message:String(E);if($Z(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(XZ(v))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: ${v}`);else if(y5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await fK(Y,X,Z)}catch(m){if(y5.env.STX_DEBUG){let g=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${g}`)}}}}function ZZ($){let X=0,Z=null,J=!1,Y=!1;for(let G=0;G<$.length;G++){let Q=$[G];if(Z){if(Q===Z){if(Z=null,J||X===0)Y=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")X++;else if(Q==="}")X--;else if($.startsWith("from",G)&&X===0)J=!0}return Z===null&&X===0&&Y}function UX($,X){let Z=X?C1.dirname(X):y5.cwd(),J=y5.cwd(),Y=$.split(`
2559
2559
  `),G=[],Q=0;while(Q<Y.length){let w=Y[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<Y.length;Q++){for(let W of Y[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,K=Q;for(let B=Q;B<Y.length&&!W;B++){let j=null,_=!1,H=Y[B];for(let L=0;L<H.length;L++){let O=H[L];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")q++;else if(O===")"){if(q--,q===0){Q=B+1,W=!0;break}}}}if(!W)Q=Y.length;let z=Y.slice(K,Q).join(`
2560
- `),U=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)U.push(`${B}: ${JSON.stringify(j[2])}`)}if(U.length>0)G.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!ZZ(q)&&Q+W+1<Y.length)W++,q=`${q} ${Y[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(_)=>{if(_.startsWith("."))return C1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return C1.resolve(J,_.slice(2));return _};if(K){let[,_,H]=K,L=j(H);G.push(`const ${_} = await import('${L}')`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,L=j(H),O=[],F=[],V=yK.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,M]=[N[0].trim(),N[1].trim()];if(V&&n6.has(T)){G.push(`const ${M} = ${T};`),F.push(M);continue}O.push(`${T}: ${M}`),F.push(M)}else{if(V&&n6.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let _=j(U[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(SK.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=o6(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=KX(Y,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=o6(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=KX(Y,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=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[Q]=q;let K=KX(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.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],K=Y[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<Y.length;U++){let B=Y[U];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(U>Q)K+=`
2560
+ `),U=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)U.push(`${B}: ${JSON.stringify(j[2])}`)}if(U.length>0)G.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!ZZ(q)&&Q+W+1<Y.length)W++,q=`${q} ${Y[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(_)=>{if(_.startsWith("."))return C1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return C1.resolve(J,_.slice(2));return _};if(K){let[,_,H]=K,L=j(H);G.push(`const ${_} = (await import('${L}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,L=j(H),O=[],F=[],V=yK.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,M]=[N[0].trim(),N[1].trim()];if(V&&n6.has(T)){G.push(`const ${M} = ${T};`),F.push(M);continue}O.push(`${T}: ${M}`),F.push(M)}else{if(V&&n6.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let _=j(U[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(SK.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=o6(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=KX(Y,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=o6(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=KX(Y,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=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[Q]=q;let K=KX(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.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],K=Y[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<Y.length;U++){let B=Y[U];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(U>Q)K+=`
2561
2561
  `+B;if(z<=0&&U>=Q)break}G.push(K),G.push(`module.exports.${W} = ${W};`),Q=U+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 CK(G.join(`
2562
2562
  `),Z,J)}function CK($,X,Z){let J=$.length,Y="",G=0,Q=null,w=!1,q=!1,W=0;while(G<J){let K=$[G],z=$[G+1];if(w){if(Y+=K,K===`
2563
2563
  `)w=!1;G++;continue}if(q){if(Y+=K,K==="*"&&z==="/"){Y+=z,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){w=!0,Y+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){q=!0,Y+=K,G++;continue}if(Q){if(Y+=K,K==="\\"){Y+=z,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&z==="{"){W++,Y+=z,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){Q=K,Y+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=PK($,G);if(U){let{quote:B,path:j,end:_}=U;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?C1.resolve(X,j):C1.resolve(Z,j.slice(2));Y+=`await import(${B}${H}${B})`,G=_;continue}}}Y+=K,G++}return Y}function PK($,X){let Z=X+5;if(Z>=$.length)return null;if(!/\s/.test($[Z]))return null;while(Z<$.length&&/\s/.test($[Z]))Z++;if(!$.startsWith("import",Z))return null;Z+=6;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=Z;while(Z<$.length&&$[Z]!==J)if($[Z]==="\\")Z+=2;else Z++;if(Z>=$.length)return null;let G=$.slice(Y,Z);Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return{quote:J,path:G,end:Z+1}}function JZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=E0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function YZ($){let X=[],Z=$.slice(1,-1).trim();if(!Z)return X;let J=0,Y=0,G="";while(J<Z.length){let Q=Z[J];if(Q==="{"||Q==="["){let w=Y===0?JZ(Z,J):null;if(w){X.push(...YZ(w.pattern)),J=w.endPos,G="";continue}Y++}else if(Q==="}"||Q==="]")Y--;if(Y>0){J++;continue}if(Q===","){if(G.trim())X.push(G.trim());G="",J++;continue}if(Q===":"){G="",J++;continue}if(Q==="="){if(G.trim())X.push(G.trim());G="",J++;while(J<Z.length&&Z[J]!==","&&Y===0){if(Z[J]==="{"||Z[J]==="[")Y++;else if(Z[J]==="}"||Z[J]==="]")Y--;J++}continue}if(/[\w$]/.test(Q))G+=Q;J++}if(G.trim())X.push(G.trim());return X}function GZ($){let X=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!X)return null;let Z=X[0].length,J=(Y)=>Y===" "||Y==="\t";while(Z<$.length&&J($[Z]))Z++;if($[Z]===":"){let Y=0,G=null;Z++;for(;Z<$.length;Z++){let Q=$[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==="<"){Y++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){Y--;continue}if(Q==="="&&Y<=0){let w=$[Z+1],q=$[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Z]!=="=")return null}while(Z<$.length&&J($[Z]))Z++;if($[Z]!=="=")return null;return{type:X[1],name:X[2],value:$.slice(Z+1).trim()}}function r6($,X,Z,J){let Y=null,G=!1;for(let Q of $){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(Y){if(Q===Y)Y=null;continue}if(Q==="'"||Q==='"'||Q==="`"){Y=Q;continue}if(Q===X)J++;else if(Q===Z)J--}return J}function o6($,X){let Z=$[X].trim(),J=GZ(Z),Y=J?[Z,J.type,J.name,J.value]:null;if(!Y){let K=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=Z.slice(K[0].length),U=X;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",H=r6(z,j,_,0),L=z;for(let O=X+1;O<$.length&&H>0;O++)L+=` ${$[O].trim()}`,U=O,H=r6($[O],j,_,H);if(H>0)L=z,U=X;z=L}let B=JZ(z,0);if(B){let j=K[1],_=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(U,X);if(s6(L)){let N=a6($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=YZ(_),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
@@ -2566,7 +2566,7 @@ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}l
2566
2566
  ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function KX($,X){let Z=$[X].trim(),J=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Z}`);let[,Y]=J,G=Z.replace(/^export\s+/,""),Q=X;if(vK(Z)){let w=xK($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function s6($){let X=$.trim();if(X.startsWith("{"))return E0(X,"{","}",0)===-1;if(X.startsWith("["))return E0(X,"[","]",0)===-1;return!QZ(X)}function QZ($){let X={paren:0,bracket:0,brace:0},Z=null,J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if((Y>0?$[Y-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==="`"&&J===0){Z=null;continue}if(Z==="`"&&G==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&G==="{"){J++;continue}if(J>0&&G==="}"){J--;continue}if(Z)continue;if(G==="(")X.paren++;else if(G===")")X.paren--;else if(G==="[")X.bracket++;else if(G==="]")X.bracket--;else if(G==="{")X.brace++;else if(G==="}")X.brace--}return X.paren===0&&X.bracket===0&&X.brace===0&&Z===null}function wZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=E0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function vK($){let X=wZ($);if(X===-1)return!0;return E0($,"{","}",X)===-1}function a6($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!QZ(J)){let G=$[Y];J+=`
2567
2567
  ${G}`,Y++}while(Y<$.length){let G=$[Y].trim();if(G.startsWith(".")||G.startsWith("?."))J+=`
2568
2568
  ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function xK($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=wZ(J);if(G!==-1){if(E0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2569
- ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function t6($,X){let Z=J0($,X)??J0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let J={...X,process:Object.freeze({env:{...y5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function fK($,X,Z){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of J){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=t6(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of Y){let[,,Q,w]=G;if(!(Q in X))try{let q=w.trim().replace(/;$/,""),W=t6(q,X);if(W!==void 0)X[Q]=W}catch{}}}function qZ($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",J=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:J}}function WZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var zX,n6,yK,SK;var v7=D(()=>{P7();E1();T0();zX=["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"],n6=new Set(zX),yK=new Set(["stx","@stacksjs/stx"]);SK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var jX={};a(jX,{renderSlot:()=>zZ,processSlots:()=>jZ,parseSlots:()=>KZ,parseSlotElement:()=>mK,extractSlotContent:()=>pK,applySlots:()=>iK});function gK($,X){let Z=1,J=X,Y="<template",G="</template";while(J<$.length&&Z>0){let Q=$.indexOf("<",J);if(Q===-1)break;if(J=Q,$.startsWith(Y,J)&&(J+Y.length>=$.length||/[\s>\/]/.test($[J+Y.length]))){Z++,J+=Y.length;continue}if($.startsWith(G,J)){let w=$.indexOf(">",J+G.length);if(w!==-1){if(Z--,Z===0)return w+1;J=w+1;continue}}J++}return Z===0?J:-1}function uK($,X){let Z=null;for(let J=X;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"){Z=Y;continue}if(Y===">")return J+1}return-1}function dK($){let X=[],Z=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);Y=U===-1?$.length:U+3;continue}let Q=uK($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Y=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);Y=Q;continue}if(K==="template"&&Z.length===0){let U=w.match(J);if(U){let B=gK($,Q);if(B!==-1){let j=U[1]||U[2]||U[3];X.push({start:G,end:B,slotName:j,content:$.slice(Q,B-11).trim(),propsBinding:U[4]||void 0}),Y=B;continue}}}if(!/\/\s*>$/.test(w)&&!hK.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){Y=U;continue}}}Y=Q}return X}function KZ($){let X={default:"",named:new Map},Z=$,J=dK($);for(let q of J)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,W)=>W.start-q.start);for(let q of J)Z=Z.slice(0,q.start)+Z.slice(q.end);let Y=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,K,z,U,B]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""}>${B}</${W}>`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:L})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,K,z,U]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${W}${_?" "+_:""} />`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}Y.sort((q,W)=>W.start-q.start);for(let q of Y){let W=X.named.get(q.slotName);if(W)W.content+=q.element;else X.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return X.default=Z.trim(),X}function mK($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",J={},Y=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=Y.exec($))!==null)J[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:J,defaultContent:w}}async function zZ($,X,Z,J){if(!$)return Z;let Y=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...J};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,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;Y=lK(Y,Q)}return Y}function lK($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=UZ(Y,X);return a0(String(G??""))}catch{return`{{ ${J} }}`}})}function UZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Y=X;for(let G of J)if(Y&&typeof Y==="object"&&G in Y)Y=Y[G];else return;return Y}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,J,Y,G]=Z,Q=X[J],w=parseInt(G,10);if(typeof Q==="number")switch(Y){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0($))return;return W0($,Object.keys(X))(...Object.values(X))}catch{return}}async function jZ($,X,Z){let J=$;J=await cK(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let K=X.named.get(w),z=W?.trim()||"",U=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(U))!==null){let H=_[1],L=_[2];B[H]=UZ(L,Z)}return await zZ(K,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return X.default||q}),J}async function cK($,X,Z){let J=[],Y=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return Y.push({match:w,index:W}),J.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(J),Q=$;for(let w=Y.length-1;w>=0;w--){let{match:q,index:W}=Y[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function pK($){let X=KZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function iK($,X,Z,J){return await jZ($,{default:X,named:Z},J)}var hK;var BX=D(()=>{q1();T0();hK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,X){let Z=nK($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function nK($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=E0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function rK($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function t1($,X,Z,J){let Y=1,G=J,Q=new RegExp(`@${X}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&Y>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec($),W=w.exec($),K=q?q.index:1/0,z=W?W.index:1/0;if(K<z)Y++,G=K+q[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+W[0].length}else break}return-1}function BZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=P1($,J);if(!Y)return null;let G=Y.endPos,Q=t1($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=Y.expression,U=0,B=0;while(W<w.length){let j=w.indexOf("@",W);if(j===-1)break;W=j;let _=w.substring(j);if(rK(w,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W});let L=W+H[0].length,O=P1(w,L);if(!O){W++;continue}K="elseif",z=O.expression,W=O.endPos,U=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W}),K="else",z=void 0,W+=5,U=W;continue}}W++}return q.push({type:K,condition:z,content:w.slice(U),start:G+U,end:G+w.length}),{fullMatch:$.slice(X,Q+6),branches:q,start:X,end:Q+6}}function x7($){let X=[],Z=/@if\s*\(/g,J=Z.exec($);while(J!==null){if(X.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Z.exec($);continue}let G=BZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function x8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((_)=>G.index>_.start&&G.index<_.end)){G=Y.exec($);continue}let w=G.index,q=w+G[0].length-1,W=E0($,"(",")",q);if(W===-1){G=Y.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=t1($,X,Z,z);if(U===-1){G=Y.exec($);continue}let B=$.slice(z,U),j=U+`@${Z}`.length;J.push({fullMatch:$.slice(w,j),name:X,params:K,content:B,start:w,end:j}),Y.lastIndex=j,G=Y.exec($)}return J}function _X($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=P1($,J);if(!Y)return null;let G=Y.endPos,Q=t1($,"switch","endswitch",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K=null,z=0;while(W<w.length){let U=w.slice(W),B=U.match(/^@switch\s*\(/),j=U.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=w[W];W++;continue}let _=U.match(/^@case\s*/),H=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(_&&U.startsWith("@case")){if(K)q.push(K);let O=W+_[0].length,F=P1(w,O);if(!F){W++;continue}K={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&U.startsWith("@default")){if(K)q.push(K);K={type:"default",content:""},W+=H[0].length}else if(L&&U.startsWith("@break"))W+=L[0].length;else{if(K)K.content+=w[W];W++}}if(K)q.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:q,start:X,end:Q+10}}var _Z=()=>{};var HZ=()=>{};var f8=D(()=>{_Z();HZ()});async function LZ($){let X=$;if(!X)try{X=(await t0())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=OZ.get(Z);if(J)return J;let Y=[];try{Y=_7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return OZ.set(Z,Y),Y}var OZ;var FZ=D(()=>{x9();O1();OZ=new Map});function tK($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function VZ($){return tK(JSON.stringify($))}function f7($){let X=0,Z,J=HX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)AZ.lastIndex=X,Z=AZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let q=0;q<HX.length;q++){let W=HX[q],K=J[q];if(K===void 0||K!==null&&K.index<X)W.open.lastIndex=X,K=W.open.exec($),J[q]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=W.close}if(G===-1||!Q)return{index:Y,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec($);if(!w)return null;X=w.index+w[0].length}return null}function g8($,X){let Z=f7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var HX,AZ;var OX=D(()=>{HX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],AZ=/<body\b([^>]*)>/gi});function FX(){return e1}function VX($){let X=e1;return RZ.push($),e1=$,X}function AX($){RZ.pop(),e1=$}function RX(){return h8>0}function NX($){LX.add($)}function NZ($){h8++;try{$()}finally{if(h8--,h8===0){let X=[...LX];LX.clear();for(let Z of X)Z()}}}function TZ($){let X=e1;e1=null;try{return $()}finally{e1=X}}var e1=null,RZ,h8=0,LX;var MZ=D(()=>{RZ=[],LX=new Set});function v1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=FX();if(G)J.add(G);return X};return Y.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((w)=>w(X,Q)),RX())J.forEach((w)=>NX(w));else J.forEach((w)=>w())}},Y.update=(G)=>{Y.set(G(X))},Y.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(Y,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Y,"value",{get:()=>Y(),set:(G)=>Y.set(G),configurable:!0}),Y}function d8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,RX())J.forEach((Q)=>NX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=FX();if(Q)J.add(Q);if(Z){let w=VX(Y);try{X=$()}finally{AX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function m8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=VX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{AX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function MX($){NZ($)}function kX($){TX.push($)}function IX($){u8.push($)}function eK(){kZ(TX,"onMount",u8)}function $z(){kZ(u8,"onDestroy")}function kZ($,X,Z){let J=$.splice(0,$.length);for(let Y of J)try{let G=Y();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function Xz(){return{mount:TX.length,destroy:u8.length}}function l8($){return typeof $==="function"&&$._isSignal===!0}function c8($){return typeof $==="function"&&$._isDerived===!0}function EX($){if(l8($)||c8($))return $();return $}function p8($){return TZ($)}function Zz($,X){let Z=typeof $==="function"?$:()=>$,J=v1([]),Y=d8(()=>J().reduce((w,q)=>X(w,q.action),Z())),G=!1;return m8(()=>{if(Z(),!G){G=!0;return}if(p8(()=>J().length))J.set([])}),[Y,(w,q)=>{let W={action:w};J.set([...J(),W]);let K=()=>{let z=J().filter((U)=>U!==W);if(z.length!==J().length)J.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var TX,u8;var i8=D(()=>{MZ();TX=[],u8=[]});var EZ={};a(EZ,{useOptimistic:()=>Zz,untrack:()=>EX,state:()=>v1,runMountCallbacks:()=>eK,runDestroyCallbacks:()=>$z,pendingLifecycleCounts:()=>Xz,peek:()=>p8,onMount:()=>kX,onDestroy:()=>IX,isSignal:()=>l8,isDerived:()=>c8,generateSignalsRuntimeDev:()=>DX,generateSignalsRuntime:()=>IZ,effect:()=>m8,derived:()=>d8,default:()=>Yz,batch:()=>MX});function IZ(){let $=Jz(DX());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return $}}function Jz($){let X=[],Z=0,J="console.log(";while(Z<$.length){let Y=$.indexOf(J,Z);if(Y===-1){X.push($.slice(Z));break}X.push($.slice(Z,Y));let G=1,Q=Y+J.length;while(Q<$.length&&G>0){let w=$[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<$.length&&$[Q]!==q){if($[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function DX(){return`
2569
+ ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function t6($,X){let Z=J0($,X)??J0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let J={...X,process:Object.freeze({env:{...y5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function fK($,X,Z){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of J){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=t6(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of Y){let[,,Q,w]=G;if(!(Q in X))try{let q=w.trim().replace(/;$/,""),W=t6(q,X);if(W!==void 0)X[Q]=W}catch{}}}function qZ($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",J=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:J}}function WZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var zX,n6,yK,SK;var v7=D(()=>{P7();E1();T0();zX=["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"],n6=new Set(zX),yK=new Set(["stx","@stacksjs/stx"]);SK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var jX={};a(jX,{renderSlot:()=>zZ,processSlots:()=>jZ,parseSlots:()=>KZ,parseSlotElement:()=>mK,extractSlotContent:()=>pK,applySlots:()=>iK});function gK($,X){let Z=1,J=X,Y="<template",G="</template";while(J<$.length&&Z>0){let Q=$.indexOf("<",J);if(Q===-1)break;if(J=Q,$.startsWith(Y,J)&&(J+Y.length>=$.length||/[\s>\/]/.test($[J+Y.length]))){Z++,J+=Y.length;continue}if($.startsWith(G,J)){let w=$.indexOf(">",J+G.length);if(w!==-1){if(Z--,Z===0)return w+1;J=w+1;continue}}J++}return Z===0?J:-1}function uK($,X){let Z=null;for(let J=X;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"){Z=Y;continue}if(Y===">")return J+1}return-1}function dK($){let X=[],Z=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);Y=U===-1?$.length:U+3;continue}let Q=uK($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Y=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);Y=Q;continue}if(K==="template"&&Z.length===0){let U=w.match(J);if(U){let B=gK($,Q);if(B!==-1){let j=U[1]||U[2]||U[3];X.push({start:G,end:B,slotName:j,content:$.slice(Q,B-11).trim(),propsBinding:U[4]||void 0}),Y=B;continue}}}if(!/\/\s*>$/.test(w)&&!hK.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){Y=U;continue}}}Y=Q}return X}function KZ($){let X={default:"",named:new Map},Z=$,J=dK($);for(let q of J)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,W)=>W.start-q.start);for(let q of J)Z=Z.slice(0,q.start)+Z.slice(q.end);let Y=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,K,z,U,B]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""}>${B}</${W}>`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:L})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,K,z,U]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${W}${_?" "+_:""} />`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}Y.sort((q,W)=>W.start-q.start);for(let q of Y){let W=X.named.get(q.slotName);if(W)W.content+=q.element;else X.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return X.default=Z.trim(),X}function mK($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",J={},Y=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=Y.exec($))!==null)J[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:J,defaultContent:w}}async function zZ($,X,Z,J){if(!$)return Z;let Y=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...J};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,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;Y=lK(Y,Q)}return Y}function lK($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=UZ(Y,X);return a0(String(G??""))}catch{return`{{ ${J} }}`}})}function UZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Y=X;for(let G of J)if(Y&&typeof Y==="object"&&G in Y)Y=Y[G];else return;return Y}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,J,Y,G]=Z,Q=X[J],w=parseInt(G,10);if(typeof Q==="number")switch(Y){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0($))return;return W0($,Object.keys(X))(...Object.values(X))}catch{return}}async function jZ($,X,Z){let J=$;J=await cK(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let K=X.named.get(w),z=W?.trim()||"",U=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(U))!==null){let H=_[1],L=_[2];B[H]=UZ(L,Z)}return await zZ(K,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return X.default||q}),J}async function cK($,X,Z){let J=[],Y=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return Y.push({match:w,index:W}),J.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(J),Q=$;for(let w=Y.length-1;w>=0;w--){let{match:q,index:W}=Y[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function pK($){let X=KZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function iK($,X,Z,J){return await jZ($,{default:X,named:Z},J)}var hK;var BX=D(()=>{W1();T0();hK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,X){let Z=nK($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function nK($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=E0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function rK($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function t1($,X,Z,J){let Y=1,G=J,Q=new RegExp(`@${X}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&Y>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec($),W=w.exec($),K=q?q.index:1/0,z=W?W.index:1/0;if(K<z)Y++,G=K+q[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+W[0].length}else break}return-1}function BZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=P1($,J);if(!Y)return null;let G=Y.endPos,Q=t1($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=Y.expression,U=0,B=0;while(W<w.length){let j=w.indexOf("@",W);if(j===-1)break;W=j;let _=w.substring(j);if(rK(w,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W});let L=W+H[0].length,O=P1(w,L);if(!O){W++;continue}K="elseif",z=O.expression,W=O.endPos,U=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W}),K="else",z=void 0,W+=5,U=W;continue}}W++}return q.push({type:K,condition:z,content:w.slice(U),start:G+U,end:G+w.length}),{fullMatch:$.slice(X,Q+6),branches:q,start:X,end:Q+6}}function x7($){let X=[],Z=/@if\s*\(/g,J=Z.exec($);while(J!==null){if(X.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Z.exec($);continue}let G=BZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function x8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((_)=>G.index>_.start&&G.index<_.end)){G=Y.exec($);continue}let w=G.index,q=w+G[0].length-1,W=E0($,"(",")",q);if(W===-1){G=Y.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=t1($,X,Z,z);if(U===-1){G=Y.exec($);continue}let B=$.slice(z,U),j=U+`@${Z}`.length;J.push({fullMatch:$.slice(w,j),name:X,params:K,content:B,start:w,end:j}),Y.lastIndex=j,G=Y.exec($)}return J}function _X($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=P1($,J);if(!Y)return null;let G=Y.endPos,Q=t1($,"switch","endswitch",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K=null,z=0;while(W<w.length){let U=w.slice(W),B=U.match(/^@switch\s*\(/),j=U.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=w[W];W++;continue}let _=U.match(/^@case\s*/),H=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(_&&U.startsWith("@case")){if(K)q.push(K);let O=W+_[0].length,F=P1(w,O);if(!F){W++;continue}K={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&U.startsWith("@default")){if(K)q.push(K);K={type:"default",content:""},W+=H[0].length}else if(L&&U.startsWith("@break"))W+=L[0].length;else{if(K)K.content+=w[W];W++}}if(K)q.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:q,start:X,end:Q+10}}var _Z=()=>{};var HZ=()=>{};var f8=D(()=>{_Z();HZ()});async function LZ($){let X=$;if(!X)try{X=(await t0())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=OZ.get(Z);if(J)return J;let Y=[];try{Y=_7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return OZ.set(Z,Y),Y}var OZ;var FZ=D(()=>{x9();L1();OZ=new Map});function tK($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function VZ($){return tK(JSON.stringify($))}function f7($){let X=0,Z,J=HX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)AZ.lastIndex=X,Z=AZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let q=0;q<HX.length;q++){let W=HX[q],K=J[q];if(K===void 0||K!==null&&K.index<X)W.open.lastIndex=X,K=W.open.exec($),J[q]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=W.close}if(G===-1||!Q)return{index:Y,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec($);if(!w)return null;X=w.index+w[0].length}return null}function g8($,X){let Z=f7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var HX,AZ;var OX=D(()=>{HX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],AZ=/<body\b([^>]*)>/gi});function FX(){return e1}function VX($){let X=e1;return RZ.push($),e1=$,X}function AX($){RZ.pop(),e1=$}function RX(){return h8>0}function NX($){LX.add($)}function NZ($){h8++;try{$()}finally{if(h8--,h8===0){let X=[...LX];LX.clear();for(let Z of X)Z()}}}function TZ($){let X=e1;e1=null;try{return $()}finally{e1=X}}var e1=null,RZ,h8=0,LX;var MZ=D(()=>{RZ=[],LX=new Set});function v1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=FX();if(G)J.add(G);return X};return Y.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((w)=>w(X,Q)),RX())J.forEach((w)=>NX(w));else J.forEach((w)=>w())}},Y.update=(G)=>{Y.set(G(X))},Y.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(Y,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Y,"value",{get:()=>Y(),set:(G)=>Y.set(G),configurable:!0}),Y}function d8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,RX())J.forEach((Q)=>NX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=FX();if(Q)J.add(Q);if(Z){let w=VX(Y);try{X=$()}finally{AX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function m8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=VX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{AX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function MX($){NZ($)}function kX($){TX.push($)}function IX($){u8.push($)}function eK(){kZ(TX,"onMount",u8)}function $z(){kZ(u8,"onDestroy")}function kZ($,X,Z){let J=$.splice(0,$.length);for(let Y of J)try{let G=Y();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function Xz(){return{mount:TX.length,destroy:u8.length}}function l8($){return typeof $==="function"&&$._isSignal===!0}function c8($){return typeof $==="function"&&$._isDerived===!0}function EX($){if(l8($)||c8($))return $();return $}function p8($){return TZ($)}function Zz($,X){let Z=typeof $==="function"?$:()=>$,J=v1([]),Y=d8(()=>J().reduce((w,q)=>X(w,q.action),Z())),G=!1;return m8(()=>{if(Z(),!G){G=!0;return}if(p8(()=>J().length))J.set([])}),[Y,(w,q)=>{let W={action:w};J.set([...J(),W]);let K=()=>{let z=J().filter((U)=>U!==W);if(z.length!==J().length)J.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var TX,u8;var i8=D(()=>{MZ();TX=[],u8=[]});var EZ={};a(EZ,{useOptimistic:()=>Zz,untrack:()=>EX,state:()=>v1,runMountCallbacks:()=>eK,runDestroyCallbacks:()=>$z,pendingLifecycleCounts:()=>Xz,peek:()=>p8,onMount:()=>kX,onDestroy:()=>IX,isSignal:()=>l8,isDerived:()=>c8,generateSignalsRuntimeDev:()=>DX,generateSignalsRuntime:()=>IZ,effect:()=>m8,derived:()=>d8,default:()=>Yz,batch:()=>MX});function IZ(){let $=Jz(DX());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return $}}function Jz($){let X=[],Z=0,J="console.log(";while(Z<$.length){let Y=$.indexOf(J,Z);if(Y===-1){X.push($.slice(Z));break}X.push($.slice(Z,Y));let G=1,Q=Y+J.length;while(Q<$.length&&G>0){let w=$[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<$.length&&$[Q]!==q){if($[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function DX(){return`
2570
2570
  // STX Signals Runtime (Development Build)
2571
2571
  console.log('[stx] signals runtime loading');
2572
2572
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -8154,6 +8154,36 @@ catch (e) {} }
8154
8154
  }, 300);
8155
8155
  }
8156
8156
 
8157
+ /*
8158
+ * Is the APP in dark mode, not just the OS?
8159
+ *
8160
+ * stx's own color-mode boot writes a class (default 'dark') and/or an
8161
+ * attribute (data-theme / data-color-mode) onto <html>, so an app pinned to
8162
+ * light on a dark OS must not get a dark overlay over a light page. An
8163
+ * explicit override wins over both, and the media query is the last resort.
8164
+ *
8165
+ * One function rather than the resolution inlined per surface. #1875 fixed
8166
+ * this at the two dialog call sites, and toast kept the OS-only version and
8167
+ * shipped the exact bug #1875 describes; that is what a per-call-site fix
8168
+ * costs. See #1912.
8169
+ */
8170
+ function _resolveDark(override) {
8171
+ if (override != null)
8172
+ return !!override;
8173
+
8174
+ var root = document.documentElement;
8175
+ if (root.classList.contains('dark'))
8176
+ return true;
8177
+
8178
+ var attr = root.getAttribute('data-theme') || root.getAttribute('data-color-mode');
8179
+ if (attr === 'dark')
8180
+ return true;
8181
+ if (attr === 'light')
8182
+ return false;
8183
+
8184
+ return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
8185
+ }
8186
+
8157
8187
  function addToast(type, message, options) {
8158
8188
  var container = _getToastContainer();
8159
8189
  if (!container) {
@@ -8165,6 +8195,26 @@ catch (e) {} }
8165
8195
  var id = ++_toastId;
8166
8196
  var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);
8167
8197
 
8198
+ /*
8199
+ * A semantic id replaces its own toast in place (stacksjs/stx#1913).
8200
+ *
8201
+ * Without it, a persistent 'Publishing...' toast and the call that clears
8202
+ * it on completion have to thread the numeric return value between two
8203
+ * different functions by hand, which is the state management the primitive
8204
+ * exists to remove. With an id of 'publish' the second call simply replaces
8205
+ * the first, and toast.dismiss('publish') ends it.
8206
+ */
8207
+ var key = opts.id != null ? String(opts.id) : '';
8208
+ if (key) {
8209
+ var prior = container.querySelector('[data-stx-toast-key="' + key.replace(/"/g, '') + '"]');
8210
+ // Removed outright rather than through removeToast, which animates for
8211
+ // 300ms first. This is a REPLACEMENT, not a dismissal: animating the old
8212
+ // one out while the new one animates in shows both at once, in the same
8213
+ // slot, which is exactly the flicker a keyed toast exists to avoid.
8214
+ if (prior && prior.parentNode)
8215
+ prior.parentNode.removeChild(prior);
8216
+ }
8217
+
8168
8218
  // Enforce max toasts \u2014 remove oldest
8169
8219
  var existing = container.querySelectorAll('[data-stx-toast]');
8170
8220
  while (existing.length >= maxToasts && existing.length > 0) {
@@ -8176,7 +8226,7 @@ catch (e) {} }
8176
8226
  var anims = _getToastAnimClass(container);
8177
8227
  var borderColor = _toastColors[type] || _toastColors.info;
8178
8228
  var icon = _toastIcons[type] || _toastIcons.info;
8179
- var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
8229
+ var isDark = _resolveDark(opts.dark);
8180
8230
  var bg = isDark ? '#1f2937' : '#ffffff';
8181
8231
  var textColor = isDark ? '#f3f4f6' : '#1f2937';
8182
8232
  var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';
@@ -8184,6 +8234,8 @@ catch (e) {} }
8184
8234
  var el = document.createElement('div');
8185
8235
  el.id = 'stx-toast-' + id;
8186
8236
  el.setAttribute('data-stx-toast', String(id));
8237
+ if (key)
8238
+ el.setAttribute('data-stx-toast-key', key);
8187
8239
  el.setAttribute('role', 'alert');
8188
8240
  el.setAttribute('aria-live', 'assertive');
8189
8241
  el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';
@@ -8192,9 +8244,32 @@ catch (e) {} }
8192
8244
  iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';
8193
8245
  iconSpan.innerHTML = icon;
8194
8246
 
8195
- var msgSpan = document.createElement('span');
8247
+ /*
8248
+ * Title above message, when one is given (#1913).
8249
+ *
8250
+ * Collapsing the two into one string loses the hierarchy that makes a toast
8251
+ * scannable, and every one of the 16 call sites in the reporting app passed
8252
+ * a title. A wrapper is used only when there IS a title, so the untitled
8253
+ * shape renders exactly as it did.
8254
+ */
8255
+ var msgSpan = document.createElement(opts.title ? 'div' : 'span');
8196
8256
  msgSpan.style.cssText = 'flex:1;word-wrap:break-word';
8197
- msgSpan.textContent = message;
8257
+
8258
+ if (opts.title) {
8259
+ var titleEl = document.createElement('div');
8260
+ titleEl.setAttribute('data-stx-toast-title', '');
8261
+ titleEl.style.cssText = 'font-weight:600;margin-bottom:0.125rem';
8262
+ titleEl.textContent = opts.title;
8263
+ msgSpan.appendChild(titleEl);
8264
+
8265
+ var bodyEl = document.createElement('div');
8266
+ bodyEl.style.cssText = 'opacity:0.9';
8267
+ bodyEl.textContent = message;
8268
+ msgSpan.appendChild(bodyEl);
8269
+ }
8270
+ else {
8271
+ msgSpan.textContent = message;
8272
+ }
8198
8273
 
8199
8274
  var closeBtn = document.createElement('button');
8200
8275
  closeBtn.type = 'button';
@@ -8221,7 +8296,20 @@ catch (e) {} }
8221
8296
  info: function(message, options) { return addToast('info', message, options); },
8222
8297
  warning: function(message, options) { return addToast('warning', message, options); },
8223
8298
  dismiss: function(id) {
8224
- if (id !== undefined) { removeToast(id); return; }
8299
+ if (id !== undefined) {
8300
+ // A string id is the semantic key the caller passed; a number is the
8301
+ // handle addToast returned. Both dismiss, so a caller does not have to
8302
+ // know which kind it is holding (#1913).
8303
+ if (typeof id === 'string') {
8304
+ var c = _getToastContainer();
8305
+ var match = c && c.querySelector('[data-stx-toast-key="' + id.replace(/"/g, '') + '"]');
8306
+ if (match)
8307
+ removeToast(match.getAttribute('data-stx-toast'));
8308
+ return;
8309
+ }
8310
+ removeToast(id);
8311
+ return;
8312
+ }
8225
8313
  var container = _getToastContainer();
8226
8314
  if (!container) return;
8227
8315
  var all = container.querySelectorAll('[data-stx-toast]');
@@ -8299,17 +8387,7 @@ catch (e) {} }
8299
8387
  // (e.g. data-theme) onto <html>, so an app pinned to light on a dark OS used
8300
8388
  // to get a dark dialog over a light page. An explicit opts.dark wins over
8301
8389
  // both, and the media query stays as the last resort. See #1875.
8302
- var _root = document.documentElement;
8303
- var _attrTheme = _root.getAttribute('data-theme') || _root.getAttribute('data-color-mode');
8304
- var isDark = opts.dark != null
8305
- ? !!opts.dark
8306
- : _root.classList.contains('dark')
8307
- ? true
8308
- : _attrTheme === 'dark'
8309
- ? true
8310
- : _attrTheme === 'light'
8311
- ? false
8312
- : !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
8390
+ var isDark = _resolveDark(opts.dark);
8313
8391
  var bg = isDark ? '#1f2937' : '#ffffff';
8314
8392
  var textColor = isDark ? '#f3f4f6' : '#1f2937';
8315
8393
  var subColor = isDark ? '#9ca3af' : '#6b7280';
@@ -10327,7 +10405,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
10327
10405
  }
10328
10406
  }
10329
10407
  })();
10330
- `}var Yz;var DZ=D(()=>{i8();Q1();i8();Yz={state:v1,derived:d8,effect:m8,batch:MX,onMount:kX,onDestroy:IX,isSignal:l8,isDerived:c8,untrack:EX,peek:p8,generateSignalsRuntime:IZ,generateSignalsRuntimeDev:DX}});var yX={};a(yX,{templateCache:()=>yZ,readFileCached:()=>Gz,invalidateFileCacheByDir:()=>wz,invalidateFileCache:()=>Qz,hashFilePath:()=>g7,getCachedSignalsRuntime:()=>Kz,getCachedRouterScript:()=>zz,clearDevCaches:()=>Uz,checkCache:()=>jz,cacheTemplate:()=>Bz,__setSignalsGeneratorsForTest:()=>Wz});import x1 from"fs";import b5 from"path";async function Gz($){let Z;for(let J=0;J<3;J++)try{let G=(await x1.promises.stat($)).mtime.getTime(),Q=$5.get($);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file($).text(),W=(await x1.promises.stat($)).mtime.getTime();if(W!==G)continue;return $5.set($,{content:w,mtime:W}),w}catch(Y){Z=Y;break}throw $5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Qz($){$5.delete($)}function wz($){for(let X of $5.keys())if(X.startsWith($))$5.delete(X)}function Wz($){bZ=$}async function Kz($=!1){let X=bZ??await Promise.resolve().then(() => (DZ(),EZ));if($)return X.generateSignalsRuntimeDev();if(n8===null)n8=X.generateSignalsRuntime();return n8}async function zz(){if(r8===null){let{getRouterScript:$}=await Promise.resolve().then(() => (M1(),F2));r8=$()}return r8}function Uz(){$5.clear(),CZ(),n8=null,qz=null,r8=null}function SZ($){let X={debug:$.debug===!0,middleware:($.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:($.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(X)).digest("hex")}async function jz($,X){try{if(!X.cachePath)return null;let Z=b5.resolve(X.cachePath),J=b5.join(Z,`${g7($)}.html`),Y=b5.join(Z,`${g7($)}.meta.json`);if(!await p(J)||!await p(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==SZ(X))return null;if((await x1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await p(q)){if((await x1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function Bz($,X,Z,J){try{if(!J.cachePath)return;let Y=b5.resolve(J.cachePath);await x1.promises.mkdir(Y,{recursive:!0});let G=b5.join(Y,`${g7($)}.html`),Q=b5.join(Y,`${g7($)}.meta.json`),w=await x1.promises.stat($);await Bun.write(G,X);let q={sourcePath:$,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:SZ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),yZ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function g7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,_z)}var yZ,$5,n8=null,qz=null,bZ=null,r8=null,_z=16;var bX=D(()=>{k0();yZ=new Map,$5=new Map});function PZ($){return $.includes("data-stx-runtime")}function vZ($){let X=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=X.exec($);Z!==null;Z=X.exec($)){let J=$.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function SX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10408
+ `}var Yz;var DZ=D(()=>{i8();Q1();i8();Yz={state:v1,derived:d8,effect:m8,batch:MX,onMount:kX,onDestroy:IX,isSignal:l8,isDerived:c8,untrack:EX,peek:p8,generateSignalsRuntime:IZ,generateSignalsRuntimeDev:DX}});var yX={};a(yX,{templateCache:()=>yZ,readFileCached:()=>Gz,invalidateFileCacheByDir:()=>wz,invalidateFileCache:()=>Qz,hashFilePath:()=>g7,getCachedSignalsRuntime:()=>Kz,getCachedRouterScript:()=>zz,clearDevCaches:()=>Uz,checkCache:()=>jz,cacheTemplate:()=>Bz,__setSignalsGeneratorsForTest:()=>Wz});import x1 from"fs";import b5 from"path";async function Gz($){let Z;for(let J=0;J<3;J++)try{let G=(await x1.promises.stat($)).mtime.getTime(),Q=$5.get($);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file($).text(),W=(await x1.promises.stat($)).mtime.getTime();if(W!==G)continue;return $5.set($,{content:w,mtime:W}),w}catch(Y){Z=Y;break}throw $5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Qz($){$5.delete($)}function wz($){for(let X of $5.keys())if(X.startsWith($))$5.delete(X)}function Wz($){bZ=$}async function Kz($=!1){let X=bZ??await Promise.resolve().then(() => (DZ(),EZ));if($)return X.generateSignalsRuntimeDev();if(n8===null)n8=X.generateSignalsRuntime();return n8}async function zz(){if(r8===null){let{getRouterScript:$}=await Promise.resolve().then(() => (k1(),F2));r8=$()}return r8}function Uz(){$5.clear(),CZ(),n8=null,qz=null,r8=null}function SZ($){let X={debug:$.debug===!0,middleware:($.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:($.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(X)).digest("hex")}async function jz($,X){try{if(!X.cachePath)return null;let Z=b5.resolve(X.cachePath),J=b5.join(Z,`${g7($)}.html`),Y=b5.join(Z,`${g7($)}.meta.json`);if(!await p(J)||!await p(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==SZ(X))return null;if((await x1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await p(q)){if((await x1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function Bz($,X,Z,J){try{if(!J.cachePath)return;let Y=b5.resolve(J.cachePath);await x1.promises.mkdir(Y,{recursive:!0});let G=b5.join(Y,`${g7($)}.html`),Q=b5.join(Y,`${g7($)}.meta.json`),w=await x1.promises.stat($);await Bun.write(G,X);let q={sourcePath:$,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:SZ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),yZ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function g7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,_z)}var yZ,$5,n8=null,qz=null,bZ=null,r8=null,_z=16;var bX=D(()=>{k0();yZ=new Map,$5=new Map});function PZ($){return $.includes("data-stx-runtime")}function vZ($){let X=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=X.exec($);Z!==null;Z=X.exec($)){let J=$.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function SX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10331
10409
  `+$.slice(Z);let Y=/<head\b[^>]*>/i.exec($);if(Y){let Q=Y.index+Y[0].length;return`${$.slice(0,Q)}
10332
10410
  ${X}${$.slice(Q)}`}if($.includes("</head>")){let Q=$.indexOf("</head>");return $.slice(0,Q)+X+`
10333
10411
  `+$.slice(Q)}if(f7($))return g8($,(Q)=>`${Q}
@@ -10355,11 +10433,11 @@ if(window.stx)window.stx._latestSetup=${Q};
10355
10433
  ${Y.slice(K)}`;else if(z!==-1){let U=/<body[^>]*>/i.exec(Y.slice(z))[0],B=z+U.length;Y=`${Y.slice(0,B)}
10356
10434
  ${Q}${Y.slice(B)}`}else Y=`${Y}
10357
10435
  ${Q}`}let q=Y.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 K=/<body[^>]*>/i,z=t8(Y,K);if(z!==-1){let U=Y.slice(0,z),B=Y.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=U+B}}return Y}function t8($,X){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=Z.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let G=new RegExp(X.source,X.flags.replace(/[gy]/g,"")),Q=0;while(Q<$.length){let w=G.exec($.slice(Q));if(!w)return-1;let q=Q+w.index;if(!J.some(([K,z])=>q>=K&&q<z))return q;Q=q+Math.max(w[0].length,1)}return-1}function iZ($){let X=[];for(let Z of $.split(",")){let J=Z.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])X.push(`${Y[2]} = ${Y[1]}`)}if(X.length===0)return uZ;return`var ${X.join(", ")}; ${uZ}`}var Hz=0,xZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,dZ,gZ,PX,Nz,uZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var h7=D(()=>{E7();f8();Q1();n9();k0();s8();r1();A7();dZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;gZ=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"]);PX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Nz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import kz from"fs";import h from"path";function Ez($){let X=new WeakSet;try{let Z=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(X.has(J))throw TypeError("Circular component input");if(X.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Z);let Y={};for(let G of Object.keys(J).sort())Y[G]=Z(J[G]);return Y};return JSON.stringify(Z($))}catch{return null}}function nZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Dz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function i1($){return!Dz($)}function n1($){try{let X=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");X=X.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];X=X.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let Y=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}).transformSync(X);for(let G=0;G<Z.length;G++)Y=Y.replace(`"__STX_EXPR_${G}__"`,Z[G]),Y=Y.replace(`'__STX_EXPR_${G}__'`,Z[G]);return Y}catch(X){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",X);return $}}function yz($){let X=[],Z=new Set,J=0,Y=0,G=$.length,Q=(K)=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},w=()=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<G&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')Q($[Y]);else if($[Y]==="`")w();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<G&&$[Y]!==`
10358
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<G-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))X.push(_),Z.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Z.has(j))X.push(j),Z.add(j);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let j=U[1];if(!Z.has(j))X.push(j),Z.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))X.push(j),Z.add(j)}};while(Y<G){if(q())continue;if($[Y]==="'"||$[Y]==='"'){Q($[Y]);continue}if($[Y]==="`"){w();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return X}function bz($){let X=[],Z=0,J=0,Y=null;for(let G=0;G<$.length;G++){let Q=$[G];if(Y){if(Q==="\\"){G++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)X.push($.slice(J,G)),J=G+1}if(J<$.length)X.push($.slice(J));return X}function Sz($){let X=0,Z=null;for(let J=0;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Z=Y;continue}if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y==="="&&X===0){let G=$[J-1],Q=$[J+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return J}}return-1}function Cz($,X){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Z)return;let J=Z.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,G=0,Q=-1;for(;J>=0;J--){let q=$[J];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let w=$.slice(Q+1,Y);for(let q of bz(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=Sz(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=W.slice(K+1).trim();if(!U)continue;try{let B=Object.keys(X),j=Function(...B,`"use strict"; return (${U});`);X[z]=j(...B.map((_)=>X[_]))}catch{}}}catch{}}async function J$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.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`])],K=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=K??h.dirname(J),U=[],B=(H)=>{if(H&&!U.includes(H))U.push(H)},j=Z.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(X),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(K)B(h.resolve(K,"resources/views/components")),B(h.resolve(K,"resources/components")),B(h.resolve(K,"src/components")),B(h.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return p(h.resolve(h.dirname(J),`${G}.stx`));for(let H of U){let L=h.isAbsolute(H)?H:h.resolve(z,H);for(let O of W)if(await p(h.join(L,O)))return!0}return!1}function Pz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vz($){if(!$)return!1;let X=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(X)}function xz($){let X=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 J of $){let Y;while((Y=Z.exec(J))!==null)X.add(Y[1]);Z.lastIndex=0}return[...X]}async function X5($,X,Z,J,Y,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (v7(),v8))),K=w??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let U=typeof X.client==="string"?X.client.trim():"";if("client"in X)delete X.client;let B=U&&U!=="load"&&Pz(U)?U:"";try{let j=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let E=[H,H.toLowerCase(),j(H),_(H)];for(let v of E)if(O.has(v)){L=O.get(v);break}}let F=[];if(!L){let E=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],v=[...new Set(E)],m=Y.__originalFilePath,g=[];if(m){let B0=h.join(h.dirname(m),"components");g.push(B0)}if(J)g.push(J);let r=Q._rootComponentsDir;if(typeof r==="string"&&!g.includes(r))g.push(r);let Q0=h.join(h.dirname(G),"components");if(!g.includes(Q0))g.push(Q0);if(Q.componentsDir&&Q.componentsDir!==J&&!g.includes(Q.componentsDir))g.push(Q.componentsDir);let o0=Q._pluginComponentDirs;if(Array.isArray(o0)){for(let B0 of o0)if(typeof B0==="string"&&!g.includes(B0))g.push(B0)}let f0=typeof Q.root==="string"?h.resolve(Q.root):void 0,m0=f0??h.dirname(G),s0=[];if(f0)s0.push(h.resolve(f0,"resources/views/components")),s0.push(h.resolve(f0,"resources/components")),s0.push(h.resolve(f0,"src/components")),s0.push(h.resolve(f0,"components"));s0.push(h.resolve(import.meta.dir,"components"));for(let B0 of s0)if(!g.includes(B0))g.push(B0);let _5=[...new Set(g.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(m0,B0)}))];g.length=0,g.push(..._5);let N1=`${H}\x00${G}\x00${_5.join("\x00")}`,T1=Z$.get(N1);if(T1)if(await p(T1))L=T1;else Z$.delete(N1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=h.resolve(h.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let B0 of g){if(!B0)continue;for(let Y1 of v){let i=h.join(B0,Y1);if(F.push(i),await p(i)){L=i;break}}if(L)break;if(!L)try{let Y1=await import("fs");if(!Y1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let G1=8,l1=[{path:B0,depth:0}];while(l1.length>0&&!L){let j1=l1.pop();if(j1.depth>=G1)continue;let q8;try{q8=Y1.readdirSync(j1.path,{withFileTypes:!0})}catch{continue}for(let W8 of q8){if(!W8.isDirectory())continue;if(W8.name==="node_modules"||W8.name.startsWith("."))continue;let J2=h.join(j1.path,W8.name);for(let Eq of v){let H9=h.join(J2,Eq);if(F.push(H9),await p(H9)){L=H9;break}}if(L)break;l1.push({path:J2,depth:j1.depth+1})}}}catch{}if(L)break}if(L)Z$.set(N1,L)}if(!L||!await p(L)){let E=F.length>0?`
10436
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<G-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))X.push(_),Z.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Z.has(j))X.push(j),Z.add(j);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let j=U[1];if(!Z.has(j))X.push(j),Z.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))X.push(j),Z.add(j)}};while(Y<G){if(q())continue;if($[Y]==="'"||$[Y]==='"'){Q($[Y]);continue}if($[Y]==="`"){w();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return X}function bz($){let X=[],Z=0,J=0,Y=null;for(let G=0;G<$.length;G++){let Q=$[G];if(Y){if(Q==="\\"){G++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)X.push($.slice(J,G)),J=G+1}if(J<$.length)X.push($.slice(J));return X}function Sz($){let X=0,Z=null;for(let J=0;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Z=Y;continue}if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y==="="&&X===0){let G=$[J-1],Q=$[J+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return J}}return-1}function Cz($,X){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Z)return;let J=Z.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,G=0,Q=-1;for(;J>=0;J--){let q=$[J];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let w=$.slice(Q+1,Y);for(let q of bz(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=Sz(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=W.slice(K+1).trim();if(!U)continue;try{let B=Object.keys(X),j=Function(...B,`"use strict"; return (${U});`);X[z]=j(...B.map((_)=>X[_]))}catch{}}}catch{}}async function J$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.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`])],K=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=K??h.dirname(J),U=[],B=(H)=>{if(H&&!U.includes(H))U.push(H)},j=Z.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(X),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(K)B(h.resolve(K,"resources/views/components")),B(h.resolve(K,"resources/components")),B(h.resolve(K,"src/components")),B(h.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return p(h.resolve(h.dirname(J),`${G}.stx`));for(let H of U){let L=h.isAbsolute(H)?H:h.resolve(z,H);for(let O of W)if(await p(h.join(L,O)))return!0}return!1}function Pz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vz($){if(!$)return!1;let X=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(X)}function xz($){let X=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 J of $){let Y;while((Y=Z.exec(J))!==null)X.add(Y[1]);Z.lastIndex=0}return[...X]}async function X5($,X,Z,J,Y,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (v7(),v8))),K=w??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let U=typeof X.client==="string"?X.client.trim():"";if("client"in X)delete X.client;let B=U&&U!=="load"&&Pz(U)?U:"";try{let j=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let E=[H,H.toLowerCase(),j(H),_(H)];for(let v of E)if(O.has(v)){L=O.get(v);break}}let F=[];if(!L){let E=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],v=[...new Set(E)],m=Y.__originalFilePath,g=[];if(m){let B0=h.join(h.dirname(m),"components");g.push(B0)}if(J)g.push(J);let r=Q._rootComponentsDir;if(typeof r==="string"&&!g.includes(r))g.push(r);let Q0=h.join(h.dirname(G),"components");if(!g.includes(Q0))g.push(Q0);if(Q.componentsDir&&Q.componentsDir!==J&&!g.includes(Q.componentsDir))g.push(Q.componentsDir);let o0=Q._pluginComponentDirs;if(Array.isArray(o0)){for(let B0 of o0)if(typeof B0==="string"&&!g.includes(B0))g.push(B0)}let f0=typeof Q.root==="string"?h.resolve(Q.root):void 0,m0=f0??h.dirname(G),s0=[];if(f0)s0.push(h.resolve(f0,"resources/views/components")),s0.push(h.resolve(f0,"resources/components")),s0.push(h.resolve(f0,"src/components")),s0.push(h.resolve(f0,"components"));s0.push(h.resolve(import.meta.dir,"components"));for(let B0 of s0)if(!g.includes(B0))g.push(B0);let _5=[...new Set(g.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(m0,B0)}))];g.length=0,g.push(..._5);let T1=`${H}\x00${G}\x00${_5.join("\x00")}`,M1=Z$.get(T1);if(M1)if(await p(M1))L=M1;else Z$.delete(T1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=h.resolve(h.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let B0 of g){if(!B0)continue;for(let Y1 of v){let i=h.join(B0,Y1);if(F.push(i),await p(i)){L=i;break}}if(L)break;if(!L)try{let Y1=await import("fs");if(!Y1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let G1=8,l1=[{path:B0,depth:0}];while(l1.length>0&&!L){let B1=l1.pop();if(B1.depth>=G1)continue;let q8;try{q8=Y1.readdirSync(B1.path,{withFileTypes:!0})}catch{continue}for(let W8 of q8){if(!W8.isDirectory())continue;if(W8.name==="node_modules"||W8.name.startsWith("."))continue;let J2=h.join(B1.path,W8.name);for(let Eq of v){let H9=h.join(J2,Eq);if(F.push(H9),await p(H9)){L=H9;break}}if(L)break;l1.push({path:J2,depth:B1.depth+1})}}}catch{}if(L)break}if(L)Z$.set(T1,L)}if(!L||!await p(L)){let E=F.length>0?`
10359
10437
  Searched paths:
10360
10438
  ${F.map((v)=>` - ${v}`).join(`
10361
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(L);let V;if(X$.has(L))V=X$.get(L);else try{V=await Bun.file(L).text(),X$.set(L,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",k8]),R={};for(let[E,v]of Object.entries(Y))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:N}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),T=N(Z),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[E,v]of T.namedSlots)M[E]=v.content;let k={...R,...X,props:X,slot:Z,$slots:M,__processedComponents:z,__sections:{},__stx_signals_gate:L1(V)||vz(Z)};Cz(V,k);let y=V,I=S8(y);if(I)y=I.content.trim();let S=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...V.matchAll(S)],C=[],P=b.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&b.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,f=null;if(P){let E=Ez({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${L}\x00${E}`;let v=hX.get(x);if(v){for(let m of v.dependencies)q.add(m);return v.output}f=new Set(q)}}for(let E of b){let v=E[1]||"",m=E[2]||"",g=v.includes("server");if(i1(v)&&m.trim())m=n1(m);if(g&&m)try{await W(m,k,L)}catch(Q0){}if(!g){let Q0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),o0=Q0.includes("{{")&&Q0.includes("}}"),f0=Q0.includes("{!!")&&Q0.includes("!!}");if(o0||f0)Q0=y8(Q0,k);let m0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");C.push(`<script${m0}>${Q0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),$0=l?l[1]:"",C0=l?l[2]:"",U0="",A0=$0&&/\bscoped\b/i.test($0);if(l)U0=`<style${$0}>${C0}</style>`;let u=y;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(u=u.replace(E,(m,g)=>{let r=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(r)v.push(`<style${r[1]}>${r[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)U0=`${U0}${v.join(`
10362
- `)}`}if(Z&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:t}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),{defaultSlot:R0,namedSlots:P0}=T;u=await t(u,R0,P0,k);let j5=C.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),B5=xz(C);if(B5.length>0)k.__stx_client_signal_names=B5;let n={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:j5||C.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let s=await O0(u,k,L,n,q),K0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let E of s.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)Y.__stx_preserved_client_expressions=[...K0];let I0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++Iz}_${Math.random().toString(36).slice(2,8)}`,w0=s;if(j5){let E="";if(Object.keys(X).length>0)try{E=` data-stx-props="${nZ(JSON.stringify(X))}"`}catch{}let v=B?` stx-hydrate="${nZ(B)}"`:"";w0=`<div data-stx-scope="${I0}"${E}${v}>${s}</div>`;let m=await Promise.all(C.map(async(g)=>{let r=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!r)return g;let[,Q0,o0]=r,f0=N8(o0,{filePath:L,projectRoot:process.cwd()}),m0=f0.code,s0=T8(f0.styles);m0=T5(m0).code;let{hasUserImports:_5,bundleClientScript:N1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (N7(),R7)));if(_5(m0))m0=await N1(m0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:T1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$)));m0=m0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(j1,q8)=>T1(q8));let B0=l0(m0),Y1=yz(B0),i=`function(__scopeId) {
10439
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(L);let V;if(X$.has(L))V=X$.get(L);else try{V=await Bun.file(L).text(),X$.set(L,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",k8]),R={};for(let[E,v]of Object.entries(Y))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:N}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),T=N(Z),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[E,v]of T.namedSlots)M[E]=v.content;let k={...R,...X,props:X,slot:Z,$slots:M,__processedComponents:z,__sections:{},__stx_signals_gate:F1(V)||vz(Z)};Cz(V,k);let y=V,I=S8(y);if(I)y=I.content.trim();let S=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...V.matchAll(S)],C=[],P=b.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&b.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,f=null;if(P){let E=Ez({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${L}\x00${E}`;let v=hX.get(x);if(v){for(let m of v.dependencies)q.add(m);return v.output}f=new Set(q)}}for(let E of b){let v=E[1]||"",m=E[2]||"",g=v.includes("server");if(i1(v)&&m.trim())m=n1(m);if(g&&m)try{await W(m,k,L)}catch(Q0){}if(!g){let Q0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),o0=Q0.includes("{{")&&Q0.includes("}}"),f0=Q0.includes("{!!")&&Q0.includes("!!}");if(o0||f0)Q0=y8(Q0,k);let m0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");C.push(`<script${m0}>${Q0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),$0=l?l[1]:"",C0=l?l[2]:"",U0="",A0=$0&&/\bscoped\b/i.test($0);if(l)U0=`<style${$0}>${C0}</style>`;let u=y;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(u=u.replace(E,(m,g)=>{let r=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(r)v.push(`<style${r[1]}>${r[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)U0=`${U0}${v.join(`
10440
+ `)}`}if(Z&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:t}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),{defaultSlot:R0,namedSlots:P0}=T;u=await t(u,R0,P0,k);let j5=C.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),B5=xz(C);if(B5.length>0)k.__stx_client_signal_names=B5;let n={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:j5||C.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let s=await O0(u,k,L,n,q),K0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let E of s.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)Y.__stx_preserved_client_expressions=[...K0];let I0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++Iz}_${Math.random().toString(36).slice(2,8)}`,w0=s;if(j5){let E="";if(Object.keys(X).length>0)try{E=` data-stx-props="${nZ(JSON.stringify(X))}"`}catch{}let v=B?` stx-hydrate="${nZ(B)}"`:"";w0=`<div data-stx-scope="${I0}"${E}${v}>${s}</div>`;let m=await Promise.all(C.map(async(g)=>{let r=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!r)return g;let[,Q0,o0]=r,f0=N8(o0,{filePath:L,projectRoot:process.cwd()}),m0=f0.code,s0=T8(f0.styles);m0=T5(m0).code;let{hasUserImports:_5,bundleClientScript:T1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (N7(),R7)));if(_5(m0))m0=await T1(m0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:M1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$)));m0=m0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(B1,q8)=>M1(q8));let B0=l0(m0),Y1=yz(B0),i=`function(__scopeId) {
10363
10441
  ${R5("const",[...u2,...Y1],B0)}
10364
10442
  const __scope = window.stx._scopes = window.stx._scopes || {};
10365
10443
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -10378,7 +10456,7 @@ ${B0}
10378
10456
  // Register all defined signals and functions in this scope
10379
10457
  const __localVars = {};
10380
10458
  try {
10381
- ${Y1.map((j1)=>`if (typeof ${j1} !== 'undefined') __localVars['${j1}'] = ${j1};`).join(`
10459
+ ${Y1.map((B1)=>`if (typeof ${B1} !== 'undefined') __localVars['${B1}'] = ${B1};`).join(`
10382
10460
  `)}
10383
10461
  }
10384
10462
  catch (e) {}
@@ -10408,7 +10486,7 @@ ${X0.yellow}${X0.bold}Message:${X0.reset} ${X}
10408
10486
  `,w)K+=`
10409
10487
  ${X0.blue}${X0.bold}Context:${X0.reset}
10410
10488
  ${X0.dim}${w}${X0.reset}
10411
- `;return K}function CZ(){X$.clear(),Z$.clear(),hX.clear()}var X$,Z$,hX,Iz=0,X0;var k0=D(()=>{E7();e9();q1();Q1();E5();Y$();E1();GX();QX();A7();p6();v7();X$=new o1(500),Z$=new o1(1000),hX=new o1(2000);X0={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 oZ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",K=w+Q[0].length,z=1,U=K,B=-1;while(z>0&&U<$.length){let H=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(H!==-1&&H<L&&H!==w){let O=$[H+9];if(O==="("||O===`
10489
+ `;return K}function CZ(){X$.clear(),Z$.clear(),hX.clear()}var X$,Z$,hX,Iz=0,X0;var k0=D(()=>{E7();e9();W1();Q1();E5();Y$();E1();GX();QX();A7();p6();v7();X$=new o1(500),Z$=new o1(1000),hX=new o1(2000);X0={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 oZ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",K=w+Q[0].length,z=1,U=K,B=-1;while(z>0&&U<$.length){let H=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(H!==-1&&H<L&&H!==w){let O=$[H+9];if(O==="("||O===`
10412
10490
  `||O==="\r"||O===" "||O===void 0)z++;U=H+9}else{if(z--,z===0){B=L;break}U=L+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(w,B+12);Y.push({fullMatch:_,options:W,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of Y)try{let z={};if(q)q.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},B=V7(W.trim(),U);J=J.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=z0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);J=J.split(w).join(B)}return J}async function sZ($,X,Z,J){let Y={gfm:!0,breaks:!1};return X.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")Y.breaks=!0;if(Q==="no-gfm")Y.gfm=!1}),V7($.trim(),Y)}var mX=D(()=>{k0()});function uz($){if(gz.set($.name,$),$.client)hz.set($.name,$.client)}function G$($){return uz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=dz(J,$.defaults);if($.validate){let q=$.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let w=Z;if($.transform)w=await $.transform(Z,Q,Y,G);if($.clientScript){let q=$.clientScript(Q);w+=`<script>${q}</script>`}if($.css){let q=$.css(Q);w+=`<style>${q}</style>`}return w}}}function dz($,X){let Z={...X};for(let J of $){let Y=J.indexOf(":"),G=J.indexOf("="),Q=Y>=0&&(G<0||Y<G)?Y:G;if(Q>=0){let w=J.slice(0,Q).trim(),q=J.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)=>!X||!(q in X)).length;Z[w===0?"value":`arg${w}`]=J}}return Z}var gz,hz;var lX=D(()=>{gz=new Map,hz=new Map});function cX($,X=S5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${d7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function aZ($,X,Z=mz,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${d7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function pX($,X="100vw"){if(!$||Object.keys($).length===0)return X;let J=Object.entries($).map(([Y,G])=>{let Q=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((Y,G)=>Y.numericBp-G.numericBp).map(({bp:Y,size:G})=>`(max-width: ${Y}) ${G}`);return J.push(X),J.join(", ")}function d7($,X={}){let Z=Object.entries(X).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 $;let J=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function iX($){return lz[$]||"application/octet-stream"}var S5,mz,u7,lz;var nX=D(()=>{S5=[320,480,640,768,1024,1280,1536,1920,2560],mz=[1,1.5,2,3],u7=["avif","webp","jpeg"],lz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function pz(){try{return await import("ts-images")}catch{return null}}async function iz($,X={}){let Z={...cz,...X},J=await pz();if(J)try{return await nz($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return rz($,Z)}async function nz($,X,Z){let{generatePlaceholder:J,generateThumbHash:Y}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[X.strategy]||"blur";if(X.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await J($,{width:X.width,height:X.height,quality:X.quality,blurLevel:X.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:X.strategy,dominantColor:w.dominantColor,css:w.css}}function rz($,X){let Z=X.width||20,J=X.height||Z,Y="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}" viewBox="0 0 ${Z} ${J}"><rect fill="#e5e7eb" width="${Z}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:J,aspectRatio:Z/J,originalWidth:0,originalHeight:0,strategy:X.strategy,dominantColor:"#e5e7eb"}}function tZ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10413
10491
  #${$} {
10414
10492
  --stx-img-transition-duration: ${J}ms;
@@ -11130,7 +11208,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11130
11208
 
11131
11209
  `),"utf-8")}}async flush(){await this.writeQueue}}var R3,$1,T3;var $Y=D(()=>{P$();R3={isEnabled(){return y$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=y$();if(!X.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,J=[],Y=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(Y>G){let w=Y-G;Z+="}}".repeat(w),J.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 K=q-W;for(let z=0;z<K;z++)Z+=`
11132
11210
  @end${w}`;J.push(`Added ${K} missing @end${w}`)}}if(J.length>0&&X.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:J}},createFallbackContent($,X){if(l7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};$1=new N3,T3={isDevelopment(){return l7()},logDetailedError($,X){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),X)console.error("Context:",X);console.error("========================")},createErrorReport($,X){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(X)Z.push(`Context: ${JSON.stringify(X,null,2)}`);return Z.push("========================"),Z.join(`
11133
- `)}}});var XY=()=>{};var ZY=D(()=>{E$();eJ();$Y();XY();P$()});var F1=D(()=>{ZY()});function JY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let K=q.split(":"),z=q,U=K.length>1?K[1]:"";if(U&&X[U])W=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])W=X.openGraph[K[1]];else W="";return W?`<meta property="${c(z)}" content="${c(W)}">`:""}return W?`<meta name="${c(q)}" content="${c(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=Y.substring(q+1,K).trim(),U=K+1,B=(()=>{try{let j=N0(z,X);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+B+Y.substring(U),G.lastIndex=0}return Y}function YY($,X,Z){let J=$,Y=/@structuredData\s*\(/g,G;while((G=Y.exec(J))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=J.substring(w+1,W).trim(),z=W+1,U=(()=>{try{let B=N0(K,X);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return Z0("StructuredData",j,o.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function GY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let w=Y.indexOf("{",Q.index+4),q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let L=Y[W];if(z){z=!1,W++;continue}if(L==="\\"&&K){z=!0,W++;continue}if(K){if(L===K)K=null;W++;continue}if(L==='"'||L==="'"||L==="`"){K=L,W++;continue}if(L==="{")q++;else if(L==="}")q--;W++}if(q!==0)break;let U=Y.substring(W).match(/^\s*\)/);if(!U)break;let B=W+U[0].length,j=Y.substring(w,W),_=Y.substring(Q.index,B),H=((L)=>{try{let O=N0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
11211
+ `)}}});var XY=()=>{};var ZY=D(()=>{E$();eJ();$Y();XY();P$()});var V1=D(()=>{ZY()});function JY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let K=q.split(":"),z=q,U=K.length>1?K[1]:"";if(U&&X[U])W=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])W=X.openGraph[K[1]];else W="";return W?`<meta property="${c(z)}" content="${c(W)}">`:""}return W?`<meta name="${c(q)}" content="${c(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=Y.substring(q+1,K).trim(),U=K+1,B=(()=>{try{let j=N0(z,X);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+B+Y.substring(U),G.lastIndex=0}return Y}function YY($,X,Z){let J=$,Y=/@structuredData\s*\(/g,G;while((G=Y.exec(J))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=J.substring(w+1,W).trim(),z=W+1,U=(()=>{try{let B=N0(K,X);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return Z0("StructuredData",j,o.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function GY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let w=Y.indexOf("{",Q.index+4),q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let L=Y[W];if(z){z=!1,W++;continue}if(L==="\\"&&K){z=!0,W++;continue}if(K){if(L===K)K=null;W++;continue}if(L==='"'||L==="'"||L==="`"){K=L,W++;continue}if(L==="{")q++;else if(L==="}")q--;W++}if(q!==0)break;let U=Y.substring(W).match(/^\s*\)/);if(!U)break;let B=W+U[0].length,j=Y.substring(w,W),_=Y.substring(Q.index,B),H=((L)=>{try{let O=N0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
11134
11212
  `,F+=`<meta name="title" content="${c(O.title)}">
11135
11213
  `;if(O.description)F+=`<meta name="description" content="${c(O.description)}">
11136
11214
  `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${c(V)}">
@@ -11169,7 +11247,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11169
11247
  <title>${c(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
11170
11248
  ${W}
11171
11249
  `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function WY($){let X=[];for(let Z of $.rules){if(X.push(`User-agent: ${Z.userAgent}`),Z.allow)for(let J of Z.allow)X.push(`Allow: ${J}`);if(Z.disallow)for(let J of Z.disallow)X.push(`Disallow: ${J}`);if(Z.crawlDelay!==void 0)X.push(`Crawl-delay: ${Z.crawlDelay}`);X.push("")}if($.sitemap){let Z=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of Z)X.push(`Sitemap: ${J}`)}if($.host)X.push(`Host: ${$.host}`);return X.join(`
11172
- `).trim()}var wY,qY;var v$=D(()=>{F1();T0();wY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[1].replace(/['"]/g,""):"";return`<meta name="${c(Y)}" content="${c(G)}">`},hasEndTag:!1},qY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return Z0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import c7 from"path";function Qj($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1].trim():"",Y=X,G=[],Q=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],B=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=U.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let w=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:Y,props:G,template:q,styles:K,script:J,shadowDOM:Q}}function wj($){let{tag:X,props:Z,template:J,styles:Y,shadowDOM:G}=$,Q=X.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),w=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11250
+ `).trim()}var wY,qY;var v$=D(()=>{V1();T0();wY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[1].replace(/['"]/g,""):"";return`<meta name="${c(Y)}" content="${c(G)}">`},hasEndTag:!1},qY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return Z0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import c7 from"path";function Qj($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1].trim():"",Y=X,G=[],Q=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],B=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=U.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let w=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:Y,props:G,template:q,styles:K,script:J,shadowDOM:Q}}function wj($){let{tag:X,props:Z,template:J,styles:Y,shadowDOM:G}=$,Q=X.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),w=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11173
11251
  get ${z}() {
11174
11252
  return this.getAttribute('${z}') || '';
11175
11253
  }
@@ -11222,14 +11300,14 @@ ${K}
11222
11300
  customElements.define('${X}', ${Q});
11223
11301
  `}async function KY($,X,Z,J){if(X.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[c7.join(c7.dirname(J),Q,`${Y}.stx`),c7.join(process.cwd(),Q,`${Y}.stx`),c7.join(c7.dirname(J),`${Y}.stx`)],q=null;for(let z of w)if(await p(z)){q=await Bun.file(z).text();break}if(!q)return Z0("WebComponent",`Component file not found: ${Y}.stx`,o.FILE_NOT_FOUND);let W=Qj(q,Y);return`<script type="module">
11224
11302
  ${wj(W)}
11225
- </script>`}var zY=D(()=>{F1();k0()});var UY={};a(UY,{timingPlugin:()=>Uj,pluginManager:()=>qj,definePlugin:()=>x$,debugPlugin:()=>zj,createVariablesPlugin:()=>jj,createFilterPlugin:()=>Kj,createDirectivePlugin:()=>Wj,PluginManager:()=>M3});function x$($){return $}class M3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,X){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(X);this.sortPlugins()}async unregister($){let X=this.plugins.get($);if(!X)return!1;for(let[Z,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(X.onUnregister)await X.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let X of this.sortedPlugins)if(X.registerDirectives)$.push(...X.registerDirectives());return $}getAllFilters(){let $={};for(let X of this.sortedPlugins)if(X.registerFilters)Object.assign($,X.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,X){return this.runDirectiveHooks("beforeDirective",$,X)}async runAfterDirective($,X){return this.runDirectiveHooks("afterDirective",$,X)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let X of this.sortedPlugins)if(X.onError)try{let Z=await X.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${X.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,X)=>($.priority??100)-(X.priority??100))}async runHooks($,X){let Z={...X};for(let J of this.sortedPlugins){let Y=J[$];if(Y)try{let G=await Y(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 "${J.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let J={...Z};for(let Y of this.sortedPlugins){let G=Y[$];if(G)try{let Q=await G(X,J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}}function Wj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function Kj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function jj($){return x$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var qj,zj,Uj;var jY=D(()=>{qj=new M3;zj=x$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,X){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,X){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),Uj=x$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let X=$.metadata.startTime;if(X){let Z=performance.now()-X;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var OY={};a(OY,{validateConfig:()=>Vj,resolveStxDirectories:()=>HY,loadStxConfig:()=>t0,defineStxConfig:()=>Fj,defaultConfig:()=>G5,config:()=>T7});import f$ from"fs";import c0 from"path";import{loadConfigWithResult as Bj}from"bunfig";function _j($,X,Z){let J=X||"pages";if($)return{root:$,pagesDir:J};let Y=Z||process.cwd(),G=c0.join(Y,"resources","views"),Q=c0.join(Y,"resources","layouts");if(f$.existsSync(G)&&f$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=c0.join(Y,"resources","views","pages");if(f$.existsSync(w))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function Hj($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let J=$.replace(/\\/g,"/"),Y=Z.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function HY($,X){let Z=!$.root,J=_j($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!BY.has(Y))BY.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let Y=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(c0.isAbsolute(Q)||Hj(Q,Y))continue;$[G]=c0.join(Y,Q)}}return $}function Oj($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let J of Z){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let G=c0.isAbsolute(Y)?Y:c0.join(X,Y);if(f$.existsSync(G))continue;let Q=$.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(J)} resolves to "${G}", which does not exist. Configured as "${Y}"`+(w?`, resolved under root "${Q}".`:"."))}}function Lj($){if(N2($.stateDir),$.stateDir=O7(),$.cachePath=L7($.cachePath),$.build)$.build.cacheDir=L7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L7($.media.cache.directory);if($.story)$.story.outDir=L7($.story.outDir)}async function t0($){if(!$){if(v5)return v5;if(g$)return g$}let X=$?c0.resolve($):process.cwd(),Z=_Y.get(X);if(Z)return Z;let J=(async()=>{let G=(await Bj({name:"stx",alias:"ui",cwd:X,defaultConfig:G5,verbose:!1})).config;if(Lj(G),HY(G,X),Oj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (jY(),UY)),w=[],q=[];for(let W of G.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let U,B;try{U=await import(K),B=c0.dirname(j0.resolve(K))}catch{let _=c0.resolve(process.cwd(),K);U=await import(_),B=c0.dirname(_)}let j=U.default||U;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)w.push(c0.resolve(B,H))}if(j.pages){let _=c0.resolve(B,j.pages),H=z.path||"/";q.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(U){console.warn(`[stx] Failed to load plugin ${K}:`,U.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(_Y.set(X,J),!$)g$=J,J.then((Y)=>{v5=Y}).catch(()=>{});return J}function Fj($){return $}function Vj($){let X=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")X.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")X.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")X.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")X.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)X.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)X.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)X.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)X.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))X.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))X.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)X.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,G)=>{if(!Y.pattern||typeof Y.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))X.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!J.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var G5,BY,v5=null,_Y,g$=null,T7;var O1=D(()=>{g9();h9();u9();d9();mX();TJ();F3();sJ();v$();F7();zY();G5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:sZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:KY,hasEndTag:!1,description:"Include a web component in the template"},k2,I2,wY,qY,E2,y2,b2,D2,P2,f2,NJ,L3,...oJ],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}};BY=new Set;_Y=new Map;T7=new Proxy(G5,{get($,X){if(v5&&X in v5)return v5[X];if(!g$)t0().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var NY={};a(NY,{resetCssCache:()=>Ej,resetCrosswindCache:()=>Dj,rebuildCrosswindCSS:()=>yj,loadCrosswindConfig:()=>D3,loadCrosswind:()=>E3,injectCrosswindCSS:()=>i7,getCrosswindServeAsset:()=>Nj,getCachedCSS:()=>bj,generateCrosswindCSS:()=>RY,extractClassNames:()=>AY,buildCrosswindCSS:()=>VY});import Y0 from"path";import{hasLocalConfig as Aj}from"bunfig";function u$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function k3($,X){if(V1.has($))V1.delete($);else if(V1.size>=FY)V1.delete(V1.keys().next().value);V1.set($,X)}function Rj($){let X=u$($);if(X1.has(X))X1.delete(X);else if(X1.size>=FY)X1.delete(X1.keys().next().value);return X1.set(X,$),X}function Nj($){let X=X1.get($);if(X===void 0)return;return X1.delete($),X1.set($,X),X}async function Tj($){if(!f1)return null;try{let X=Bun.file(Y0.join(f1,`cw-${u$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function Mj($,X){if(!f1)return;try{if(!fs.existsSync(f1))fs.mkdirSync(f1,{recursive:!0});await Bun.write(Y0.join(f1,`cw-${u$($)}.css`),X)}catch{}}async function LY($){try{let X=await import($);if(X&&X.CSSGenerator)return{CSSGenerator:X.CSSGenerator,config:X.config,build:X.build,defaultConfig:X.defaultConfig,extractClasses:X.extractClasses}}catch{}return null}function kj(){let $=[],X=process.cwd();while(X!==Y0.dirname(X))$.push(Y0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=Y0.dirname(X);return $}function Ij(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[Y0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function E3(){if(I3)return W1;I3=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await LY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=Y0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return W1=G,W1}let X=await $(kj());if(X)return W1=X,W1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await LY(Y);if(G){if(W1=G,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return W1}}let J=await $(Ij());if(J)return W1=J,W1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function Ej(){V1.clear(),X1.clear()}function Dj(){W1=null,I3=!1,Z1=null,p7="",V1.clear(),X1.clear(),h$=null}async function D3($){try{if(!Aj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:X}=await import("bunfig"),Z=await X({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let J=Y0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function VY($){if(x5)return p7;x5=!0;try{let X=await E3();if(!X||!X.build)return x5=!1,"";if(!Z1)Z1=await D3($);if(!Z1)return x5=!1,"";let Z=X.defaultConfig?.theme||{},J=Z1.theme||{},Y={...X.defaultConfig,...Z1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),w=performance.now()-G;if(p7=Q.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),Y.output){let q=Y0.isAbsolute(Y.output)?Y.output:Y0.join($,Y.output),W=Y0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return x5=!1,Q.css}catch(X){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,X),x5=!1,p7}}async function yj($){Z1=null,await VY($)}function bj(){return p7}function AY($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,J=Z.exec($);while(J!==null){for(let Q of J[1].split(/\s+/))if(Q.trim())X.add(Q.trim());J=Z.exec($)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=Y.exec($);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())X.add(q.trim())}G=Y.exec($)}return X}async function RY($,X){try{let Z=await E3();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):AY($);if(J.size===0)return"";let Y=X?Y0.resolve(X):process.cwd();if(!f1)f1=B1(Y,"cache");let G=[...J].sort().join(" "),Q=`${h$||"default"}::${G}`,w=V1.get(Q);if(w!==void 0)return k3(Q,w),w;let q=await Tj(Q);if(q!==null)return k3(Q,q),q;if(!Z1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (O1(),OY)),R=await A(Y);if(R.css)if(typeof R.css==="string"){let N=Y0.isAbsolute(R.css)?R.css:Y0.resolve(Y,R.css);if(await Bun.file(N).exists()){let T=await import(N);V=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(Y,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);V={...T.default||T,...V}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Z1=V||await D3(Y);try{h$=u$(JSON.stringify(Z1??{}))}catch{h$="unhashable"}}let W=Z.defaultConfig||Z.config,K=Z1||{},z=A2(W,K),{safelist:U,includePreflight:B,minify:j}=z,_=z.config,H=new Z.CSSGenerator(_);for(let V of U)H.generate(V);for(let V of J)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||K.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!J.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let N of R)H.generate(N)}L=H.toCSS(B,j);let F=L.split(`
11303
+ </script>`}var zY=D(()=>{V1();k0()});var UY={};a(UY,{timingPlugin:()=>Uj,pluginManager:()=>qj,definePlugin:()=>x$,debugPlugin:()=>zj,createVariablesPlugin:()=>jj,createFilterPlugin:()=>Kj,createDirectivePlugin:()=>Wj,PluginManager:()=>M3});function x$($){return $}class M3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,X){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(X);this.sortPlugins()}async unregister($){let X=this.plugins.get($);if(!X)return!1;for(let[Z,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(X.onUnregister)await X.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let X of this.sortedPlugins)if(X.registerDirectives)$.push(...X.registerDirectives());return $}getAllFilters(){let $={};for(let X of this.sortedPlugins)if(X.registerFilters)Object.assign($,X.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,X){return this.runDirectiveHooks("beforeDirective",$,X)}async runAfterDirective($,X){return this.runDirectiveHooks("afterDirective",$,X)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let X of this.sortedPlugins)if(X.onError)try{let Z=await X.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${X.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,X)=>($.priority??100)-(X.priority??100))}async runHooks($,X){let Z={...X};for(let J of this.sortedPlugins){let Y=J[$];if(Y)try{let G=await Y(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 "${J.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let J={...Z};for(let Y of this.sortedPlugins){let G=Y[$];if(G)try{let Q=await G(X,J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}}function Wj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function Kj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function jj($){return x$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var qj,zj,Uj;var jY=D(()=>{qj=new M3;zj=x$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,X){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,X){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),Uj=x$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let X=$.metadata.startTime;if(X){let Z=performance.now()-X;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var OY={};a(OY,{validateConfig:()=>Vj,resolveStxDirectories:()=>HY,loadStxConfig:()=>t0,defineStxConfig:()=>Fj,defaultConfig:()=>G5,config:()=>T7});import f$ from"fs";import c0 from"path";import{loadConfigWithResult as Bj}from"bunfig";function _j($,X,Z){let J=X||"pages";if($)return{root:$,pagesDir:J};let Y=Z||process.cwd(),G=c0.join(Y,"resources","views"),Q=c0.join(Y,"resources","layouts");if(f$.existsSync(G)&&f$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=c0.join(Y,"resources","views","pages");if(f$.existsSync(w))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function Hj($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let J=$.replace(/\\/g,"/"),Y=Z.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function HY($,X){let Z=!$.root,J=_j($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!BY.has(Y))BY.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let Y=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(c0.isAbsolute(Q)||Hj(Q,Y))continue;$[G]=c0.join(Y,Q)}}return $}function Oj($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let J of Z){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let G=c0.isAbsolute(Y)?Y:c0.join(X,Y);if(f$.existsSync(G))continue;let Q=$.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(J)} resolves to "${G}", which does not exist. Configured as "${Y}"`+(w?`, resolved under root "${Q}".`:"."))}}function Lj($){if(N2($.stateDir),$.stateDir=O7(),$.cachePath=L7($.cachePath),$.build)$.build.cacheDir=L7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L7($.media.cache.directory);if($.story)$.story.outDir=L7($.story.outDir)}async function t0($){if(!$){if(v5)return v5;if(g$)return g$}let X=$?c0.resolve($):process.cwd(),Z=_Y.get(X);if(Z)return Z;let J=(async()=>{let G=(await Bj({name:"stx",alias:"ui",cwd:X,defaultConfig:G5,verbose:!1})).config;if(Lj(G),HY(G,X),Oj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (jY(),UY)),w=[],q=[];for(let W of G.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let U,B;try{U=await import(K),B=c0.dirname(j0.resolve(K))}catch{let _=c0.resolve(process.cwd(),K);U=await import(_),B=c0.dirname(_)}let j=U.default||U;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)w.push(c0.resolve(B,H))}if(j.pages){let _=c0.resolve(B,j.pages),H=z.path||"/";q.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(U){console.warn(`[stx] Failed to load plugin ${K}:`,U.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(_Y.set(X,J),!$)g$=J,J.then((Y)=>{v5=Y}).catch(()=>{});return J}function Fj($){return $}function Vj($){let X=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")X.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")X.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")X.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")X.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)X.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)X.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)X.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)X.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))X.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))X.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)X.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,G)=>{if(!Y.pattern||typeof Y.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))X.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!J.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var G5,BY,v5=null,_Y,g$=null,T7;var L1=D(()=>{g9();h9();u9();d9();mX();TJ();F3();sJ();v$();F7();zY();G5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:sZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:KY,hasEndTag:!1,description:"Include a web component in the template"},k2,I2,wY,qY,E2,y2,b2,D2,P2,f2,NJ,L3,...oJ],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}};BY=new Set;_Y=new Map;T7=new Proxy(G5,{get($,X){if(v5&&X in v5)return v5[X];if(!g$)t0().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var NY={};a(NY,{resetCssCache:()=>Ej,resetCrosswindCache:()=>Dj,rebuildCrosswindCSS:()=>yj,loadCrosswindConfig:()=>D3,loadCrosswind:()=>E3,injectCrosswindCSS:()=>i7,getCrosswindServeAsset:()=>Nj,getCachedCSS:()=>bj,generateCrosswindCSS:()=>RY,extractClassNames:()=>AY,buildCrosswindCSS:()=>VY});import Y0 from"path";import{hasLocalConfig as Aj}from"bunfig";function u$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function k3($,X){if(A1.has($))A1.delete($);else if(A1.size>=FY)A1.delete(A1.keys().next().value);A1.set($,X)}function Rj($){let X=u$($);if(X1.has(X))X1.delete(X);else if(X1.size>=FY)X1.delete(X1.keys().next().value);return X1.set(X,$),X}function Nj($){let X=X1.get($);if(X===void 0)return;return X1.delete($),X1.set($,X),X}async function Tj($){if(!f1)return null;try{let X=Bun.file(Y0.join(f1,`cw-${u$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function Mj($,X){if(!f1)return;try{if(!fs.existsSync(f1))fs.mkdirSync(f1,{recursive:!0});await Bun.write(Y0.join(f1,`cw-${u$($)}.css`),X)}catch{}}async function LY($){try{let X=await import($);if(X&&X.CSSGenerator)return{CSSGenerator:X.CSSGenerator,config:X.config,build:X.build,defaultConfig:X.defaultConfig,extractClasses:X.extractClasses}}catch{}return null}function kj(){let $=[],X=process.cwd();while(X!==Y0.dirname(X))$.push(Y0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=Y0.dirname(X);return $}function Ij(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[Y0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function E3(){if(I3)return K1;I3=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await LY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=Y0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return K1=G,K1}let X=await $(kj());if(X)return K1=X,K1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await LY(Y);if(G){if(K1=G,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return K1}}let J=await $(Ij());if(J)return K1=J,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function Ej(){A1.clear(),X1.clear()}function Dj(){K1=null,I3=!1,Z1=null,p7="",A1.clear(),X1.clear(),h$=null}async function D3($){try{if(!Aj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:X}=await import("bunfig"),Z=await X({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let J=Y0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function VY($){if(x5)return p7;x5=!0;try{let X=await E3();if(!X||!X.build)return x5=!1,"";if(!Z1)Z1=await D3($);if(!Z1)return x5=!1,"";let Z=X.defaultConfig?.theme||{},J=Z1.theme||{},Y={...X.defaultConfig,...Z1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),w=performance.now()-G;if(p7=Q.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),Y.output){let q=Y0.isAbsolute(Y.output)?Y.output:Y0.join($,Y.output),W=Y0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return x5=!1,Q.css}catch(X){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,X),x5=!1,p7}}async function yj($){Z1=null,await VY($)}function bj(){return p7}function AY($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,J=Z.exec($);while(J!==null){for(let Q of J[1].split(/\s+/))if(Q.trim())X.add(Q.trim());J=Z.exec($)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=Y.exec($);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())X.add(q.trim())}G=Y.exec($)}return X}async function RY($,X){try{let Z=await E3();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):AY($);if(J.size===0)return"";let Y=X?Y0.resolve(X):process.cwd();if(!f1)f1=_1(Y,"cache");let G=[...J].sort().join(" "),Q=`${h$||"default"}::${G}`,w=A1.get(Q);if(w!==void 0)return k3(Q,w),w;let q=await Tj(Q);if(q!==null)return k3(Q,q),q;if(!Z1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (L1(),OY)),R=await A(Y);if(R.css)if(typeof R.css==="string"){let N=Y0.isAbsolute(R.css)?R.css:Y0.resolve(Y,R.css);if(await Bun.file(N).exists()){let T=await import(N);V=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(Y,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);V={...T.default||T,...V}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Z1=V||await D3(Y);try{h$=u$(JSON.stringify(Z1??{}))}catch{h$="unhashable"}}let W=Z.defaultConfig||Z.config,K=Z1||{},z=A2(W,K),{safelist:U,includePreflight:B,minify:j}=z,_=z.config,H=new Z.CSSGenerator(_);for(let V of U)H.generate(V);for(let V of J)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||K.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!J.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let N of R)H.generate(N)}L=H.toCSS(B,j);let F=L.split(`
11226
11304
  `);for(let[V,A]of Object.entries(O)){if(!J.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),N=[],T=[];for(let M of R){let k=M.startsWith("dark:"),S=`.${(k?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<F.length;b++){let C=F[b].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let P=b,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let f=x.match(/\{([^}]+)\}/);if(f)if(k)T.push(f[1].trim());else N.push(f[1].trim());break}}}if(N.length)L+=`
11227
11305
  .${V} { ${N.join(" ")} }`;if(T.length)L+=`
11228
11306
  @media (prefers-color-scheme: dark) { .dark .${V} { ${T.join(" ")} } }`}return k3(Q,L),Mj(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function i7($,X,Z=!1){let J=await RY($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Rj(J)}.css">`:`<style data-crosswind="generated">
11229
11307
  ${J}
11230
11308
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test($)){let Q=!1;return $.replace(G,()=>{if(Q)return"";return Q=!0,Y})}if($.includes("</head>"))return $.replace("</head>",`${Y}
11231
11309
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
11232
- ${Y}`);return Y+$}var W1=null,I3=!1,Z1=null,p7="",x5=!1,FY=256,V1,X1,f1=null,h$=null;var d$=D(()=>{F7();T2();V1=new Map,X1=new Map});function TY(){return`
11310
+ ${Y}`);return Y+$}var K1=null,I3=!1,Z1=null,p7="",x5=!1,FY=256,A1,X1,f1=null,h$=null;var d$=D(()=>{F7();T2();A1=new Map,X1=new Map});function TY(){return`
11233
11311
  // STX Lifecycle Runtime
11234
11312
  (function() {
11235
11313
  if (typeof window === 'undefined') return;
@@ -12008,11 +12086,11 @@ window.__stx_reactive = (function() {
12008
12086
  ${nj()}
12009
12087
  ${Z}
12010
12088
  </script>`}function xY($,X,Z){if(vY=0,!sj($))return $;let J=lj($);if(J.length===0)return $;let Y=oj($,J),G=rj(J,X),Q=Y.lastIndexOf("</body>");if(Q!==-1)Y=Y.slice(0,Q)+G+`
12011
- `+Y.slice(Q);else Y+=G;return Y}function oj($,X){let Z=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,G,Q)=>{let w=X[Z++];if(!w)return Y;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,Y;return`<${G} data-stx-scope="${w.id}"${Q}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function sj($){return/x-data\s*=\s*["']/.test($)}var vY=0,mj=0;var fY=D(()=>{q1()});import aj from"fs";import b3 from"path";import{createHighlighter as tj}from"ts-syntax-highlighter";async function ej($,X={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let J=(await aj.promises.stat($)).mtime.getTime();if(X.cache&&S3.has($)){let z=S3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=h2(Y),w=X.markdown||T7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=V7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await $B(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)S3.set($,{...K,updatedAt:J});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let J=Z instanceof Error?Z.message:String(Z);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function $B($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!l$)try{l$=await tj({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let Y=async(w,q,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!l$.getSupportedLanguages().includes(U))return w;return(await l$.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(J);for(let w of Q){let[q,W,K,z]=w,U=await Y(q,W,K,z);G=G.replace(q,U)}return G}async function gY($,X,Z="",J={}){return await XB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!b3.isAbsolute(w))K=b3.resolve(b3.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);z[A]=R}}}}catch(L){if(J.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:B}=await ej(K,J),j={...X,...B,...z},_=U,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(K){let z=K instanceof Error?K.message:String(K);return z0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function XB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let w=Y[0],q=Y.index,W=Y;J.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(J);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var S3,l$=null;var hY=D(()=>{O1();k0();S3=new Map});function g1($,X){try{let Z=$.trim();if(q0(Z))return W0(Z,Object.keys(X))(...Object.values(X));else return J0(Z,X)}catch{return!1}}var uY=D(()=>{T0()});function ZB($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=_X(J,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys(X))(...Object.values(X));else q=J0(w.expression,X);let W="",K=!1;for(let z of w.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let U;if(z.value&&q0(z.value))U=W0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=J0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+W+J.substring(w.end),Y=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(w.end);break}}return J}function JB($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return X.push(J),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function YB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function Q5($,X,Z){let{masked:J,scripts:Y}=JB($);return YB(GB(J,X,Z),Y)}function GB($,X,Z){let J=$;J=ZB(J,X,Z);{let G=!0;while(G){G=!1;let Q=J.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(J,w+7);if(!q)break;let W=q.endPos,K=t1(J,"unless","endunless",W);if(K===-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 z=J.slice(W,K),U=q.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==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")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${U})${H}@else ${_}@endif`}else j=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+j+J.substring(K+10),G=!0}}J=P3(J,X,Z),J=v3(J,X,Z),J=C3(J,X);let Y=()=>{let G=x7(J);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 K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&q0(K.condition))z=W0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=J0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=Z0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}J=J.substring(0,w.start)+q+J.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,w.start)+K+J.substring(w.end)}}return!0};while(!0){let G=J;if(!Y())break;if(J===G)break}return J}function dY($){let X=0;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let Z=$[X];if(Z!=="'"&&Z!=='"')return null;X++;let J=[];while(X<$.length){let Y=$[X];if(Y==="\\"&&X+1<$.length){J.push($[X+1]),X+=2;continue}if(Y===Z){X++;break}J.push(Y),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:J.join(""),consumed:X}}function C3($,X){let Z=$;function J(w,q,W,K){let z=1,U=K,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(U<w.length&&z>0){B.lastIndex=U,j.lastIndex=U;let _=B.exec(w),H=j.exec(w),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)z++,U=L+_[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+H[0].length}else break}return-1}function Y(w,q,W){let K=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(w))!==null)j.push({pos:_.index,type:"open"});while((_=U.exec(w))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(w))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")K++;else if(H.type==="close")K--;else if(H.type==="else"&&K===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,K,z,U=Z.slice(W+5),B=dY(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?g1(`auth?.check && auth?.user?.[${K}]`,X):g1("auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+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,K,z,U=Z.slice(W+6),B=dY(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?g1(`!auth?.check || !auth?.user?.[${K}]`,X):g1("!auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+9),w=!0}}function G(w,q,W){if(X.userCan&&typeof X.userCan[w]==="boolean")return X.userCan[w];if(X.permissions?.check&&typeof X.permissions.check==="function")try{let K=[w];if(q)K.push(q);if(W){let z=g1(W,X);K.push(z)}return X.permissions.check(...K)}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",K=!0;while(K){K=!1;let z=Z.match(new RegExp(`@${w}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,B=Z.slice(U+`@${w}`.length),j=Q(B);if(!j)break;let _=U+`@${w}`.length+j.paramsEnd,H=J(Z,w,q,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((C,P)=>C.pos-P.pos);for(let C of T){if(C.type==="open"){F++;continue}if(C.type==="close"){F--;continue}if(F===0)O.push(C)}let k=[],y=0;for(let C=0;C<O.length;C++){let P=O[C];if(k.push({content:L.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${W}`.length),f=Q(x);if(f){k[k.length-1]={content:L.slice(y,P.pos)},y=P.pos+`@${W}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let l=O[C+1],$0=l?l.pos:L.length;k.push({content:L.slice(y,$0),ability:f.ability,type:f.type,id:f.id}),y=$0}}else y=P.pos+5}if(y<L.length){let C=k[k.length-1];if(O.length>0&&O[O.length-1].type==="else")k.push({content:L.slice(y),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(y)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let C=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,C=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,C=!0;break}}}if(!C&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function P3($,X,Z){let J=$;function Y(G,Q,w,q,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${Q}\\s*\\(`),U=G.match(z);if(!U||U.index===void 0)break;let B=U.index,j=P1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=t1(G,Q,w,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let L=G.slice(_,H),O=j.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=q(O.trim()),N;if(F!==-1){let T=L.slice(0,F),M=L.slice(F+5);N=R?T:M}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Z0(W,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${w}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=g1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=g1(G,X);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"),J}function v3($,X,Z){let J=$,Y="development";function G(Q,w,q,W){let K=new RegExp(`@${w}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=Q,_=!0;while(_){_=!1,K.lastIndex=0;let H=K.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(w==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,W=Y===I[2]}let F=1,V=O,A=-1;while(F>0&&V<j.length){K.lastIndex=V,z.lastIndex=V;let I=K.exec(j),S=z.exec(j),b=I?I.index:1/0,C=S?S.index:1/0;if(b<C)F++,V=b+I[0].length;else if(C<1/0){if(F--,F===0){A=C;break}V=C+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=W?I:S}else k=W?R:"";let y=`@${q}`.length;j=j.substring(0,L)+k+j.substring(A+y),_=!0}return j}return J=G(J,"env","endenv",!1),J=G(J,"production","endproduction",Y==="production"),J=G(J,"development","enddevelopment",Y==="development"),J=G(J,"staging","endstaging",Y==="staging"),J=G(J,"testing","endtesting",Y==="testing"),J}var c$=D(()=>{uY();F1();f8();T0()});function lY($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function p$($,X){if(!$)return X?.nonceGenerator?.()??lY();let Z=mY.get($);if(!Z)Z=X?.nonceGenerator?.()??lY(),mY.set($,Z);return Z}function QB($,X){let Z=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)Z.push(J);continue}if(Array.isArray(Y)){let G=[...Y];if(X&&(J==="script-src"||J==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${J} ${G.join(" ")}`)}}return Z.join("; ")}function cY($,X){return`<meta http-equiv="Content-Security-Policy" content="${QB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function pY($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=X.useNonce?p$(Z,X):void 0,Y=cY(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12012
- ${Y}`)}function iY($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${X}"${Y}>`}),Z=Z.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${X}"${Y}>`}),Z}function nY($,X,Z,J){let Y=$,G=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?p$(X,G):void 0;return cY(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return p$(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=p$(X,G);return Y}var mY;var rY=D(()=>{mY=new WeakMap});import wB from"crypto";function WB($=qB){let X=wB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return x3=X,X}function KB(){if(!x3)WB();return x3}function zB($=oY){let X=KB();return`<input type="hidden" name="${$}" value="${X}">`}function sY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return zB(J||oY)})}var qB=40,oY="_token",x3=null;var aY=()=>{};async function tY($,X,Z,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let G of J.customDirectives){if(!G.name||typeof G.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)Y=await UB(Y,G,X,Z,J);else Y=await jB(Y,G,X,Z,J)}return Y}async function UB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=`@${G}`,q=`@end${G}`,W=$,K=I5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=K.exec(W);while(U!==null){let[B,j="",_=""]=U,H=U.index||0;try{let L=j?eY(j):[],O=_.trim(),F=await Q(O,L,Z,J);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:Z0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:H})}U=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function jB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=$,q=I5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let H=eY(j),L=await Q("",H,Z,J);W.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:Z0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:_})}K=q.exec(w)}let z=I5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let _=await Q("",[],Z,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);W.push({original:B,processed:Z0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:j})}U=z.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];w=w.replace(j,_)}return w}function eY($){if(!$.trim())return[];let X=[],Z="",J=!1,Y="";for(let G=0;G<$.length;G++){let Q=$[G];if((Q==='"'||Q==="'")&&(G===0||$[G-1]!=="\\"))if(!J)J=!0,Y=Q;else if(Q===Y)J=!1;else Z+=Q;else if(Q===","&&!J)X.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())X.push(Z.trim());return X.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 $G=D(()=>{F1();E5()});function w5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function _B($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,J=X.colorMode;if(w5(X.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(w5(Z.key,"appearance.key"),w5(Z.attribute,"appearance.attribute"),w5(Z.default,"appearance.default"),w5(J.key,"colorMode.key"),w5(J.attribute,"colorMode.attribute"),w5(J.default,"colorMode.default"),!ZG.test(Z.key)||!ZG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!XG.test(Z.attribute)||!XG.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((Y)=>typeof Y!=="string"||Y.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(!BB.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:X.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function HB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function OB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HB($)};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 LB($,X){let Z=1,J=null,Y=!1;for(let G=X+1;G<$.length;G++){let Q=$[G];if(Y){Y=!1;continue}if(J){if(Q==="\\")Y=!0;else if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function JG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=LB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=J0(`(${w})`,X),W=OB(_B(q));Z=Z.slice(0,Y.index)+W+Z.slice(Q+1),J.lastIndex=Y.index+W.length}return Z}var XG,ZG,BB;var YG=D(()=>{T0();XG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ZG=/^[A-Za-z_$][\w$]*$/,BB=new Set(["light","dark","system"])});import FB from"crypto";function L0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i$($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function n0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f5($,X){if(/\bid\s*=/i.test($))return"";return` id="${L0(X)}"`}function f3($,X,Z){if(!X)return"";let J="";if(!/\baria-invalid\s*=/i.test(Z))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))J+=` aria-describedby="${L0(`${n0($)}-error`)}"`;return J}function VB(){return FB.randomUUID()}function n$($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=VB();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${L0(X.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let G=Y.toUpperCase();if(Y&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${L0(G)}">`;return J}),Z}function wG($,X,Z=QG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"POST",z=w||q||"",U=h1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${L0(j)}" action="${L0(z)}"${U?` ${U}`:""}>`;if(_+=`
12089
+ `+Y.slice(Q);else Y+=G;return Y}function oj($,X){let Z=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,G,Q)=>{let w=X[Z++];if(!w)return Y;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,Y;return`<${G} data-stx-scope="${w.id}"${Q}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function sj($){return/x-data\s*=\s*["']/.test($)}var vY=0,mj=0;var fY=D(()=>{W1()});import aj from"fs";import b3 from"path";import{createHighlighter as tj}from"ts-syntax-highlighter";async function ej($,X={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let J=(await aj.promises.stat($)).mtime.getTime();if(X.cache&&S3.has($)){let z=S3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=h2(Y),w=X.markdown||T7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=V7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await $B(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)S3.set($,{...K,updatedAt:J});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let J=Z instanceof Error?Z.message:String(Z);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function $B($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!l$)try{l$=await tj({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let Y=async(w,q,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!l$.getSupportedLanguages().includes(U))return w;return(await l$.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(J);for(let w of Q){let[q,W,K,z]=w,U=await Y(q,W,K,z);G=G.replace(q,U)}return G}async function gY($,X,Z="",J={}){return await XB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!b3.isAbsolute(w))K=b3.resolve(b3.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);z[A]=R}}}}catch(L){if(J.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:B}=await ej(K,J),j={...X,...B,...z},_=U,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(K){let z=K instanceof Error?K.message:String(K);return z0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function XB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let w=Y[0],q=Y.index,W=Y;J.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(J);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var S3,l$=null;var hY=D(()=>{L1();k0();S3=new Map});function g1($,X){try{let Z=$.trim();if(q0(Z))return W0(Z,Object.keys(X))(...Object.values(X));else return J0(Z,X)}catch{return!1}}var uY=D(()=>{T0()});function ZB($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=_X(J,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys(X))(...Object.values(X));else q=J0(w.expression,X);let W="",K=!1;for(let z of w.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let U;if(z.value&&q0(z.value))U=W0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=J0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+W+J.substring(w.end),Y=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(w.end);break}}return J}function JB($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return X.push(J),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function YB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function Q5($,X,Z){let{masked:J,scripts:Y}=JB($);return YB(GB(J,X,Z),Y)}function GB($,X,Z){let J=$;J=ZB(J,X,Z);{let G=!0;while(G){G=!1;let Q=J.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(J,w+7);if(!q)break;let W=q.endPos,K=t1(J,"unless","endunless",W);if(K===-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 z=J.slice(W,K),U=q.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==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")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${U})${H}@else ${_}@endif`}else j=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+j+J.substring(K+10),G=!0}}J=P3(J,X,Z),J=v3(J,X,Z),J=C3(J,X);let Y=()=>{let G=x7(J);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 K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&q0(K.condition))z=W0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=J0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=Z0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}J=J.substring(0,w.start)+q+J.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,w.start)+K+J.substring(w.end)}}return!0};while(!0){let G=J;if(!Y())break;if(J===G)break}return J}function dY($){let X=0;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let Z=$[X];if(Z!=="'"&&Z!=='"')return null;X++;let J=[];while(X<$.length){let Y=$[X];if(Y==="\\"&&X+1<$.length){J.push($[X+1]),X+=2;continue}if(Y===Z){X++;break}J.push(Y),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:J.join(""),consumed:X}}function C3($,X){let Z=$;function J(w,q,W,K){let z=1,U=K,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(U<w.length&&z>0){B.lastIndex=U,j.lastIndex=U;let _=B.exec(w),H=j.exec(w),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)z++,U=L+_[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+H[0].length}else break}return-1}function Y(w,q,W){let K=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(w))!==null)j.push({pos:_.index,type:"open"});while((_=U.exec(w))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(w))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")K++;else if(H.type==="close")K--;else if(H.type==="else"&&K===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,K,z,U=Z.slice(W+5),B=dY(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?g1(`auth?.check && auth?.user?.[${K}]`,X):g1("auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+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,K,z,U=Z.slice(W+6),B=dY(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?g1(`!auth?.check || !auth?.user?.[${K}]`,X):g1("!auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+9),w=!0}}function G(w,q,W){if(X.userCan&&typeof X.userCan[w]==="boolean")return X.userCan[w];if(X.permissions?.check&&typeof X.permissions.check==="function")try{let K=[w];if(q)K.push(q);if(W){let z=g1(W,X);K.push(z)}return X.permissions.check(...K)}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",K=!0;while(K){K=!1;let z=Z.match(new RegExp(`@${w}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,B=Z.slice(U+`@${w}`.length),j=Q(B);if(!j)break;let _=U+`@${w}`.length+j.paramsEnd,H=J(Z,w,q,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((C,P)=>C.pos-P.pos);for(let C of T){if(C.type==="open"){F++;continue}if(C.type==="close"){F--;continue}if(F===0)O.push(C)}let k=[],y=0;for(let C=0;C<O.length;C++){let P=O[C];if(k.push({content:L.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${W}`.length),f=Q(x);if(f){k[k.length-1]={content:L.slice(y,P.pos)},y=P.pos+`@${W}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let l=O[C+1],$0=l?l.pos:L.length;k.push({content:L.slice(y,$0),ability:f.ability,type:f.type,id:f.id}),y=$0}}else y=P.pos+5}if(y<L.length){let C=k[k.length-1];if(O.length>0&&O[O.length-1].type==="else")k.push({content:L.slice(y),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(y)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let C=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,C=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,C=!0;break}}}if(!C&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function P3($,X,Z){let J=$;function Y(G,Q,w,q,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${Q}\\s*\\(`),U=G.match(z);if(!U||U.index===void 0)break;let B=U.index,j=P1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=t1(G,Q,w,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let L=G.slice(_,H),O=j.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=q(O.trim()),N;if(F!==-1){let T=L.slice(0,F),M=L.slice(F+5);N=R?T:M}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Z0(W,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${w}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=g1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=g1(G,X);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"),J}function v3($,X,Z){let J=$,Y="development";function G(Q,w,q,W){let K=new RegExp(`@${w}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=Q,_=!0;while(_){_=!1,K.lastIndex=0;let H=K.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(w==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,W=Y===I[2]}let F=1,V=O,A=-1;while(F>0&&V<j.length){K.lastIndex=V,z.lastIndex=V;let I=K.exec(j),S=z.exec(j),b=I?I.index:1/0,C=S?S.index:1/0;if(b<C)F++,V=b+I[0].length;else if(C<1/0){if(F--,F===0){A=C;break}V=C+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=W?I:S}else k=W?R:"";let y=`@${q}`.length;j=j.substring(0,L)+k+j.substring(A+y),_=!0}return j}return J=G(J,"env","endenv",!1),J=G(J,"production","endproduction",Y==="production"),J=G(J,"development","enddevelopment",Y==="development"),J=G(J,"staging","endstaging",Y==="staging"),J=G(J,"testing","endtesting",Y==="testing"),J}var c$=D(()=>{uY();V1();f8();T0()});function lY($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function p$($,X){if(!$)return X?.nonceGenerator?.()??lY();let Z=mY.get($);if(!Z)Z=X?.nonceGenerator?.()??lY(),mY.set($,Z);return Z}function QB($,X){let Z=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)Z.push(J);continue}if(Array.isArray(Y)){let G=[...Y];if(X&&(J==="script-src"||J==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${J} ${G.join(" ")}`)}}return Z.join("; ")}function cY($,X){return`<meta http-equiv="Content-Security-Policy" content="${QB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function pY($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=X.useNonce?p$(Z,X):void 0,Y=cY(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12090
+ ${Y}`)}function iY($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${X}"${Y}>`}),Z=Z.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${X}"${Y}>`}),Z}function nY($,X,Z,J){let Y=$,G=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?p$(X,G):void 0;return cY(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return p$(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=p$(X,G);return Y}var mY;var rY=D(()=>{mY=new WeakMap});import wB from"crypto";function WB($=qB){let X=wB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return x3=X,X}function KB(){if(!x3)WB();return x3}function zB($=oY){let X=KB();return`<input type="hidden" name="${$}" value="${X}">`}function sY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return zB(J||oY)})}var qB=40,oY="_token",x3=null;var aY=()=>{};async function tY($,X,Z,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let G of J.customDirectives){if(!G.name||typeof G.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)Y=await UB(Y,G,X,Z,J);else Y=await jB(Y,G,X,Z,J)}return Y}async function UB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=`@${G}`,q=`@end${G}`,W=$,K=I5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=K.exec(W);while(U!==null){let[B,j="",_=""]=U,H=U.index||0;try{let L=j?eY(j):[],O=_.trim(),F=await Q(O,L,Z,J);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:Z0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:H})}U=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function jB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=$,q=I5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let H=eY(j),L=await Q("",H,Z,J);W.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:Z0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:_})}K=q.exec(w)}let z=I5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let _=await Q("",[],Z,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);W.push({original:B,processed:Z0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:j})}U=z.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];w=w.replace(j,_)}return w}function eY($){if(!$.trim())return[];let X=[],Z="",J=!1,Y="";for(let G=0;G<$.length;G++){let Q=$[G];if((Q==='"'||Q==="'")&&(G===0||$[G-1]!=="\\"))if(!J)J=!0,Y=Q;else if(Q===Y)J=!1;else Z+=Q;else if(Q===","&&!J)X.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())X.push(Z.trim());return X.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 $G=D(()=>{V1();E5()});function w5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function _B($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,J=X.colorMode;if(w5(X.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(w5(Z.key,"appearance.key"),w5(Z.attribute,"appearance.attribute"),w5(Z.default,"appearance.default"),w5(J.key,"colorMode.key"),w5(J.attribute,"colorMode.attribute"),w5(J.default,"colorMode.default"),!ZG.test(Z.key)||!ZG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!XG.test(Z.attribute)||!XG.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((Y)=>typeof Y!=="string"||Y.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(!BB.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:X.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function HB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function OB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HB($)};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 LB($,X){let Z=1,J=null,Y=!1;for(let G=X+1;G<$.length;G++){let Q=$[G];if(Y){Y=!1;continue}if(J){if(Q==="\\")Y=!0;else if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function JG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=LB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=J0(`(${w})`,X),W=OB(_B(q));Z=Z.slice(0,Y.index)+W+Z.slice(Q+1),J.lastIndex=Y.index+W.length}return Z}var XG,ZG,BB;var YG=D(()=>{T0();XG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ZG=/^[A-Za-z_$][\w$]*$/,BB=new Set(["light","dark","system"])});import FB from"crypto";function L0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i$($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function n0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f5($,X){if(/\bid\s*=/i.test($))return"";return` id="${L0(X)}"`}function f3($,X,Z){if(!X)return"";let J="";if(!/\baria-invalid\s*=/i.test(Z))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))J+=` aria-describedby="${L0(`${n0($)}-error`)}"`;return J}function VB(){return FB.randomUUID()}function n$($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=VB();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${L0(X.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let G=Y.toUpperCase();if(Y&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${L0(G)}">`;return J}),Z}function wG($,X,Z=QG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"POST",z=w||q||"",U=h1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${L0(j)}" action="${L0(z)}"${U?` ${U}`:""}>`;if(_+=`
12013
12091
  ${n$("@csrf",X)}`,!["GET","POST"].includes(B))_+=`
12014
12092
  ${n$(`@method('${B}')`,X)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"",z=w||q||"",U=h1(W),B=n7(K,X),j=B!==void 0&&B!==null?B:z||"",_=U.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=r7(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=i$(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(H)}" name="${L0(K)}"${f5(U,n0(K))} value="${L0(j)}" class="${F}"${f3(K,L,U)}${V?` ${V}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,G,Q="",w="")=>{let q=h1(Q),W=n7(G,X)||w.trim(),K=r7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=i$(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L0(G)}"${f5(q,n0(G))} class="${U}"${f3(G,K,q)}${B?` ${B}`:""}>${L0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",w)=>{let q=h1(Q),W=n7(G,X),K=r7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=i$(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=w;if(W!==void 0)j=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(W)?W.some((F)=>String(F)===L):String(W)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${L0(G)}"${f5(q,n0(G))} class="${U}"${f3(G,K,q)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?n0(G):`${n0(G)}-${n0(q)}`,K=h1(w),z=n7(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((H)=>String(H)===q):z===!0||String(z)===q),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${L0(G)}"${f5(K,W)} value="${L0(q)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=h1(w),W=n7(G,X),K=W!==void 0&&W===Q,z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${L0(G)}"${f5(q,`${n0(G)}-${n0(Q)}`)} value="${L0(Q)}" class="${U}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q="")=>{let w=h1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",K=w.includes("multiple"),z=r7(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),B=i$(U?U[1]:"",Z.input,z,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${L0(G)}"${f5(w,n0(G))}`,`class="${B}"`];if(W)_.push(`accept="${L0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,G,Q="",w)=>{let q=h1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:Z.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L0(n0(G))}" class="${K}"${z?` ${z}`:""}>${w}</label>`}),J}function qG($,X,Z=QG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(r7(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return GG(Y,X);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(Y);return GG(Y,X)}let W=q.trim();if(q0(W)){let K=J0(W,X);return K!==void 0?String(K):W}return W}catch{return q}});return`<div id="${L0(`${n0(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function r7($,X){if(!X.errors)return!1;if(typeof X.errors.has==="function")return X.errors.has($);if(typeof X.errors==="object")return Object.prototype.hasOwnProperty.call(X.errors,$);return!1}function GG($,X){if(!X.errors)return"";if(typeof X.errors.get==="function")return X.errors.get($);if(typeof X.errors==="object"&&Object.prototype.hasOwnProperty.call(X.errors,$)){let Z=X.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function n7($,X){let Z;if(X.old&&typeof X.old==="function")return X.old($);if(X.old&&typeof X.old==="object")return X.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Z=X[J],Z!==void 0)return Z}return X[$]}function h1($){if(!$.trim())return"";let X=[],Z=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(Z))!==null){let[,G,,Q]=Y;X.push(`${G}="${Q.trim()}"`)}return X.join(" ")}var QG;var WG=D(()=>{T0();QG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import u3 from"path";async function AB(){if(o7!==void 0)return o7;try{o7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{o7=null}return o7}function RB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function NB($,X){if({...l3,...X.i18n}.cache&&d3[$]){let Y=d3[$],G=X.i18n?.cacheMaxAge??0;if(!RB(Y,G))return Y.translations}if(s7[$]?.state==="loading")return s7[$].promise;g3[$]="loading";let J=m3($,X).then((Y)=>{return g3[$]="loaded",delete s7[$],Y}).catch((Y)=>{throw g3[$]="error",s7[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return s7[$]={promise:J,state:"loading"},J}async function m3($,X){let Z={...l3,...X.i18n},J=u3.isAbsolute(Z.translationsDir)?Z.translationsDir:u3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await AB(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:EB(Z.format)}):await TB($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return m3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)d3[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(Y){if(X.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==Z.defaultLocale)return m3(Z.defaultLocale,X);return{}}}async function TB($,X,Z){let J=u3.join(Z,`${$}${MB(X.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let G=await Bun.file(J).text();if(X.format==="yaml"||X.format==="yml")return kB(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function MB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function kB($){let X={},Z=$.split(`
12015
- `),J=[{obj:X,indent:-1}];for(let Y of Z){let G=Y.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let w=J[J.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},J.push({obj:w[z],indent:Q});else w[z]=IB(U)}}return X}function IB($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let X=$.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Z=Number($);if(!Number.isNaN(Z)&&$!=="")return Z;return $}function EB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function DB($,X){return NB($,X)}function yB($,X){for(let Z of $){let J=Z.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let Q=Number.parseInt(Y[1],10);if(X===Q)return Y[2];continue}let G=J.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(X>=Q&&X<=w)return G[3];continue}}if($.length===2)return X===1?$[0].trim():$[1].trim();if(X<$.length)return $[X].trim();return $[$.length-1].trim()}function bB($,X={}){return UG($,X)}function UG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=SB($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=CB(G,X),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Z+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Z+=$[J+1],J+=2;else Z+=$[J],J++;else Z+=$[J],J++;return Z}function SB($,X){let Z=0;for(let J=X;J<$.length;J++)if($[J]==="{")Z++;else if($[J]==="}"){if(Z--,Z===0)return J}return-1}function CB($,X){let Z=PB($);if(Z.length===0)return`{${$}}`;let J=Z[0].trim(),Y=X[J];if(Z.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(Z[1].trim().toLowerCase()){case"plural":return vB(Y,Z.slice(2).join(","),X);case"select":return fB(Y,Z.slice(2).join(","));case"selectordinal":return gB(Y,Z.slice(2).join(","));case"number":return uB(Y,Z[2]?.trim());case"date":return dB(Y,Z[2]?.trim());case"time":return mB(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function PB($){let X=[],Z="",J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(G==="{")J++,Z+=G;else if(G==="}")J--,Z+=G;else if(G===","&&J===0)X.push(Z),Z="";else Z+=G}if(Z)X.push(Z);return X}function vB($,X,Z){let J=Number($)||0,Y=c3(X),G=`=${J}`;if(Y[G])return h3(Y[G],J,Z);let Q=xB(J);if(Y[Q])return h3(Y[Q],J,Z);if(Y.other)return h3(Y.other,J,Z);return String(J)}function h3($,X,Z){let J=$.replace(/#/g,String(X));return UG(J,Z)}function xB($){let X=Math.abs($),Z=Math.floor(X),J=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&J===0)return"one";return"other"}function fB($,X){let Z=String($||""),J=c3(X);if(J[Z])return J[Z];return J.other||String($)}function gB($,X){let Z=Number($)||0,J=c3(X),Y=hB(Z);if(J[Y])return J[Y].replace(/#/g,String(Z));if(J.other)return J.other.replace(/#/g,String(Z));return String(Z)}function hB($){let X=Math.abs($),Z=X%10,J=X%100;if(Z===1&&J!==11)return"one";if(Z===2&&J!==12)return"two";if(Z===3&&J!==13)return"few";return"other"}function c3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function uB($,X){let Z=Number($);if(Number.isNaN(Z))return String($);switch(X){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 dB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Z.toLocaleDateString(void 0,J)}function mB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Z.toLocaleTimeString(void 0,J)}function lB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KG($,X,Z=!0,J={}){let Y=$.split("."),G=X;for(let w of Y){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?$:"";let Q=String(G);if(lB(Q))return bB(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),q=Q.split("|");Q=yB(q,w)}for(let[w,q]of Object.entries(J)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function jG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...l3,...J.i18n},w=await DB(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await zG(Y,G,async(K,z,U,B,j)=>{try{let _={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return N0(U,X)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return KG(z,w,Q.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(q)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await zG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,B)=>{try{let j={};if(U)try{let _=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return N0(U,X)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return KG(z,w,Q.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return Z0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Y}async function zG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return J.push(w),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),$)}var o7,l3,d3,s7,g3;var BG=D(()=>{F1();T0();l3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},s7={},g3={}});var n3={};a(n3,{streamingSuspenseDirective:()=>OG,streamToResponse:()=>X_,streamTemplateSimple:()=>aB,streamTemplate:()=>pB,renderStreamingPage:()=>nB,registerStreamingDirectives:()=>eB,processStreamDirectives:()=>oB,processSectionDirectives:()=>$_,islandDirective:()=>LG,generateHydrationRuntime:()=>Z_,extractStreamBoundaries:()=>sB,createStreamRenderer:()=>tB,buildSuspenseResolveScript:()=>i3,SUSPENSE_RESOLVER_RUNTIME:()=>HG});import r$ from"path";function cB($){let X=[],Z=0,J;_G.lastIndex=0;while((J=_G.exec($))!==null){if(J.index>Z){let Q=$.slice(Z,J.index);if(Q.trim())X.push({type:X.length===0?"shell":"content",content:Q})}let Y=J[1],G=J[2];X.push({type:"suspense",name:Y,content:G}),Z=J.index+J[0].length}if(Z<$.length){let Y=$.slice(Z);if(Y.trim())X.push({type:X.length===0?"shell":"content",content:Y})}if(X.length===0)X.push({type:"shell",content:$});return X}async function pB($,X={},Z={}){let J={...G5,...Z,streaming:{...p3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).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,""),K={...X,__filename:$,__dirname:r$.dirname($)};if(q.trim())await a1(q,K,$);let z=cB(W),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",_=new RegExp(q5.source,"g");if(!(j!=="manual"&&_.test(W))){let L=await O0(W,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(q5.source,"g"),F;while((F=O.exec(W))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=W.slice(V,A.start);if(N.trim()){let T=await O0(N,K,$,J,U);G.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await O0(A.content,K,$,J,U);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await O0(A,K,$,J,U);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await O0(H.content,K,$,J,U);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
12093
+ `),J=[{obj:X,indent:-1}];for(let Y of Z){let G=Y.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let w=J[J.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},J.push({obj:w[z],indent:Q});else w[z]=IB(U)}}return X}function IB($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let X=$.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Z=Number($);if(!Number.isNaN(Z)&&$!=="")return Z;return $}function EB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function DB($,X){return NB($,X)}function yB($,X){for(let Z of $){let J=Z.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let Q=Number.parseInt(Y[1],10);if(X===Q)return Y[2];continue}let G=J.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(X>=Q&&X<=w)return G[3];continue}}if($.length===2)return X===1?$[0].trim():$[1].trim();if(X<$.length)return $[X].trim();return $[$.length-1].trim()}function bB($,X={}){return UG($,X)}function UG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=SB($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=CB(G,X),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Z+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Z+=$[J+1],J+=2;else Z+=$[J],J++;else Z+=$[J],J++;return Z}function SB($,X){let Z=0;for(let J=X;J<$.length;J++)if($[J]==="{")Z++;else if($[J]==="}"){if(Z--,Z===0)return J}return-1}function CB($,X){let Z=PB($);if(Z.length===0)return`{${$}}`;let J=Z[0].trim(),Y=X[J];if(Z.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(Z[1].trim().toLowerCase()){case"plural":return vB(Y,Z.slice(2).join(","),X);case"select":return fB(Y,Z.slice(2).join(","));case"selectordinal":return gB(Y,Z.slice(2).join(","));case"number":return uB(Y,Z[2]?.trim());case"date":return dB(Y,Z[2]?.trim());case"time":return mB(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function PB($){let X=[],Z="",J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(G==="{")J++,Z+=G;else if(G==="}")J--,Z+=G;else if(G===","&&J===0)X.push(Z),Z="";else Z+=G}if(Z)X.push(Z);return X}function vB($,X,Z){let J=Number($)||0,Y=c3(X),G=`=${J}`;if(Y[G])return h3(Y[G],J,Z);let Q=xB(J);if(Y[Q])return h3(Y[Q],J,Z);if(Y.other)return h3(Y.other,J,Z);return String(J)}function h3($,X,Z){let J=$.replace(/#/g,String(X));return UG(J,Z)}function xB($){let X=Math.abs($),Z=Math.floor(X),J=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&J===0)return"one";return"other"}function fB($,X){let Z=String($||""),J=c3(X);if(J[Z])return J[Z];return J.other||String($)}function gB($,X){let Z=Number($)||0,J=c3(X),Y=hB(Z);if(J[Y])return J[Y].replace(/#/g,String(Z));if(J.other)return J.other.replace(/#/g,String(Z));return String(Z)}function hB($){let X=Math.abs($),Z=X%10,J=X%100;if(Z===1&&J!==11)return"one";if(Z===2&&J!==12)return"two";if(Z===3&&J!==13)return"few";return"other"}function c3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function uB($,X){let Z=Number($);if(Number.isNaN(Z))return String($);switch(X){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 dB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Z.toLocaleDateString(void 0,J)}function mB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Z.toLocaleTimeString(void 0,J)}function lB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KG($,X,Z=!0,J={}){let Y=$.split("."),G=X;for(let w of Y){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?$:"";let Q=String(G);if(lB(Q))return bB(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),q=Q.split("|");Q=yB(q,w)}for(let[w,q]of Object.entries(J)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function jG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...l3,...J.i18n},w=await DB(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await zG(Y,G,async(K,z,U,B,j)=>{try{let _={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return N0(U,X)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return KG(z,w,Q.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(q)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await zG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,B)=>{try{let j={};if(U)try{let _=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return N0(U,X)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return KG(z,w,Q.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return Z0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Y}async function zG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return J.push(w),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),$)}var o7,l3,d3,s7,g3;var BG=D(()=>{V1();T0();l3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},s7={},g3={}});var n3={};a(n3,{streamingSuspenseDirective:()=>OG,streamToResponse:()=>X_,streamTemplateSimple:()=>aB,streamTemplate:()=>pB,renderStreamingPage:()=>nB,registerStreamingDirectives:()=>eB,processStreamDirectives:()=>oB,processSectionDirectives:()=>$_,islandDirective:()=>LG,generateHydrationRuntime:()=>Z_,extractStreamBoundaries:()=>sB,createStreamRenderer:()=>tB,buildSuspenseResolveScript:()=>i3,SUSPENSE_RESOLVER_RUNTIME:()=>HG});import r$ from"path";function cB($){let X=[],Z=0,J;_G.lastIndex=0;while((J=_G.exec($))!==null){if(J.index>Z){let Q=$.slice(Z,J.index);if(Q.trim())X.push({type:X.length===0?"shell":"content",content:Q})}let Y=J[1],G=J[2];X.push({type:"suspense",name:Y,content:G}),Z=J.index+J[0].length}if(Z<$.length){let Y=$.slice(Z);if(Y.trim())X.push({type:X.length===0?"shell":"content",content:Y})}if(X.length===0)X.push({type:"shell",content:$});return X}async function pB($,X={},Z={}){let J={...G5,...Z,streaming:{...p3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).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,""),K={...X,__filename:$,__dirname:r$.dirname($)};if(q.trim())await a1(q,K,$);let z=cB(W),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",_=new RegExp(q5.source,"g");if(!(j!=="manual"&&_.test(W))){let L=await O0(W,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(q5.source,"g"),F;while((F=O.exec(W))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=W.slice(V,A.start);if(N.trim()){let T=await O0(N,K,$,J,U);G.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await O0(A.content,K,$,J,U);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await O0(A,K,$,J,U);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await O0(H.content,K,$,J,U);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
12016
12094
  <template data-suspense-fallback>Loading...</template>
12017
12095
  </div>`),j.set(H.name,O0(H.content,K,$,J,U))}G.enqueue(`
12018
12096
  <script>
@@ -12198,7 +12276,7 @@ else {
12198
12276
  }
12199
12277
  };
12200
12278
  })();
12201
- </script>`,rB,OG,LG;var r3=D(()=>{O1();q1();Y$();k0();p3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,_G=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;rB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;OG={name:"suspense",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Suspense directive requires a name parameter");let Y=X[0].replace(/['"`]/g,"");return`<!-- @suspense:${Y} -->${$}<!-- @endsuspense:${Y} -->`}},LG={name:"island",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Island directive requires a name parameter");let Y=X[0].replace(/['"`]/g,""),G=X[1]?X[1].replace(/['"`]/g,""):"lazy",Q=`island-${Y}-${Math.random().toString(36).substring(2,9)}`,w=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?$.replace(w[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12279
+ </script>`,rB,OG,LG;var r3=D(()=>{L1();W1();Y$();k0();p3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,_G=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;rB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;OG={name:"suspense",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Suspense directive requires a name parameter");let Y=X[0].replace(/['"`]/g,"");return`<!-- @suspense:${Y} -->${$}<!-- @endsuspense:${Y} -->`}},LG={name:"island",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Island directive requires a name parameter");let Y=X[0].replace(/['"`]/g,""),G=X[1]?X[1].replace(/['"`]/g,""):"lazy",Q=`island-${Y}-${Math.random().toString(36).substring(2,9)}`,w=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?$.replace(w[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12202
12280
  ${W}
12203
12281
  <script type="application/json" data-island-props="${Q}">
12204
12282
  ${q?`{${q}}`:"{}"}
@@ -12243,7 +12321,7 @@ ${I}
12243
12321
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
12244
12322
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
12245
12323
  </style>`}}});import{existsSync as z_,readFileSync as U_}from"fs";function j_($){if(SG.has($))return;SG.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function B_($){let X=process.cwd();for(let Z of[`${X}/node_modules/@iconify-json/${$}/icons.json`,`${X}/pantry/@iconify-json/${$}/icons.json`,`${X}/node_modules/@iconify/json/json/${$}.json`,`${X}/pantry/@iconify/json/json/${$}.json`])if(z_(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Z)}catch{}return null}function __($){if(t$.has($))return t$.get($);let X=B_($);if(!X)return j_($),null;try{let Z=JSON.parse(U_(X,"utf8"));return t$.set($,Z.icons),Z.icons}catch{return null}}function m5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);if($.static[X]!==void 0)return String($.static[X]);if($.clientReactive[X]!==void 0)return $.clientReactive[X];return}var t$,SG,O4;var L4=D(()=>{t$=new Map,SG=new Set;O4={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=m5($,"name")??m5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",G=J;if(J.includes(":")){let O=J.split(":");Y=O[0],G=O[1]}let Q=y0(m5($,"size")||"24"),w=y0(m5($,"color")||"currentColor"),q=y0(m5($,"class")||""),W=y0(m5($,"style")||""),K=t$.get(Y)??__(Y);if(!K)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=K[G];if(!z)return`<!-- Icon: "${G}" not found in ${Y} -->`;let U=z.width||24,B=z.height||24,j=`0 0 ${U} ${B}`,_=z.body;if(w!=="currentColor")_=_.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",L=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function CG($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}function PG($,X){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${X}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Z);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var F4;var V4=D(()=>{F4={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=PG(X,"fallback"),Y=J.rest,G=PG(Y,"error"),Q=G.rest,w=J.region??CG($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??CG($,"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 e$($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}var A4;var R4=D(()=>{A4={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(e$($,"name")||"v").replace(/["'<>]/g,""),Y=(e$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=e$($,"class"),Q=e$($,"id"),w=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${w}>${X}</${Y}>`}}});function vG(){d0.registerBuiltin(e3),d0.registerBuiltin(Y4),d0.registerBuiltin(Q4),d0.registerBuiltin(W4),d0.registerBuiltin(z4),d0.registerBuiltin(j4),d0.registerBuiltin(_4),d0.registerBuiltin(O4),d0.registerBuiltin(F4),d0.registerBuiltin(A4)}var xG=D(()=>{$4();G4();w4();K4();U4();B4();H4();L4();V4();R4();t3();$4();G4();w4();K4();U4();B4();H4();L4();V4();R4()});function $9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function fG($,X,Z){let J=[],Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let w=$.slice(G+1).match(new RegExp(`^(${X.source})(?![\\w.:-])`));if(!w){Y=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=G+1+q.length,K=null,z=W,U=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){U=W+2,B=!0;break}if(_===">"){U=W+1;break}W++}if(U===-1){Y=G+1;continue}let j=$.slice(z,B?U-2:U-1).trim();if(B)J.push({fullMatch:$.slice(G,U),tagName:q,attributes:j,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let _=`<${q}`,H=`</${q}>`,L=1,O=U,F=-1;while(L>0&&O<$.length){let R=$.indexOf(_,O),N=$.indexOf(H,O);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+_.length];if(T===" "||T===">"||T==="/"||T===`
12246
- `||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+H.length;J.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function gG($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function hG($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var uG=D(()=>{T0();k0();r1()});var nG={};a(nG,{processESImports:()=>pG,processComponents:()=>Z9});import X9 from"fs";import i0 from"path";function O_($,X,Z){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Y=new Set(l2),G=(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,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(J.static[W]=q,W!==w)J.staticNames[W]=w};for(let[w,q]of Object.entries($)){let W=w.startsWith("x-")&&!Y.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){J.events[W]=q;continue}if(W.startsWith("__stx_")){let K=G(W.slice(6));J.serverDynamic[K]=hG(q,Z);continue}if(W.startsWith(":")){let K=G(W.slice(1)),z=q===W5?K:q;if(K==="if"||K==="for"||K==="show"){J.clientReactive[K]=z;continue}try{if(!q0(z)){if(Z.debug)console.error(`Unsafe expression in :${K} binding: ${z}`);J.clientReactive[K]=z;continue}let U=Object.keys(X),j=W0(z,U)(...Object.values(X));if(j===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!U.includes(O))){J.clientReactive[K]=z;continue}}J.serverDynamic[K]=j}catch{J.clientReactive[K]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let K=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(K)try{let z=K[1];if(q0(z)){let B=W0(z,Object.keys(X))(...Object.values(X));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${z}`);Q(W,q)}}catch(z){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,z);Q(W,q)}else{let z=q,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(q))!==null)try{let j=B[1];if(!q0(j)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let H=W0(j,Object.keys(X))(...Object.values(X));z=z.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,j)}Q(W,z)}continue}Q(W,q===W5?"true":gG(q))}return J}function L_($){let X={},Z=0,J=$.length;while(Z<J){while(Z<J&&/\s/.test($[Z]))Z++;if(Z>=J)break;let Y="";while(Z<J&&!/[\s=]/.test($[Z]))Y+=$[Z],Z++;if(!Y)break;while(Z<J&&/\s/.test($[Z]))Z++;if(Z<J&&$[Z]==="="){Z++;while(Z<J&&/\s/.test($[Z]))Z++;let G="";if(Z<J&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<J){let w=$[Z];if(w==="\\"&&Z+1<J){Z++,G+=$[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<J&&!/\s/.test($[Z]))G+=$[Z],Z++;X[Y]=G}else X[Y]=W5}return X}function mG($){return Object.entries($).map(([X,Z])=>Z===W5?X:`${X}="${F_(Z)}"`).join(" ")}function F_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Z.exec($))!==null){let Y=J[1];if(d0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function A_($){let X=lG.get($);if(X)return X;let Z=new Map,J=[i0.join($,"src"),i0.join($,"dist"),$];function Y(G,Q){if(Q>6)return;let w;try{w=X9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=i0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,W);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,W)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return lG.set($,Z),Z}function R_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=i0.join(Z,"node_modules",$);try{if(X9.statSync(J).isDirectory())return J}catch{}let Y=i0.dirname(Z);if(Y===Z)return null;Z=Y}}async function pG($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=i0.dirname(Z),w=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=U.exec(z))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=i0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(X9.statSync(M).isFile())A=M}catch{try{if(X9.statSync(T).isDirectory())V=T}catch{}}}}else V=R_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),Y.add(M)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let y=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:k,local:k}}),M=V?A_(V):null;for(let{source:k,local:y}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(y,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return W;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${K}>${B}</script>`}),w}async function N_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,K]=q,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let B=U.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[i0.resolve(i0.dirname(Z),`${U}.stx`),i0.resolve(i0.dirname(Z),U),i0.resolve(J.componentsDir||"components",`${U}.stx`),i0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function T_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let K=W.index,z=K+W[0].length-1,U=1,B=z+1;while(B<G.length&&U>0){if(G[B]==="(")U++;else if(G[B]===")"){if(U--,U===0)break}B++}if(U!==0)break;let j=G.substring(z+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=N0(O,X)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(K,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await X5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+k+G.substring(N),q.lastIndex=0}return G}async function M_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=y1(G);return G=q.output,G=await U(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await U(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await U(G,/[a-z][a-z0-9]*/,!1,H_),G=y7(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=fG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?$9(V.tagName):V.tagName,R=L_(V.attributes),N=O_(R,X,J),T=d0.getBuiltin(V.tagName),M=T?await J$(A,Q,X,Z,J):!1;if(T&&!M){let S={context:X,filePath:Z,options:J,dependencies:Y},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=cG(b,N.clientReactive);if(Object.keys(N.events).length>0){let C=mG(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${C}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await J$(A,Q,X,Z,J))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await X5(A,k,V.content,Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)I=cG(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=iG(I);if(S){let b=mG(N.events),C=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${C}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function cG($,X){let Z=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(X).filter(([K])=>!Z.has(K)),G=Y.filter(([K])=>!J.has(K)).map(([K])=>$9(K)).join(" "),Q=$,w=Y.length>0?iG(Q):null;if(w){let K=Y.map(([U,B])=>`:${$9(U)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${z} ${K}`+Q.substring(w.insertPos)}let q=X.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function iG($){let X=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(X)return{insertPos:X.index+1+X[1].length};let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let w=$.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=J.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z9($,X,Z,J,Y){if(!dG)vG(),dG=!0;let G=await pG($,X,Z,J,Y);G=await N_(G,X,Z,J,Y),G=await T_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let q=w1(G,D7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await M_(q.output,X,Z,J,Y),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(J.debug){let w=V_(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 dG=!1,H_,lG;var N4=D(()=>{t3();xG();uG();r1();k0();T0();Q1();H_=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"]);lG=new Map});var $Q={};a($Q,{processLoops:()=>M4,parseLoopBinding:()=>T4});function E_($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=E0($,"(",")",w);if(q===-1)continue;let W=$.slice(Q,q).trim();if(!W)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let U=N0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=q,Z.lastIndex=q}return Y===0?$:J+$.slice(Y)}function D_($,X){let Z=/@component\s*\(/g,J=$,Y,G=[];while((Y=Z.exec(J))!==null){let Q=Y.index,w=Q+Y[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=J.substring(w+1,W),z=W+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let B=U[1],j=K.slice(U[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=N0(H,X),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];J=J.substring(0,w)+W+J.substring(q)}return J}function J9($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=Y.exec(J))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,K=null,z=!1;while(W<J.length&&q>0){let j=J[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=J.substring(w+1,W),B=Z(U);J=J.substring(0,Q)+B+J.substring(W+1)}return J}function y_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in X)return`:${Y}="${Y}"`;return J}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,G)=>{try{let Q=Object.keys(X),w=Object.values(X);I8(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function b_($,X){let Z=$;return Z=J9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(J0(G,X));return Q?Y9:""}catch{return""}}),Z=J9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(J0(G,X));return Q?G9:""}catch{return""}}),Z}function S_($){let X=$;return X=X.replace(/@break(?!\()/g,Y9),X=X.replace(/@continue(?!\()/g,G9),X}function rG($){let X=$.includes(Y9),Z=X?$.substring(0,$.indexOf(Y9)):$;return{hasBreak:X,content:Z}}function oG($){let X=$.includes(G9),Z=X?$.substring(0,$.indexOf(G9)):$;return{hasContinue:X,content:Z}}function aG($){let X=$;return X=J9(X,"@break",(Z)=>{let J=Z.trim();if(!E8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=J9(X,"@continue",(Z)=>{let J=Z.trim();if(!E8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function C_($){let X=/@forelse\s*\(/g,Z,J=[],Y=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=Y.exec($))!==null)J.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)J.push({pos:Q.index,delta:-1});J.sort((K,z)=>K.pos-z.pos);let w=[],q=0;for(let K of J)q+=K.delta,w.push({pos:K.pos,depth:q});function W(K){let z=0,U=w.length-1,B=0;while(z<=U){let j=z+U>>1;if(w[j].pos<=K)B=w[j].depth,z=j+1;else U=j-1}return B}while((Z=X.exec($))!==null){if(W(Z.index)>0)continue;let K=Z.index,z=Z.index+Z[0].length-1,U=1,B=z+1,j=-1;while(B<$.length&&U>0){if($[B]==="(")U++;else if($[B]===")"){if(U--,U===0){j=B;break}}B++}if(j===-1)continue;let _=$.substring(z+1,j),H=T4(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),C=N.exec($);if(!C)break;if(b&&b.index<C.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=C.index;break}A=C.index+11}}if(T===-1)continue;let M=$.substring(F,T),k=T+11,y=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let C=M.substring(b);if(/^@forelse\s*\(/.test(C))I++,S=b+1;else if(C.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&C.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){y=b;break}S=b+1}else S=b+1}if(y===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,y),emptyContent:M.substring(y+6)}}return null}function sG($,X){let Z=$;while(!0){let J=C_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=J;try{let K;if(q0(Q))K=W0(Q,Object.keys(X))(...Object.values(X));else K=J0(Q,X);let z;if(!Array.isArray(K)||K.length===0)z=W;else z=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=Z0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function T4($){let X=$.indexOf(" as ");if(X!==-1){let G=$.slice(0,X).trim(),Q=$.slice(X+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Z)return null;let J=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=Z[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function M4($,X,Z,J){let Y=$;Y=sG(Y,X);function G(q){let W=/@foreach\s*\(/g,K;while((K=W.exec(q))!==null){let z=K.index,U=K.index+K[0].length-1,B=1,j=U+1,_=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=q.substring(U+1,_),L=T4(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(q),y=M.exec(q);if(!y)break;if(k&&k.index<y.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let I=q.substring(A,y.index),S=y.index+11;return{start:O,end:S,arrayExpr:F,itemVar:V,content:I}}N=y.index+11}}}return null}function Q(q,W){let K=q;while(!0){let z=G(K);if(!z)break;let{start:U,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let L=j.trim(),O;if(q0(L))O=W0(L,Object.keys(W))(...Object.values(W));else O=J0(L,W);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} 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 y=Z0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+y+K.substring(B);continue}let V=J?.loops?.useAltLoopVariable??I_,A=_.trim(),R=null,N,T=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],N=y[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])N=y[0],R=y[1],T=!0;else N=A}else N=A;let M="",k=O;for(let y=0;y<k.length;y++){let I=k[y],S={index:y,iteration:y+1,first:y===0,last:y===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))f.forEach((l,$0)=>{if(l)b[l]=I[$0]});else b[N]=I}else b[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=y;let C=b_(H,b),P=oG(C);if(P.hasContinue){M+=P.content;continue}let x=rG(C);if(x.hasBreak){M+=x.content;break}if(C=sG(C,b),C=Q(C,b),C=Q5(C,b,Z),C=S_(C),x=rG(C),x.hasBreak){M+=x.content;break}if(P=oG(C),P.hasContinue){M+=P.content;continue}C=b1(C,b,Z),C=y_(C,b),C=D_(C,b),C=E_(C,b),M+=C}K=K.substring(0,U)+M+K.substring(B)}catch(L){let O=Z0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(B)}}return K}Y=Q(Y,X),Y=eG(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??k_;return Y=x_(Y,X,w),Y}function tG($){return E8($)}function eG($,X,Z,J){let Y=$,G=!0;while(G){G=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=E0(Y,"(",")",q);if(W===-1)break;let K=Y.slice(q+1,W),z=W+1,U=x8(Y.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!tG(K)){let _=Z0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+_+Y.substring(j),G=!0;continue}try{let _=P_(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=v_({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:J});Y=Y.substring(0,w)+R+Y.substring(j),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=aG(F);let A=Function(...L,`
12324
+ `||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+H.length;J.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function gG($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function hG($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var uG=D(()=>{T0();k0();r1()});var nG={};a(nG,{processESImports:()=>pG,processComponents:()=>Z9});import X9 from"fs";import i0 from"path";function O_($,X,Z){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Y=new Set(l2),G=(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,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(J.static[W]=q,W!==w)J.staticNames[W]=w};for(let[w,q]of Object.entries($)){let W=w.startsWith("x-")&&!Y.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){J.events[W]=q;continue}if(W.startsWith("__stx_")){let K=G(W.slice(6));J.serverDynamic[K]=hG(q,Z);continue}if(W.startsWith(":")){let K=G(W.slice(1)),z=q===W5?K:q;if(K==="if"||K==="for"||K==="show"){J.clientReactive[K]=z;continue}try{if(!q0(z)){if(Z.debug)console.error(`Unsafe expression in :${K} binding: ${z}`);J.clientReactive[K]=z;continue}let U=Object.keys(X),j=W0(z,U)(...Object.values(X));if(j===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!U.includes(O))){J.clientReactive[K]=z;continue}}J.serverDynamic[K]=j}catch{J.clientReactive[K]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let K=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(K)try{let z=K[1];if(q0(z)){let B=W0(z,Object.keys(X))(...Object.values(X));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${z}`);Q(W,q)}}catch(z){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,z);Q(W,q)}else{let z=q,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(q))!==null)try{let j=B[1];if(!q0(j)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let H=W0(j,Object.keys(X))(...Object.values(X));z=z.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,j)}Q(W,z)}continue}Q(W,q===W5?"true":gG(q))}return J}function L_($){let X={},Z=0,J=$.length;while(Z<J){while(Z<J&&/\s/.test($[Z]))Z++;if(Z>=J)break;let Y="";while(Z<J&&!/[\s=]/.test($[Z]))Y+=$[Z],Z++;if(!Y)break;while(Z<J&&/\s/.test($[Z]))Z++;if(Z<J&&$[Z]==="="){Z++;while(Z<J&&/\s/.test($[Z]))Z++;let G="";if(Z<J&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<J){let w=$[Z];if(w==="\\"&&Z+1<J){Z++,G+=$[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<J&&!/\s/.test($[Z]))G+=$[Z],Z++;X[Y]=G}else X[Y]=W5}return X}function mG($){return Object.entries($).map(([X,Z])=>Z===W5?X:`${X}="${F_(Z)}"`).join(" ")}function F_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Z.exec($))!==null){let Y=J[1];if(d0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function A_($){let X=lG.get($);if(X)return X;let Z=new Map,J=[i0.join($,"src"),i0.join($,"dist"),$];function Y(G,Q){if(Q>6)return;let w;try{w=X9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=i0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,W);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,W)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return lG.set($,Z),Z}function R_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=i0.join(Z,"node_modules",$);try{if(X9.statSync(J).isDirectory())return J}catch{}let Y=i0.dirname(Z);if(Y===Z)return null;Z=Y}}async function pG($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=i0.dirname(Z),w=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=U.exec(z))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=i0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(X9.statSync(M).isFile())A=M}catch{try{if(X9.statSync(T).isDirectory())V=T}catch{}}}}else V=R_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),Y.add(M)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let y=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:k,local:k}}),M=V?A_(V):null;for(let{source:k,local:y}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(y,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return W;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${K}>${B}</script>`}),w}async function N_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,K]=q,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let B=U.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[i0.resolve(i0.dirname(Z),`${U}.stx`),i0.resolve(i0.dirname(Z),U),i0.resolve(J.componentsDir||"components",`${U}.stx`),i0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function T_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let K=W.index,z=K+W[0].length-1,U=1,B=z+1;while(B<G.length&&U>0){if(G[B]==="(")U++;else if(G[B]===")"){if(U--,U===0)break}B++}if(U!==0)break;let j=G.substring(z+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=N0(O,X)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(K,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await X5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+k+G.substring(N),q.lastIndex=0}return G}async function M_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=y1(G);return G=q.output,G=await U(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await U(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await U(G,/[a-z][a-z0-9]*/,!1,H_),G=y7(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=fG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?$9(V.tagName):V.tagName,R=L_(V.attributes),N=O_(R,X,J),T=d0.getBuiltin(V.tagName),M=T?await J$(A,Q,X,Z,J):!1;if(T&&!M){let S={context:X,filePath:Z,options:J,dependencies:Y},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=cG(b,N.clientReactive);if(Object.keys(N.events).length>0){let C=mG(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${C}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await J$(A,Q,X,Z,J))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await X5(A,k,V.content,Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)I=cG(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=iG(I);if(S){let b=mG(N.events),C=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${C}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function cG($,X){let Z=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(X).filter(([K])=>!Z.has(K)),G=Y.filter(([K])=>!J.has(K)).map(([K])=>$9(K)).join(" "),Q=$,w=Y.length>0?iG(Q):null;if(w){let K=Y.map(([U,B])=>`:${$9(U)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${z} ${K}`+Q.substring(w.insertPos)}let q=X.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function iG($){let X=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(X)return{insertPos:X.index+1+X[1].length};let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let w=$.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=J.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z9($,X,Z,J,Y){if(!dG)vG(),dG=!0;let G=await pG($,X,Z,J,Y);G=await N_(G,X,Z,J,Y),G=await T_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let q=q1(G,D7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await M_(q.output,X,Z,J,Y),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(J.debug){let w=V_(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 dG=!1,H_,lG;var N4=D(()=>{t3();xG();uG();r1();k0();T0();Q1();H_=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"]);lG=new Map});var $Q={};a($Q,{processLoops:()=>M4,parseLoopBinding:()=>T4});function E_($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=E0($,"(",")",w);if(q===-1)continue;let W=$.slice(Q,q).trim();if(!W)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let U=N0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=q,Z.lastIndex=q}return Y===0?$:J+$.slice(Y)}function D_($,X){let Z=/@component\s*\(/g,J=$,Y,G=[];while((Y=Z.exec(J))!==null){let Q=Y.index,w=Q+Y[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=J.substring(w+1,W),z=W+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let B=U[1],j=K.slice(U[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=N0(H,X),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];J=J.substring(0,w)+W+J.substring(q)}return J}function J9($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=Y.exec(J))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,K=null,z=!1;while(W<J.length&&q>0){let j=J[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=J.substring(w+1,W),B=Z(U);J=J.substring(0,Q)+B+J.substring(W+1)}return J}function y_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in X)return`:${Y}="${Y}"`;return J}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,G)=>{try{let Q=Object.keys(X),w=Object.values(X);I8(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function b_($,X){let Z=$;return Z=J9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(J0(G,X));return Q?Y9:""}catch{return""}}),Z=J9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(J0(G,X));return Q?G9:""}catch{return""}}),Z}function S_($){let X=$;return X=X.replace(/@break(?!\()/g,Y9),X=X.replace(/@continue(?!\()/g,G9),X}function rG($){let X=$.includes(Y9),Z=X?$.substring(0,$.indexOf(Y9)):$;return{hasBreak:X,content:Z}}function oG($){let X=$.includes(G9),Z=X?$.substring(0,$.indexOf(G9)):$;return{hasContinue:X,content:Z}}function aG($){let X=$;return X=J9(X,"@break",(Z)=>{let J=Z.trim();if(!E8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=J9(X,"@continue",(Z)=>{let J=Z.trim();if(!E8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function C_($){let X=/@forelse\s*\(/g,Z,J=[],Y=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=Y.exec($))!==null)J.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)J.push({pos:Q.index,delta:-1});J.sort((K,z)=>K.pos-z.pos);let w=[],q=0;for(let K of J)q+=K.delta,w.push({pos:K.pos,depth:q});function W(K){let z=0,U=w.length-1,B=0;while(z<=U){let j=z+U>>1;if(w[j].pos<=K)B=w[j].depth,z=j+1;else U=j-1}return B}while((Z=X.exec($))!==null){if(W(Z.index)>0)continue;let K=Z.index,z=Z.index+Z[0].length-1,U=1,B=z+1,j=-1;while(B<$.length&&U>0){if($[B]==="(")U++;else if($[B]===")"){if(U--,U===0){j=B;break}}B++}if(j===-1)continue;let _=$.substring(z+1,j),H=T4(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),C=N.exec($);if(!C)break;if(b&&b.index<C.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=C.index;break}A=C.index+11}}if(T===-1)continue;let M=$.substring(F,T),k=T+11,y=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let C=M.substring(b);if(/^@forelse\s*\(/.test(C))I++,S=b+1;else if(C.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&C.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){y=b;break}S=b+1}else S=b+1}if(y===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,y),emptyContent:M.substring(y+6)}}return null}function sG($,X){let Z=$;while(!0){let J=C_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=J;try{let K;if(q0(Q))K=W0(Q,Object.keys(X))(...Object.values(X));else K=J0(Q,X);let z;if(!Array.isArray(K)||K.length===0)z=W;else z=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=Z0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function T4($){let X=$.indexOf(" as ");if(X!==-1){let G=$.slice(0,X).trim(),Q=$.slice(X+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Z)return null;let J=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=Z[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function M4($,X,Z,J){let Y=$;Y=sG(Y,X);function G(q){let W=/@foreach\s*\(/g,K;while((K=W.exec(q))!==null){let z=K.index,U=K.index+K[0].length-1,B=1,j=U+1,_=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=q.substring(U+1,_),L=T4(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(q),y=M.exec(q);if(!y)break;if(k&&k.index<y.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let I=q.substring(A,y.index),S=y.index+11;return{start:O,end:S,arrayExpr:F,itemVar:V,content:I}}N=y.index+11}}}return null}function Q(q,W){let K=q;while(!0){let z=G(K);if(!z)break;let{start:U,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let L=j.trim(),O;if(q0(L))O=W0(L,Object.keys(W))(...Object.values(W));else O=J0(L,W);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} 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 y=Z0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+y+K.substring(B);continue}let V=J?.loops?.useAltLoopVariable??I_,A=_.trim(),R=null,N,T=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],N=y[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])N=y[0],R=y[1],T=!0;else N=A}else N=A;let M="",k=O;for(let y=0;y<k.length;y++){let I=k[y],S={index:y,iteration:y+1,first:y===0,last:y===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))f.forEach((l,$0)=>{if(l)b[l]=I[$0]});else b[N]=I}else b[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=y;let C=b_(H,b),P=oG(C);if(P.hasContinue){M+=P.content;continue}let x=rG(C);if(x.hasBreak){M+=x.content;break}if(C=sG(C,b),C=Q(C,b),C=Q5(C,b,Z),C=S_(C),x=rG(C),x.hasBreak){M+=x.content;break}if(P=oG(C),P.hasContinue){M+=P.content;continue}C=b1(C,b,Z),C=y_(C,b),C=D_(C,b),C=E_(C,b),M+=C}K=K.substring(0,U)+M+K.substring(B)}catch(L){let O=Z0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(B)}}return K}Y=Q(Y,X),Y=eG(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??k_;return Y=x_(Y,X,w),Y}function tG($){return E8($)}function eG($,X,Z,J){let Y=$,G=!0;while(G){G=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=E0(Y,"(",")",q);if(W===-1)break;let K=Y.slice(q+1,W),z=W+1,U=x8(Y.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!tG(K)){let _=Z0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+_+Y.substring(j),G=!0;continue}try{let _=P_(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=v_({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:J});Y=Y.substring(0,w)+R+Y.substring(j),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=aG(F);let A=Function(...L,`
12247
12325
  let result = '';
12248
12326
  for (${K}) {
12249
12327
  result += \`${F}\`;
@@ -12265,7 +12343,7 @@ ${I}
12265
12343
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
12266
12344
  }
12267
12345
  return result;
12268
- `)(...j);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(B){let j=Z0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(U),Y=!0}}return J}var k_=1000,I_=!1,Y9="<!--__STX_BREAK__-->",G9="<!--__STX_CONTINUE__-->";var k4=D(()=>{c$();F1();q1();f8();T0()});import _0 from"path";function I4($,X){let Z=0;for(let J=X;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y===","&&Z===0)return J}return-1}function f_($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=Y.exec(J);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let K=J.substring(w+1,W-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(W),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function g_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function ZQ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w=(z)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===z){G++;return}G++}},q=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if(X[G]==="{")z++,G++;else if(X[G]==="}")z--,G++;else if(X[G]==="'"||X[G]==='"')w(X[G]);else if(X[G]==="`")q();else G++;continue}G++}},W=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
12346
+ `)(...j);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(B){let j=Z0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(U),Y=!0}}return J}var k_=1000,I_=!1,Y9="<!--__STX_BREAK__-->",G9="<!--__STX_CONTINUE__-->";var k4=D(()=>{c$();V1();W1();f8();T0()});import _0 from"path";function I4($,X){let Z=0;for(let J=X;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y===","&&Z===0)return J}return-1}function f_($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=Y.exec(J);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let K=J.substring(w+1,W-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(W),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function g_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function ZQ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w=(z)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===z){G++;return}G++}},q=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if(X[G]==="{")z++,G++;else if(X[G]==="}")z--,G++;else if(X[G]==="'"||X[G]==='"')w(X[G]);else if(X[G]==="`")q();else G++;continue}G++}},W=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
12269
12347
  `)G++;return!0}if(X[G]==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;return G+=2,!0}return!1},K=()=>{if(Y!==0)return;let z=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!J.has(j))Z.push(j),J.add(j);return}let U=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let j=U[1];if(!J.has(j))Z.push(j),J.add(j);return}let B=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Z.push(j),J.add(j)}};while(G<Q){if(W())continue;if(X[G]==="'"||X[G]==='"'){w(X[G]);continue}if(X[G]==="`"){q();continue}if(X[G]==="{"){Y++,G++;continue}if(X[G]==="}"){Y--,G++;continue}if(Y===0&&/[a-z]/i.test(X[G])&&(G===0||/\s|[;{}()]/.test(X[G-1])))K();G++}return Z.join(", ")}function JQ($,X=""){let Z=ZQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12270
12348
  (function() {
12271
12349
  ${R5("var",Z)}
@@ -12300,33 +12378,33 @@ ${ZQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12300
12378
  } finally {
12301
12379
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12302
12380
  }
12303
- })();`}function u_($,X){let Z=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Y=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${X}"${w}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function m_($){if($.__onceStore instanceof Set)return $.__onceStore;return d_}async function E4($,X,Z,J,Y,G=new Set){let Q=J.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=f_($,"@partial","@include"),q=m_(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(j,_,H)=>{let L=_.trim(),O=`${Z}:${L}`;if(q.has(O))return"";return q.add(O),_});{let j=/@includeIf\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")")O--;F++}if(O!==0)break;let V=w.substring(L+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=F;continue}let R=A[1],N=W(R,Q,Z),T="";if(N&&await Bun.file(N).exists())Y.add(N),T=`@include(${V})`;w=w.substring(0,H)+T+w.substring(F),j.lastIndex=0}}for(let[j,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=H.exec(w))!==null){let O=L.index,F=O+L[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),N=I4(R,0);if(N===-1){H.lastIndex=A;continue}let T=R.substring(0,N).trim(),M=R.substring(N+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){H.lastIndex=A;continue}let y=k[1],I=M.substring(k[0].length),S,b=I4(I,0);if(b!==-1)S=I.substring(b+1).trim();try{let C=`Boolean(${T})`,P;if(q0(C)){let l=W0(C,Object.keys(X));P=Boolean(l(...Object.values(X)))}else P=Boolean(J0(C,X));let x=_?!P:P,f="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())Y.add(l);f=`@include('${y}'${S?`, ${S}`:""})`}w=w.substring(0,O)+f+w.substring(A),H.lastIndex=0}catch(C){let P=C instanceof Error?C.message:String(C),x=z0("Include",`Error evaluating ${j} condition: ${P}`,Z,$,O);w=w.substring(0,O)+x+w.substring(A),H.lastIndex=0}}}{let j=/@each\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let[,N,T,M,k]=R;try{let y,I=T.trim();if(q0(I))y=W0(I,Object.keys(X))(...Object.values(X));else y=J0(I,X);let S="";if(Array.isArray(y)&&y.length>0)for(let b of y){let C={...X,[M]:b},P=await z(N,C,$,H);S+=P}else if(k)S=await z(k,{},$,H);w=w.substring(0,H)+S+w.substring(F+1),j.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+z0("Each",`Error in @each: ${I}`,Z,$,H)+w.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let N=R[1],T=V.slice(R[0].length),M,k=T.match(/^\s*,\s*\{/);if(k){T=T.slice(k[0].length-1);let S=1,b=1;while(b<T.length&&S>0){if(T[b]==="{")S++;else if(T[b]==="}"){if(S--,S===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let y,I=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let S=JSON.parse(N.replace(/'/g,'"')),b={};if(M)try{b=N0(M,X)}catch(P){let x=P instanceof Error?P.message:String(P);if(J.debug){let f=z0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,H,A);w=w.replace(A,()=>f)}else w=w.replace(A,()=>y||"");continue}let C=!1;for(let P of S){let x=W(P,Q,Z);if(!x)continue;if(await p(x)){let f=await z(P,b,$,H);w=w.replace(A,()=>f),C=!0;break}}if(!C)if(y!==void 0)w=w.replace(A,()=>y);else if(J.debug){let P=z0("Include",`None of the includeFirst paths exist: ${N}`,Z,$,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(S){let b=S instanceof Error?S.message:String(S),C=z0("Include",`Error processing @includeFirst: ${b}`,Z,$,H,A);w=w.replace(A,()=>C)}j.lastIndex=0}}function W(j,_,H){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let O=_0.resolve(_),F=_0.resolve(_0.dirname(H)),V;if(!L.startsWith("./")&&!L.startsWith("../"))V=_0.resolve(_,L);else V=_0.resolve(F,L);let A=_0.normalize(V),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,T=!1,M=_0.dirname(F);if(A.startsWith(M+_0.sep)){if(!_0.relative(M,A).split(_0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let K=_0.resolve(Z);G.add(K);async function z(j,_={},H,L){let O=W(j,Q,Z);if(!O)return z0("Include",`Could not resolve path for include: ${j}`,Z,H,L);let F=_0.resolve(O);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return z0("Include",`Circular include detected: ${V}`,Z,H,L)}try{Y.add(O);let V;if(!V)try{V=await Bun.file(O).text()}catch(x){let f=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${j}: ${f}`,Z,H,L)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (r3(),n3));V=x(V,X)}if(V&&(J.debug||!m7()&&!D$()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s3(),AG));x(V,O)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (N4(),nG));await x(V,X,O,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let R=S8(A);if(R)A=R.content.trim();let T=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...X};k.__stx_signals_gate=L1(V);for(let[x,f]of Object.entries(_))k[x]=f;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],S="",b=null;for(let x of I){let f=x[1]||"",l=x[2]||"",$0=f.includes("server"),C0=i1(f),U0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:t}=await Promise.resolve().then(() => (E7(),B6)),R0=u(l,{filePath:O,projectRoot:process.cwd()});l=R0.code,U0=t(R0.styles)}catch(u){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,u instanceof Error?u.message:u)}if(C0&&l.trim())l=n1(l);if(!$0)try{let{hasUserImports:u,bundleClientScript:t}=await Promise.resolve().then(() => (N7(),R7));if(u(l))l=await t(l,O,{projectRoot:process.cwd()})}catch(u){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,u instanceof Error?u.message:u)}let A0=g_(l);if(A0&&!$0){b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++XQ}`;let u=l0(l),t=h_(u,b);S+=`${U0}<script data-stx-scoped data-stx-run="always">${t}</script>
12381
+ })();`}function u_($,X){let Z=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Y=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${X}"${w}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function m_($){if($.__onceStore instanceof Set)return $.__onceStore;return d_}async function E4($,X,Z,J,Y,G=new Set){let Q=J.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=f_($,"@partial","@include"),q=m_(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(j,_,H)=>{let L=_.trim(),O=`${Z}:${L}`;if(q.has(O))return"";return q.add(O),_});{let j=/@includeIf\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")")O--;F++}if(O!==0)break;let V=w.substring(L+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=F;continue}let R=A[1],N=W(R,Q,Z),T="";if(N&&await Bun.file(N).exists())Y.add(N),T=`@include(${V})`;w=w.substring(0,H)+T+w.substring(F),j.lastIndex=0}}for(let[j,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=H.exec(w))!==null){let O=L.index,F=O+L[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),N=I4(R,0);if(N===-1){H.lastIndex=A;continue}let T=R.substring(0,N).trim(),M=R.substring(N+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){H.lastIndex=A;continue}let y=k[1],I=M.substring(k[0].length),S,b=I4(I,0);if(b!==-1)S=I.substring(b+1).trim();try{let C=`Boolean(${T})`,P;if(q0(C)){let l=W0(C,Object.keys(X));P=Boolean(l(...Object.values(X)))}else P=Boolean(J0(C,X));let x=_?!P:P,f="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())Y.add(l);f=`@include('${y}'${S?`, ${S}`:""})`}w=w.substring(0,O)+f+w.substring(A),H.lastIndex=0}catch(C){let P=C instanceof Error?C.message:String(C),x=z0("Include",`Error evaluating ${j} condition: ${P}`,Z,$,O);w=w.substring(0,O)+x+w.substring(A),H.lastIndex=0}}}{let j=/@each\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let[,N,T,M,k]=R;try{let y,I=T.trim();if(q0(I))y=W0(I,Object.keys(X))(...Object.values(X));else y=J0(I,X);let S="";if(Array.isArray(y)&&y.length>0)for(let b of y){let C={...X,[M]:b},P=await z(N,C,$,H);S+=P}else if(k)S=await z(k,{},$,H);w=w.substring(0,H)+S+w.substring(F+1),j.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+z0("Each",`Error in @each: ${I}`,Z,$,H)+w.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let N=R[1],T=V.slice(R[0].length),M,k=T.match(/^\s*,\s*\{/);if(k){T=T.slice(k[0].length-1);let S=1,b=1;while(b<T.length&&S>0){if(T[b]==="{")S++;else if(T[b]==="}"){if(S--,S===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let y,I=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let S=JSON.parse(N.replace(/'/g,'"')),b={};if(M)try{b=N0(M,X)}catch(P){let x=P instanceof Error?P.message:String(P);if(J.debug){let f=z0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,H,A);w=w.replace(A,()=>f)}else w=w.replace(A,()=>y||"");continue}let C=!1;for(let P of S){let x=W(P,Q,Z);if(!x)continue;if(await p(x)){let f=await z(P,b,$,H);w=w.replace(A,()=>f),C=!0;break}}if(!C)if(y!==void 0)w=w.replace(A,()=>y);else if(J.debug){let P=z0("Include",`None of the includeFirst paths exist: ${N}`,Z,$,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(S){let b=S instanceof Error?S.message:String(S),C=z0("Include",`Error processing @includeFirst: ${b}`,Z,$,H,A);w=w.replace(A,()=>C)}j.lastIndex=0}}function W(j,_,H){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let O=_0.resolve(_),F=_0.resolve(_0.dirname(H)),V;if(!L.startsWith("./")&&!L.startsWith("../"))V=_0.resolve(_,L);else V=_0.resolve(F,L);let A=_0.normalize(V),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,T=!1,M=_0.dirname(F);if(A.startsWith(M+_0.sep)){if(!_0.relative(M,A).split(_0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let K=_0.resolve(Z);G.add(K);async function z(j,_={},H,L){let O=W(j,Q,Z);if(!O)return z0("Include",`Could not resolve path for include: ${j}`,Z,H,L);let F=_0.resolve(O);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return z0("Include",`Circular include detected: ${V}`,Z,H,L)}try{Y.add(O);let V;if(!V)try{V=await Bun.file(O).text()}catch(x){let f=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${j}: ${f}`,Z,H,L)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (r3(),n3));V=x(V,X)}if(V&&(J.debug||!m7()&&!D$()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s3(),AG));x(V,O)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (N4(),nG));await x(V,X,O,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let R=S8(A);if(R)A=R.content.trim();let T=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...X};k.__stx_signals_gate=F1(V);for(let[x,f]of Object.entries(_))k[x]=f;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],S="",b=null;for(let x of I){let f=x[1]||"",l=x[2]||"",$0=f.includes("server"),C0=i1(f),U0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:t}=await Promise.resolve().then(() => (E7(),B6)),R0=u(l,{filePath:O,projectRoot:process.cwd()});l=R0.code,U0=t(R0.styles)}catch(u){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,u instanceof Error?u.message:u)}if(C0&&l.trim())l=n1(l);if(!$0)try{let{hasUserImports:u,bundleClientScript:t}=await Promise.resolve().then(() => (N7(),R7));if(u(l))l=await t(l,O,{projectRoot:process.cwd()})}catch(u){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,u instanceof Error?u.message:u)}let A0=g_(l);if(A0&&!$0){b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++XQ}`;let u=l0(l),t=h_(u,b);S+=`${U0}<script data-stx-scoped data-stx-run="always">${t}</script>
12304
12382
  `;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (v7(),v8));await u(l,k,O)}catch(u){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,u)}if(!$0&&!A0){let u=f.replace(/\bclient\b/i,"").trim();b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++XQ}`;let t=l0(l),R0=YQ(t,b),P0=JQ(t,R0);S+=`${U0}<script data-stx-scoped data-stx-run="always"${u?` ${u}`:""}>${P0}</script>
12305
12383
  `}}if(b){let x=u_(A,b);if(A=x.html,x.mergedIntoExisting)S=S.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await E4(A,k,O,J,Y,G);let{processLoops:C}=await Promise.resolve().then(() => (k4(),$Q)),P=C(A,k,O);if(P=Q5(P,k,O),P=b1(P,k,O),M)P+=`
12306
12384
  `+M;if(S)P+=`
12307
12385
  `+S;return P}catch(V){let A=V instanceof Error?V.message:String(V);return z0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let U=/@include\s*\(/g,B;while((B=U.exec(w))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<w.length&&H>0){if(w[L]==="(")H++;else if(w[L]===")")H--;L++}if(H!==0)break;let O=w.substring(j,L),F=w.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=L;continue}let A=V[1],R,N=F.substring(V[0].length),T=I4(N,0);if(T!==-1)R=N.substring(T+1).trim();let M={};if(R)try{M=N0(R,X)}catch(y){let I=y instanceof Error?y.message:String(y);w=w.replace(O,z0("Include",`Error parsing include variables for ${A}: ${I}`,Z,$,j)),U.lastIndex=0;continue}let k=await z(A,M,$,j);w=w.substring(0,j)+k+w.substring(L),U.lastIndex=0}return w}function D4($,X){let Z=$;function J(Y,G,Q,w){let q=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=q.match(K);if(!z||z.index===void 0)break;let U=z.index,B=z[1],j=U+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<q.length){let A=q.slice(O),R=A.match(_),N=A.match(H),T=R?O+R.index:1/0,M=N?O+N.index:1/0;if(T<M)L++,O=T+(R[0].length||1);else if(M<1/0){if(L--,L===0){F=M;break}O=M+Q.length+1}else break}if(F===-1)break;let V=q.slice(j,F);if(!X[B])X[B]=[];if(w)X[B].unshift(V);else X[B].push(V);q=q.substring(0,U)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function y4($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12308
- `)})}var XQ=0,rk,d_;var GQ=D(()=>{QX();c$();q1();Q1();E5();T0();k0();rk=new o1(500),d_=new Set});import*as b4 from"path";async function QQ($,X,Z=""){if(b4.basename(Z)==="multiple-js-directives.stx")return X.firstBlockRan=!0,X.secondBlockRan=!0,X.thirdBlockRan=!0,X.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return qQ($,X,Z,"@js","@endjs")}async function wQ($,X,Z=""){if(b4.basename(Z)==="ts-directive.stx"){if(X.users&&Array.isArray(X.users))X.processedUsers=X.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),X.processedOutput=JSON.stringify(X.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return qQ($,X,Z,"@ts","@endts")}async function qQ($,X,Z,J,Y){let G=$,Q=I5(`${J}([\\s\\S]*?)${Y}`,"g"),w=[],q;while((q=Q.exec($))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:z}of w)try{let U={...X,global:X},B=Object.keys(U),j=Object.values(U),_=K.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12386
+ `)})}var XQ=0,rk,d_;var GQ=D(()=>{QX();c$();W1();Q1();E5();T0();k0();rk=new o1(500),d_=new Set});import*as b4 from"path";async function QQ($,X,Z=""){if(b4.basename(Z)==="multiple-js-directives.stx")return X.firstBlockRan=!0,X.secondBlockRan=!0,X.thirdBlockRan=!0,X.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return qQ($,X,Z,"@js","@endjs")}async function wQ($,X,Z=""){if(b4.basename(Z)==="ts-directive.stx"){if(X.users&&Array.isArray(X.users))X.processedUsers=X.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),X.processedOutput=JSON.stringify(X.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return qQ($,X,Z,"@ts","@endts")}async function qQ($,X,Z,J,Y){let G=$,Q=I5(`${J}([\\s\\S]*?)${Y}`,"g"),w=[],q;while((q=Q.exec($))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:z}of w)try{let U={...X,global:X},B=Object.keys(U),j=Object.values(U),_=K.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12309
12387
  ${_}
12310
12388
  ${O}
12311
12389
  `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=z0(`${J} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var WQ=D(()=>{E5();k0()});function l_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function KQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return l_(J,G||"_method")})}async function zQ($,X,Z,J,Y){if(!J.middleware||J.middleware.length===0)return $;let G=$,Q=J.middleware.filter((w)=>w.timing===Y);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,X,Z,J);if(typeof q==="string")G=q;else if(J.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${w.name}:`,q);if(J.debug){let W=z0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
12312
12390
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(W)}</div>
12313
- `)}}}return G}async function UQ($,X,Z,J){return zQ($,X,Z,J,"before")}async function jQ($,X,Z,J){return zQ($,X,Z,J,"after")}var BQ=D(()=>{q1();k0()});function _Q($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?N0(Y,{}):{};return Y7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var HQ=D(()=>{M1();M1();T0()});async function OQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(X8.exact[$])for(let J of X8.exact[$])await Promise.resolve(J(X,$));if(X8.exact[Z])for(let J of X8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of X8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var X8;var LQ=D(()=>{X8={patterns:[],exact:{}}});function FQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>FQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function VQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,B=K,j=!1;while((U=z.exec(K))!==null){let _=U[1],H=U[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=FQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(U[0],` class="${R}"`)}else B=B.replace(U[0],"");j=!0;continue}if(c_.has(_)){if(A)B=B.replace(U[0],` ${_}`);else B=B.replace(U[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(U[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(U[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;q.push({start:G.index,end:G.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var c_;var AQ=D(()=>{c_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function K5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&p_.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function n_($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let w=G.exec($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function K1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=n_($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function RQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function l5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function u1($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function d1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function r_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function o_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-for");if(Y===null){Z=J.end;continue}let G=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=J.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=u1(J.attrs,"v-for"),K=u1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=K1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${q})
12391
+ `)}}}return G}async function UQ($,X,Z,J){return zQ($,X,Z,J,"before")}async function jQ($,X,Z,J){return zQ($,X,Z,J,"after")}var BQ=D(()=>{W1();k0()});function _Q($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?N0(Y,{}):{};return Y7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var HQ=D(()=>{k1();k1();T0()});async function OQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(X8.exact[$])for(let J of X8.exact[$])await Promise.resolve(J(X,$));if(X8.exact[Z])for(let J of X8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of X8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var X8;var LQ=D(()=>{X8={patterns:[],exact:{}}});function FQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>FQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function VQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,B=K,j=!1;while((U=z.exec(K))!==null){let _=U[1],H=U[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=FQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(U[0],` class="${R}"`)}else B=B.replace(U[0],"");j=!0;continue}if(c_.has(_)){if(A)B=B.replace(U[0],` ${_}`);else B=B.replace(U[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(U[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(U[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;q.push({start:G.index,end:G.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var c_;var AQ=D(()=>{c_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function K5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&p_.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function n_($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let w=G.exec($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function z1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=n_($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function RQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function l5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function u1($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function d1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function r_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function o_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-for");if(Y===null){Z=J.end;continue}let G=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=J.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=u1(J.attrs,"v-for"),K=u1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${q})
12314
12392
  `,_=`${j}${B}
12315
- @endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function s_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=K1(X,J),w=u1(J.attrs,"v-if"),q=d1(X.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},w);G.push({type:"if",expr:Y,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=K5(X,W+H);if(!L){K=!1;break}let O=l5(L.attrs,"v-else-if"),F=RQ(L.attrs,"v-else");if(O!==null){let V=K1(X,L),A=u1(L.attrs,"v-else-if"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=V.outerEnd}else if(F){let V=K1(X,L),A=u1(L.attrs,"v-else"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
12393
+ @endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function s_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=z1(X,J),w=u1(J.attrs,"v-if"),q=d1(X.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},w);G.push({type:"if",expr:Y,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=K5(X,W+H);if(!L){K=!1;break}let O=l5(L.attrs,"v-else-if"),F=RQ(L.attrs,"v-else");if(O!==null){let V=z1(X,L),A=u1(L.attrs,"v-else-if"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=V.outerEnd}else if(F){let V=z1(X,L),A=u1(L.attrs,"v-else"),R=d1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
12316
12394
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
12317
12395
  ${_.element}`);else z.push(`@else
12318
12396
  ${_.element}`);z.push("@endif");let U=z.join(`
12319
- `),B=G[0].outerStart,j=G[G.length-1].outerEnd;X=X.slice(0,B)+U+X.slice(j),Z=B+U.length}return X}function a_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function t_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=Y.match(Q);while(w){G=!0;let K=w[1],z=w[2],U=w[3];Y=Y.replace(w[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,w=Y.match(Q)}if(G){let K=K1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=d1(z,{...J,start:0,end:J.end-J.start},Y);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let q=l5(J.attrs,"v-model");if(q===null){Z=J.end;continue}if(i_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=K1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=K1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}}return X}function e_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function $H($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function XH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=K1(X,J),Q=u1(J.attrs,"v-html"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function ZH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=K1(X,J),Q=u1(J.attrs,"v-text"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function JH($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function YH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;if(!RQ(J.attrs,"v-once")){Z=J.end;continue}let Y=u1(J.attrs,"v-once"),G=K1(X,J),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
12397
+ `),B=G[0].outerStart,j=G[G.length-1].outerEnd;X=X.slice(0,B)+U+X.slice(j),Z=B+U.length}return X}function a_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function t_($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=Y.match(Q);while(w){G=!0;let K=w[1],z=w[2],U=w[3];Y=Y.replace(w[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,w=Y.match(Q)}if(G){let K=z1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=d1(z,{...J,start:0,end:J.end-J.start},Y);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let q=l5(J.attrs,"v-model");if(q===null){Z=J.end;continue}if(i_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}}return X}function e_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function $H($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function XH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=u1(J.attrs,"v-html"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function ZH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=l5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=u1(J.attrs,"v-text"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function JH($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function YH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;if(!RQ(J.attrs,"v-once")){Z=J.end;continue}let Y=u1(J.attrs,"v-once"),G=z1(X,J),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
12320
12398
  ${d1(Q,{...J,start:0,end:J.end-J.start},Y)}
12321
12399
  @endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function GH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function QH($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function NQ($){if(!r_($))return $;let X=$;return X=o_(X),X=s_(X),X=YH(X),X=e_(X),X=$H(X),X=t_(X),X=a_(X),X=QH(X),X=XH(X),X=ZH(X),X=JH(X),X=GH(X),X}var p_,i_;var TQ=D(()=>{p_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i_=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 Q9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MQ($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Z?Z[1]:$,Y=J0(J,X);if(Y&&typeof Y==="string")return Y;let G=J.trim();return S4.has(G)?G:null}function kQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function IQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(wH.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function EQ($,X,Z,J,Y){let G=$,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 K=w[W];try{let z=MQ(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${Q9(kQ(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(S4.has(z)){let O=IQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(U))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=J0(F,X)}catch{B[O]=F}else B[O]=F}let H=J.componentsDir||"components",L=await X5(z,B,K.slotContent,H,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await qH(G,X,Z,J,Y),G}async function qH($,X,Z,J,Y){let G=$,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 K=w[W];try{let z=MQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q9(kQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(S4.has(z)){let j=IQ(z,K.attrs,"");G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}let U=J.componentsDir||"components",B=await X5(z,{},"",U,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var S4,wH;var DQ=D(()=>{k0();T0();S4=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"]),wH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function jH($){let X=$.storageKey??"stx-color-mode",Z=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,G=$.autoValue??null;if(typeof X!=="string"||X.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!WH.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(J!==null&&(typeof J!=="string"||!UH.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!zH.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!KH.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(J===null&&Y===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:X,initialMode:Z==="system"?"auto":Z,darkClass:J,attribute:Y,autoValue:G}}function BH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function P4($={}){let X=jH($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${BH(X)};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 yQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=C4($);if(Z===null)return $;let J=P4(X);return`${$.slice(0,Z)}
12322
12400
  ${J}${$.slice(Z)}`}function C4($){let X=/<head\b[^>]*>/i.exec($);if(!X)return null;let Z=X.index+X[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Z));if(J)Z+=J[0].length;return Z}function OH($){let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let Z=X.index+X[0].length,J=$.toLowerCase().indexOf("</head>",Z),Y=$.slice(Z,J===-1?$.length:J),G=HH.exec(Y);if(!G||Y.slice(0,G.index).trim()==="")return $;let Q=Y.slice(0,G.index)+Y.slice(G.index+G[0].length);return $.slice(0,Z)+`
12323
12401
  ${G[0]}`+Q+$.slice(Z+Y.length)}function bQ($){return LH(OH($))}function LH($){let X=_H.exec($);if(!X)return $;let Z=C4($);if(Z===null)return $;if(X.index<=Z||$.slice(Z,X.index).trim()==="")return $;let J=$.slice(0,X.index)+$.slice(X.index+X[0].length),Y=C4(J);if(Y===null)return $;return`${J.slice(0,Y)}
12324
12402
  ${X[0]}${J.slice(Y)}`}var WH,KH,zH,UH,_H,HH;var v4=D(()=>{WH=new Set(["light","dark","auto","system"]),KH=new Set(["auto","system"]),zH=/^[a-z][\w:-]*$/i,UH=/^[\w-]+$/;_H=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),HH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function FH(){if(x4===null)x4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return x4}function SQ($,X=FH()){if($.includes('name="stx-build"'))return $;let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;return`${$.slice(0,J)}
12325
- <meta name="stx-build" content="${X}">${$.slice(J)}`}var x4=null;function A1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VH($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f4($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function c5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${A1(String(J))}"`).join(" ")}function AH($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!PQ.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){Y=String(q).trim();continue}Z.push(` ${W}="${A1(String(q))}"`),J.push(W)}let Q=` lang="${A1(G)}"`;if(Y)Q+=` class="${A1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${q9}="${A1(Y)}"`;if(J.length)Q+=` ${w9}="${A1(J.join(" "))}"`;return Q}function vQ($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function xQ($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!PQ.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),B!=="lang")q.push(U)}if(w.length){if(!(q9 in J))Y.push(q9);J[q9]=w.join(" ")}if(q.length){if(!(w9 in J))Y.push(w9);J[w9]=q.join(" ")}let W=Y.map((K)=>` ${K}="${A1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function fQ($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${CQ}
12403
+ <meta name="stx-build" content="${X}">${$.slice(J)}`}var x4=null;function R1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VH($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f4($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function c5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${R1(String(J))}"`).join(" ")}function AH($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!PQ.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){Y=String(q).trim();continue}Z.push(` ${W}="${R1(String(q))}"`),J.push(W)}let Q=` lang="${R1(G)}"`;if(Y)Q+=` class="${R1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${q9}="${R1(Y)}"`;if(J.length)Q+=` ${w9}="${R1(J.join(" "))}"`;return Q}function vQ($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function xQ($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!PQ.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),B!=="lang")q.push(U)}if(w.length){if(!(q9 in J))Y.push(q9);J[q9]=w.join(" ")}if(q.length){if(!(w9 in J))Y.push(w9);J[w9]=q.join(" ")}let W=Y.map((K)=>` ${K}="${R1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function fQ($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${CQ}
12326
12404
  ${$.slice(X)}`}function RH($){let X=[],Z=0;while(Z<$.length){let G=$.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=$.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let z=$.toLowerCase().indexOf("</script>",Z+w[0].length);if(z===-1)break;Z=z+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){X.push(W[0]),Z+=W[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){X.push(K[0]),Z+=K[0].length;continue}break}if(X.length===0)return{body:$,hoisted:X};let J="",Y=0;while(Y<$.length&&Y<Z){let G=$.slice(Y),Q=G.match(/^<link\b[^>]*>/i);if(Q&&X.includes(Q[0])){Y+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&X.includes(w[0])){Y+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&X.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function NH($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:z={}}=X,U=Z.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(f4).filter(Boolean)),H=[...B.filter((k)=>!j.has(f4(k))),...G].map((k)=>{return` <meta ${c5(k)}>`}).join(`
12327
12405
  `),L=Q.map((k)=>{return` <link ${c5(k)}>`}).join(`
12328
12406
  `),O=w.map((k)=>{if(k.src)return` <script ${c5(k,(y)=>y==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
12329
- `),F=AH(W,Y),V=Object.entries(z).map(([k,y])=>` ${k}="${A1(String(y))}"`).join(""),A=K?` class="${A1(K)}"`:"",{body:R,hoisted:N}=RH($),T=[H,Z.colorMode?` ${P4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:VH(U)}</title>`,` ${CQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12407
+ `),F=AH(W,Y),V=Object.entries(z).map(([k,y])=>` ${k}="${R1(String(y))}"`).join(""),A=K?` class="${R1(K)}"`:"",{body:R,hoisted:N}=RH($),T=[H,Z.colorMode?` ${P4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:VH(U)}</title>`,` ${CQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12330
12408
  <html${F}>
12331
12409
  <head>
12332
12410
  ${T.join(`
@@ -12344,23 +12422,24 @@ ${j}
12344
12422
  </script>`;J=J.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(J))!==null){let[W,K,z,U]=q,B=K+U;if(dQ(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await mQ(z,Y,X);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
12345
12423
  /* Source: ${z} */
12346
12424
  ${H}
12347
- </style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var cQ=D(()=>{E1()});function u4($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!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 z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=W0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="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),J.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function d4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pQ($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,w=1,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,y=`<${T}${M} data-stx-memo="${W}"${k}>`;R=B.slice(0,H)+y+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;Y.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m4($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function iQ($){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"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),B=U.indexOf("</"),j=B>=0?U.slice(0,B):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function nQ($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[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===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!TH.test(z))continue;let U=$[K-1]==="/",B=U?K-1:K;Z+=`${$.slice(J,B)} x-cloak${U?" ":""}`,J=B}return Z+=$.slice(J),Z}var TH;var l4=D(()=>{F1();T0();TH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function c4($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[];for(let{pattern:w,message:q,suggestion:W}of MH){if(G.some((z)=>/\w/.test(z)&&q.includes(z)))continue;w.lastIndex=0;let K=$.match(w);if(K&&K.length>0){let z=$.split(`
12348
- `),U=[];z.forEach((H,L)=>{if(w.lastIndex=0,w.test(H))U.push(L+1)});let B=U.length>0?` (script line${U.length>1?"s":""} ${U.join(", ")})`:"",j=U.slice(0,3).map((H)=>` ${H} | ${(z[H-1]??"").trim().slice(0,100)}`).join(`
12349
- `),_=j?`
12350
- ${j}`:"";Q.push(` \u2717 ${q}${B}
12351
- \u2192 ${W}${_}`)}}if(Q.length>0&&Y.enabled){let w=(K)=>{let z=`${process.cwd()}/`;return K.startsWith(z)?K.slice(z.length):K},W=`[STX] DOM API violation in ${J&&J!==X?`${w(J)} (composed into ${w(X)})`:w(X)}:
12425
+ </style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var cQ=D(()=>{E1()});function u4($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!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 z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=W0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="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),J.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function d4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pQ($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,w=1,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,y=`<${T}${M} data-stx-memo="${W}"${k}>`;R=B.slice(0,H)+y+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;Y.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m4($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function iQ($){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"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),B=U.indexOf("</"),j=B>=0?U.slice(0,B):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function nQ($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[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===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!TH.test(z))continue;let U=$[K-1]==="/",B=U?K-1:K;Z+=`${$.slice(J,B)} x-cloak${U?" ":""}`,J=B}return Z+=$.slice(J),Z}var TH;var l4=D(()=>{V1();T0();TH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function c4($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],w=w1($.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:K}of MH){if(G.some((U)=>/\w/.test(U)&&W.includes(U)))continue;q.lastIndex=0;let z=w.match(q);if(z&&z.length>0){let U=w.split(`
12426
+ `),B=$.split(`
12427
+ `),j=[];U.forEach((O,F)=>{if(q.lastIndex=0,q.test(O))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((O)=>` ${O} | ${(B[O-1]??"").trim().slice(0,100)}`).join(`
12428
+ `),L=H?`
12429
+ ${H}`:"";Q.push(` \u2717 ${W}${_}
12430
+ \u2192 ${K}${L}`)}}if(Q.length>0&&Y.enabled){let q=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},K=`[STX] DOM API violation in ${J&&J!==X?`${q(J)} (composed into ${q(X)})`:q(X)}:
12352
12431
  ${Q.join(`
12353
12432
  `)}
12354
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(W);else console.warn(W)}}var MH;var p4=D(()=>{MH=[{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 kH from"fs";function W9($){return[...$].sort().map((X)=>{try{let Z=kH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12355
- `)}function K9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function z1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var i4=()=>{};var rQ={};a(rQ,{getStoreScript:()=>EH,clearStoreCache:()=>DH});import z9 from"path";function IH($,X){for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Z[1]??"").split(",")){let G=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Z[1]??"").split(",")){let Y=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))X.add(Y)}}async function EH($){let X;if($)X=z9.resolve($);else{let j=await t0();X=z9.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let j of Z.scan({cwd:X,absolute:!0})){let _=z9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return z1(i5,X,"",""),null}let Y=W9(J),G=K9(i5,X,Y);if(G!==void 0)return G||null;if(J.length===0)return z1(i5,X,Y,""),null;let Q=[];for(let j of J){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),q=[],W=new Set,K=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let j of w)try{let _=await Bun.file(j).text(),H=z9.basename(j,".ts");IH(_,W),_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
12356
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return z1(i5,X,Y,""),null;let z=q.join(`
12433
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var MH;var p4=D(()=>{MH=[{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 kH from"fs";function W9($){return[...$].sort().map((X)=>{try{let Z=kH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12434
+ `)}function K9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function U1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var i4=()=>{};var rQ={};a(rQ,{getStoreScript:()=>EH,clearStoreCache:()=>DH});import z9 from"path";function IH($,X){for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Z[1]??"").split(",")){let G=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Z[1]??"").split(",")){let Y=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))X.add(Y)}}async function EH($){let X;if($)X=z9.resolve($);else{let j=await t0();X=z9.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let j of Z.scan({cwd:X,absolute:!0})){let _=z9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return U1(i5,X,"",""),null}let Y=W9(J),G=K9(i5,X,Y);if(G!==void 0)return G||null;if(J.length===0)return U1(i5,X,Y,""),null;let Q=[];for(let j of J){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),q=[],W=new Set,K=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let j of w)try{let _=await Bun.file(j).text(),H=z9.basename(j,".ts");IH(_,W),_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
12435
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return U1(i5,X,Y,""),null;let z=q.join(`
12357
12436
 
12358
12437
  `),B=`;(function(){
12359
12438
  var __stx = window.stx || {};
12360
- ${H1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12439
+ ${O1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12361
12440
  `)}
12362
12441
  ${z}
12363
- })();`;return z1(i5,X,Y,B),B}function DH(){i5.clear()}var i5;var oQ=D(()=>{O1();E1();Q1();i4();i5=new Map});var n4,CI;var sQ=D(()=>{n4=["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"],CI=new Set(n4)});var eQ={};a(eQ,{selectComposableFiles:()=>aQ,referencedFrameworkComposables:()=>tQ,getFrameworkComposableScript:()=>CH,clearFrameworkComposableCache:()=>bH,__setRuntimeOwnedForTest:()=>PH});import U9 from"path";function bH(){Z8.clear()}function aQ($){let X=new Map;for(let Z of $){let J=U9.basename(Z);if(J.endsWith(".d.ts"))continue;let Y=J.replace(/\.[jt]s$/,"");if(Y==="index")continue;if(Y===J)continue;let G=X.get(Y);if(G&&!G.endsWith(".js"))continue;X.set(Y,Z)}return[...X.values()].sort()}function SH($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function tQ($){if(!$)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 J of yH){if(r4.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function CH($,X){let Z=tQ($);if(Z.length===0)return null;let J=X??U9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=Z8.get(Y);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:J,absolute:!0}))K.push(_)}catch{return Z8.set(Y,""),null}K=aQ(K);for(let j of K){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>w.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${U9.basename(j).replace(/\.[jt]s$/,"")}
12442
+ })();`;return U1(i5,X,Y,B),B}function DH(){i5.clear()}var i5;var oQ=D(()=>{L1();E1();Q1();i4();i5=new Map});var n4,PI;var sQ=D(()=>{n4=["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"],PI=new Set(n4)});var eQ={};a(eQ,{selectComposableFiles:()=>aQ,referencedFrameworkComposables:()=>tQ,getFrameworkComposableScript:()=>CH,clearFrameworkComposableCache:()=>bH,__setRuntimeOwnedForTest:()=>PH});import U9 from"path";function bH(){Z8.clear()}function aQ($){let X=new Map;for(let Z of $){let J=U9.basename(Z);if(J.endsWith(".d.ts"))continue;let Y=J.replace(/\.[jt]s$/,"");if(Y==="index")continue;if(Y===J)continue;let G=X.get(Y);if(G&&!G.endsWith(".js"))continue;X.set(Y,Z)}return[...X.values()].sort()}function SH($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function tQ($){if(!$)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 J of yH){if(r4.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function CH($,X){let Z=tQ($);if(Z.length===0)return null;let J=X??U9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=Z8.get(Y);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:J,absolute:!0}))K.push(_)}catch{return Z8.set(Y,""),null}K=aQ(K);for(let j of K){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>w.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${U9.basename(j).replace(/\.[jt]s$/,"")}
12364
12443
  ${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${U9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!SH($,j));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return Z8.set(Y,""),null;let U=[...W].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
12365
12444
  `),B=`<script data-stx-framework-composables>
12366
12445
  ;(function(){
@@ -12370,15 +12449,15 @@ ${q.join(`
12370
12449
  `)}
12371
12450
  ${U}
12372
12451
  })();
12373
- </script>`;return Z8.set(Y,B),B}function PH($){r4.clear();for(let X of $)r4.add(X)}var Z8,r4,yH;var $w=D(()=>{E1();sQ();Z8=new Map,r4=new Set,yH=new Set(n4)});var Zw={};a(Zw,{getComposableScript:()=>gH,clearComposableCache:()=>hH});import J8 from"path";function Xw($){let X=J8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function xH($){if($)return J8.resolve($);let X=`<default>:${process.cwd()}`,Z=o4.get(X);if(Z!==void 0)return Z;let J=await fH();if(J!==null)o4.set(X,J);return J}async function fH(){let $=await t0(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return J8.resolve(X,Z);for(let J of vH){let Y=J8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Xw(Q))return Y}catch{}}return null}async function gH($){let X=await xH($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(Xw(_))continue;Z.push(_)}}catch{return z1(n5,X,"",""),null}let J=W9(Z),Y=K9(n5,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return z1(n5,X,J,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=J8.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])q.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")w.add(L)}catch{}_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
12374
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return z1(n5,X,J,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
12452
+ </script>`;return Z8.set(Y,B),B}function PH($){r4.clear();for(let X of $)r4.add(X)}var Z8,r4,yH;var $w=D(()=>{E1();sQ();Z8=new Map,r4=new Set,yH=new Set(n4)});var Zw={};a(Zw,{getComposableScript:()=>gH,clearComposableCache:()=>hH});import J8 from"path";function Xw($){let X=J8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function xH($){if($)return J8.resolve($);let X=`<default>:${process.cwd()}`,Z=o4.get(X);if(Z!==void 0)return Z;let J=await fH();if(J!==null)o4.set(X,J);return J}async function fH(){let $=await t0(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return J8.resolve(X,Z);for(let J of vH){let Y=J8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Xw(Q))return Y}catch{}}return null}async function gH($){let X=await xH($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(Xw(_))continue;Z.push(_)}}catch{return U1(n5,X,"",""),null}let J=W9(Z),Y=K9(n5,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return U1(n5,X,J,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=J8.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])q.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")w.add(L)}catch{}_=l0(_),_=A8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
12453
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return U1(n5,X,J,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
12375
12454
  `),K=JSON.stringify([...w]),z=Q.join(`
12376
12455
 
12377
12456
  `),B=`;(function(){
12378
12457
  window.__composables = window.__composables || {};
12379
12458
  var __c = window.__composables;
12380
12459
  var __stx = window.stx || {};
12381
- ${H1.filter((j)=>!q.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12460
+ ${O1.filter((j)=>!q.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12382
12461
  `)}
12383
12462
  ${z}
12384
12463
  ${W}
@@ -12395,7 +12474,7 @@ ${W}
12395
12474
  }
12396
12475
  window[__n] = __c[__n];
12397
12476
  }
12398
- })();`;return z1(n5,X,J,B),B}function hH(){n5.clear(),o4.clear()}var n5,o4,vH;var Jw=D(()=>{O1();E1();i4();Q1();n5=new Map,o4=new Map,vH=["composables","functions"]});var Gw={};a(Gw,{processDeferDirectives:()=>cH});function uH(){return`stx-defer-${++Yw}`}function dH($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function mH($,X,Z){let{trigger:J,value:Y}=dH(X),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 K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:J,triggerValue:Y,content:G,placeholder:Q,loading:w,error:q}}function lH($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12477
+ })();`;return U1(n5,X,J,B),B}function hH(){n5.clear(),o4.clear()}var n5,o4,vH;var Jw=D(()=>{L1();E1();i4();Q1();n5=new Map,o4=new Map,vH=["composables","functions"]});var Gw={};a(Gw,{processDeferDirectives:()=>cH});function uH(){return`stx-defer-${++Yw}`}function dH($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function mH($,X,Z){let{trigger:J,value:Y}=dH(X),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 K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:J,triggerValue:Y,content:G,placeholder:Q,loading:w,error:q}}function lH($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12399
12478
  const observer = new IntersectionObserver((entries) => {
12400
12479
  if (entries[0].isIntersecting) {
12401
12480
  observer.disconnect();
@@ -14733,7 +14812,7 @@ else {
14733
14812
  <script type="application/json" id="stx-island-manifest">
14734
14813
  ${JSON.stringify(X)}
14735
14814
  </script>
14736
- `}var pO;var dw=D(()=>{pO={processPartialHydrationDirectives:bw,processStaticDirectives:gw,generatePartialHydrationCSS:Sw,generateIslandManifest:hw,createIslandRegistry:yw,hydrateIsland:Cw,hydrateByStrategy:Pw,hydrateAll:vw,isHydrated:xw,onHydrated:fw}});var tw={};a(tw,{watchMultiple:()=>iw,watchEffect:()=>nw,watch:()=>pw,unref:()=>mw,toRefs:()=>lw,throttledComputed:()=>aw,stxWatchMultiple:()=>iw,stxWatchEffect:()=>nw,stxWatch:()=>pw,stxUnref:()=>mw,stxToRefs:()=>lw,stxThrottledComputed:()=>aw,stxShallowRef:()=>cw,stxRef:()=>o5,stxIsRef:()=>m1,stxDebouncedComputed:()=>sw,stxComputed:()=>G8,shallowRef:()=>cw,ref:()=>o5,processWatchDirectives:()=>ow,processComputedDirectives:()=>rw,isRef:()=>m1,default:()=>iO,debouncedComputed:()=>sw,computed:()=>G8});function o5($){let X=$,Z=new Set,J={get value(){if(U1){let Y=Y8.get(J);if(!Y)Y=new Set,Y8.set(J,Y);Y.add(U1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=Y8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function mw($){return m1($)?$.value:$}function lw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=o5($[Z]);return X}function cw($){return o5($)}function G8($){let X=typeof $==="function",Z=X?$:$.get,J=X?void 0:$.set,Y=X?Object.is:$.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let U=z.value;q.forEach((B)=>B(U))}};function K(){w.clear();let U=U1;U1=W,j9.push(W);try{return Z()}finally{j9.pop(),U1=U}}let z={get value(){if(U1){let U=Y8.get(z);if(!U)U=new Set,Y8.set(z,U);U.add(U1)}if(Q){let U=K();if(!Y(G,U))G=U;Q=!1}return G},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return z}function pw($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(m1($))return Y?z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let _=()=>{if(X(j,w),w=Y?z5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(m1($))U=$.subscribe(()=>z());else U=G8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(q=!1,U)U(),U=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function iw($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>m1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>m1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},W=$.map((z)=>{if(m1(z))return z.subscribe(()=>q());return()=>{}});if(J)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function nw($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let q=U1;U1=Q,j9.push(Q);try{J=$()}finally{j9.pop(),U1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(Y=!1,J)J()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function rw($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let q=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function ow($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
14815
+ `}var pO;var dw=D(()=>{pO={processPartialHydrationDirectives:bw,processStaticDirectives:gw,generatePartialHydrationCSS:Sw,generateIslandManifest:hw,createIslandRegistry:yw,hydrateIsland:Cw,hydrateByStrategy:Pw,hydrateAll:vw,isHydrated:xw,onHydrated:fw}});var tw={};a(tw,{watchMultiple:()=>iw,watchEffect:()=>nw,watch:()=>pw,unref:()=>mw,toRefs:()=>lw,throttledComputed:()=>aw,stxWatchMultiple:()=>iw,stxWatchEffect:()=>nw,stxWatch:()=>pw,stxUnref:()=>mw,stxToRefs:()=>lw,stxThrottledComputed:()=>aw,stxShallowRef:()=>cw,stxRef:()=>o5,stxIsRef:()=>m1,stxDebouncedComputed:()=>sw,stxComputed:()=>G8,shallowRef:()=>cw,ref:()=>o5,processWatchDirectives:()=>ow,processComputedDirectives:()=>rw,isRef:()=>m1,default:()=>iO,debouncedComputed:()=>sw,computed:()=>G8});function o5($){let X=$,Z=new Set,J={get value(){if(j1){let Y=Y8.get(J);if(!Y)Y=new Set,Y8.set(J,Y);Y.add(j1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=Y8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function mw($){return m1($)?$.value:$}function lw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=o5($[Z]);return X}function cw($){return o5($)}function G8($){let X=typeof $==="function",Z=X?$:$.get,J=X?void 0:$.set,Y=X?Object.is:$.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let U=z.value;q.forEach((B)=>B(U))}};function K(){w.clear();let U=j1;j1=W,j9.push(W);try{return Z()}finally{j9.pop(),j1=U}}let z={get value(){if(j1){let U=Y8.get(z);if(!U)U=new Set,Y8.set(z,U);U.add(j1)}if(Q){let U=K();if(!Y(G,U))G=U;Q=!1}return G},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return z}function pw($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(m1($))return Y?z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let _=()=>{if(X(j,w),w=Y?z5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(m1($))U=$.subscribe(()=>z());else U=G8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(q=!1,U)U(),U=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function iw($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>m1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>m1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},W=$.map((z)=>{if(m1(z))return z.subscribe(()=>q());return()=>{}});if(J)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function nw($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let q=j1;j1=Q,j9.push(Q);try{J=$()}finally{j9.pop(),j1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(Y=!1,J)J()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function rw($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let q=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function ow($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
14737
14816
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
14738
14817
  (function() {
14739
14818
  // Watch implementation for ${G}
@@ -14745,7 +14824,7 @@ else {
14745
14824
  }
14746
14825
  })();
14747
14826
  </script>
14748
- `})}function z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>z5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(z5(Y),z5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(z5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=z5($[Z]);return X}function sw($,X=100){let Z=o5($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function aw($,X=100){let Z=o5($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var U1=null,j9,Y8,iO;var ew=D(()=>{j9=[],Y8=new WeakMap;iO={ref:o5,computed:G8,watch:pw,watchMultiple:iw,watchEffect:nw,isRef:m1,unref:mw,toRefs:lw,shallowRef:cw,debouncedComputed:sw,throttledComputed:aw,processComputedDirectives:rw,processWatchDirectives:ow}});function Q8($,X){let Z={};for(let J of $)Z[J]=v1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=v1(G);return!0},has:(J,Y)=>(Y in Z),deleteProperty:(J,Y)=>{return delete Z[Y],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(J,Y)=>(Y in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[Y]()}:void 0})}function nO($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function t4($,X){let Z=Object.keys($),J=Q8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=Q8(Z,()=>[]),G=Q8(Z,()=>!1),Q=Q8(Z,()=>!1),w=Q8(Z,()=>!1),q=v1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,w[O]=!1,F.length===0}async function K(){q.set(!0);let O=await Promise.all(Z.map(W));return q.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function B(O,F){J[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:w[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(nO(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return q()||Z.some((O)=>w[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:W,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var $q;var Xq=D(()=>{i8();$q=t4});var Gq={};a(Gq,{v:()=>rO,useForm:()=>t4,processHasErrorsDirective:()=>Yq,processFormValidationDirectives:()=>oO,processErrorsDirective:()=>Jq,processErrorDirective:()=>Zq,defineForm:()=>$q,Validator:()=>s5});class s5{rules=[];defaultValue="";addRule($){let X=new s5;return X.rules=[...this.rules,$],X.defaultValue=this.defaultValue,X}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(X)=>{if(X===null||X===void 0)return $;if(typeof X==="string"&&X.trim()==="")return $;if(Array.isArray(X)&&X.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(X)=>{if(!X)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(X))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(X)=>{if(!X)return!0;try{return new URL(String(X)),!0}catch{return $}}})}min($,X){let Z=X||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Z}})}length($,X,Z){let J=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:J,validate:(Y)=>{if(!Y)return!0;let G=String(Y).length;return G>=$&&G<=X||J}})}pattern($,X="Invalid format"){return this.addRule({name:"pattern",message:X,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||X}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(X)=>{if(!X)return!0;return!String(X).includes(" ")||$}})}number($="Must be a number"){let X=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return X.defaultValue=0,X}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number.isInteger(Number(X))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<0||$}})}minValue($,X){let Z=X||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Z}})}between($,X,Z){let J=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;let G=Number(Y);return G>=$&&G<=X||J}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(J,Y)=>{if(!Y)return!0;return J===Y[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(J)=>{if(!J)return!0;return $.includes(J)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(X)=>{if(!X)return!0;let Z=new Date(String(X));return!Number.isNaN(Z.getTime())||$}})}before($,X){let Z=new Date($),J=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))<Z||J}})}after($,X){let Z=new Date($),J=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))>Z||J}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new s5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let J of X.getRules())Z.rules.push({...J,validate:(Y,G)=>{if(!$(Y,G||{}))return!0;return J.validate(Y,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new s5;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let J of this.rules){let Y=await J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}validateSync($,X){let Z=[];for(let J of this.rules){if(J.async)continue;let Y=J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}}function Zq($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
14827
+ `})}function z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>z5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(z5(Y),z5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(z5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=z5($[Z]);return X}function sw($,X=100){let Z=o5($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function aw($,X=100){let Z=o5($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return G8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var j1=null,j9,Y8,iO;var ew=D(()=>{j9=[],Y8=new WeakMap;iO={ref:o5,computed:G8,watch:pw,watchMultiple:iw,watchEffect:nw,isRef:m1,unref:mw,toRefs:lw,shallowRef:cw,debouncedComputed:sw,throttledComputed:aw,processComputedDirectives:rw,processWatchDirectives:ow}});function Q8($,X){let Z={};for(let J of $)Z[J]=v1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=v1(G);return!0},has:(J,Y)=>(Y in Z),deleteProperty:(J,Y)=>{return delete Z[Y],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(J,Y)=>(Y in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[Y]()}:void 0})}function nO($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function t4($,X){let Z=Object.keys($),J=Q8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=Q8(Z,()=>[]),G=Q8(Z,()=>!1),Q=Q8(Z,()=>!1),w=Q8(Z,()=>!1),q=v1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,w[O]=!1,F.length===0}async function K(){q.set(!0);let O=await Promise.all(Z.map(W));return q.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function B(O,F){J[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:w[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(nO(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return q()||Z.some((O)=>w[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:W,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var $q;var Xq=D(()=>{i8();$q=t4});var Gq={};a(Gq,{v:()=>rO,useForm:()=>t4,processHasErrorsDirective:()=>Yq,processFormValidationDirectives:()=>oO,processErrorsDirective:()=>Jq,processErrorDirective:()=>Zq,defineForm:()=>$q,Validator:()=>s5});class s5{rules=[];defaultValue="";addRule($){let X=new s5;return X.rules=[...this.rules,$],X.defaultValue=this.defaultValue,X}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(X)=>{if(X===null||X===void 0)return $;if(typeof X==="string"&&X.trim()==="")return $;if(Array.isArray(X)&&X.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(X)=>{if(!X)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(X))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(X)=>{if(!X)return!0;try{return new URL(String(X)),!0}catch{return $}}})}min($,X){let Z=X||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Z}})}length($,X,Z){let J=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:J,validate:(Y)=>{if(!Y)return!0;let G=String(Y).length;return G>=$&&G<=X||J}})}pattern($,X="Invalid format"){return this.addRule({name:"pattern",message:X,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||X}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(X)=>{if(!X)return!0;return!String(X).includes(" ")||$}})}number($="Must be a number"){let X=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return X.defaultValue=0,X}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number.isInteger(Number(X))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<0||$}})}minValue($,X){let Z=X||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Z}})}between($,X,Z){let J=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;let G=Number(Y);return G>=$&&G<=X||J}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(J,Y)=>{if(!Y)return!0;return J===Y[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(J)=>{if(!J)return!0;return $.includes(J)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(X)=>{if(!X)return!0;let Z=new Date(String(X));return!Number.isNaN(Z.getTime())||$}})}before($,X){let Z=new Date($),J=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))<Z||J}})}after($,X){let Z=new Date($),J=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))>Z||J}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new s5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let J of X.getRules())Z.rules.push({...J,validate:(Y,G)=>{if(!$(Y,G||{}))return!0;return J.validate(Y,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new s5;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let J of this.rules){let Y=await J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}validateSync($,X){let Z=[];for(let J of this.rules){if(J.async)continue;let Y=J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}}function Zq($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
14749
14828
  `)}catch{return""}})}function Jq($,X,Z){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
14750
14829
  `)}catch{return""}})}function Yq($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function oO($,X,Z){let J=$;return J=Zq(J,X,Z),J=Jq(J,X,Z),J=Yq(J,X,Z),J}var rO;var Qq=D(()=>{Xq();rO=new s5});var Wq={};a(Wq,{processXElementDirectives:()=>sO,hasXElementDirectives:()=>qq,generateXElementRuntime:()=>wq});function wq(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14751
14830
  (function() {
@@ -15033,7 +15112,7 @@ else {
15033
15112
  })();
15034
15113
  </script>`}function qq($){return/\bx-data(?:\s|=)/.test($)}function sO($){let X=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=$.match(X)||[],J=Z.length>0?$.replace(X,""):$;if(!qq(J))return J;let Y=Z[0]?.trim()||wq(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15035
15114
  `+J.slice(G);return J+`
15036
- `+Y}var Kq={};a(Kq,{rewriteImagesWithSiblings:()=>eO});import R1 from"path";async function eO($,X){let Z=X.formats??tO;if(!X.publicDir)return $;let J=ZL($),Y=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec($))!==null){let z=w[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(JL(w.index,J))continue;Q.push({idx:w.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let q=await Promise.all(Q.map(async(z)=>{let U=await $L(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of q){if(U.length===0)continue;let j=`<picture>${U.map((_)=>`<source type="${_.mime}" srcset="${YL(_.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Y.length===0)return $;let W="",K=0;for(let z of Y)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function $L($,X,Z){if(!XL($))return[];let J=R1.extname($).toLowerCase();if(!aO.has(J))return[];if(!$.startsWith("/"))return[];let Y=R1.join(X,$.slice(1)),G=R1.dirname(Y),Q=R1.basename(Y,J),w=R1.resolve(G),q=R1.resolve(X);if(!w.startsWith(q))return[];let W=R1.posix.dirname($),K=Z.map(async(U)=>{let B=R1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:R1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function XL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function ZL($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);return X}function JL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function YL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var aO,tO;var zq=D(()=>{aO=new Set([".jpg",".jpeg",".png",".gif"]),tO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Uq=()=>{};function e4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var jq=D(()=>{Uq()});var Bq={};a(Bq,{injectPwaTags:()=>GL,generateThemeColorMeta:()=>qL,generateSwRegistrationScript:()=>QL,generatePwaTags:()=>B9,generateManifestLink:()=>wL});function B9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=e4($),G=`
15115
+ `+Y}var Kq={};a(Kq,{rewriteImagesWithSiblings:()=>eO});import N1 from"path";async function eO($,X){let Z=X.formats??tO;if(!X.publicDir)return $;let J=ZL($),Y=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec($))!==null){let z=w[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(JL(w.index,J))continue;Q.push({idx:w.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let q=await Promise.all(Q.map(async(z)=>{let U=await $L(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of q){if(U.length===0)continue;let j=`<picture>${U.map((_)=>`<source type="${_.mime}" srcset="${YL(_.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Y.length===0)return $;let W="",K=0;for(let z of Y)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function $L($,X,Z){if(!XL($))return[];let J=N1.extname($).toLowerCase();if(!aO.has(J))return[];if(!$.startsWith("/"))return[];let Y=N1.join(X,$.slice(1)),G=N1.dirname(Y),Q=N1.basename(Y,J),w=N1.resolve(G),q=N1.resolve(X);if(!w.startsWith(q))return[];let W=N1.posix.dirname($),K=Z.map(async(U)=>{let B=N1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:N1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function XL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function ZL($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);return X}function JL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function YL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var aO,tO;var zq=D(()=>{aO=new Set([".jpg",".jpeg",".png",".gif"]),tO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Uq=()=>{};function e4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var jq=D(()=>{Uq()});var Bq={};a(Bq,{injectPwaTags:()=>GL,generateThemeColorMeta:()=>qL,generateSwRegistrationScript:()=>QL,generatePwaTags:()=>B9,generateManifestLink:()=>wL});function B9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=e4($),G=`
15037
15116
  <!-- stx PWA Meta Tags -->
15038
15117
  <link rel="manifest" href="/manifest.json">
15039
15118
  <meta name="theme-color" content="${$2(Z?.themeColor||"#000000")}">
@@ -15096,20 +15175,20 @@ if ('serviceWorker' in navigator) {
15096
15175
  `){q=-1;break}q++}if(q===-1){J++,Y=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;J=q,Y=!1;continue}if(w==="'"||w==='"'){let q=w;J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
15097
15176
  `)break;J++}Y=!1;continue}if(w==="`"){J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}if(G.length===0)Y=!1;continue}if(w==="}"&&G.length>0){G.pop(),J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))Y=!1;else Y=!0;J++}return-1}function a5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,G=$.indexOf("</script>",Y);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:J.index,end:Q+1}}function Oq($){let X=0;while(X<$.length){let Z=$.indexOf("<",X);if(Z===-1)return-1;if($.startsWith("<!--",Z)){let G=$.indexOf("-->",Z+4);X=G===-1?$.length:G+3;continue}let J=$.slice(Z),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let G=$.toLowerCase().indexOf("</style>",Z+Y[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(J))return Z;X=Z+1}return-1}function zL($){let X=a5($,"data-stx-runtime");if(!X)return $;let Z=Oq($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=Oq(Y);if(G===-1)return J+`
15098
15177
  `+Y;return Y.slice(0,G)+J+`
15099
- `+Y.slice(G)}async function O0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=L1($);let G=!X.__stxProcessingDepth;if(G)H6(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!m7()&&!D$())&&Z&&Z.endsWith(".stx"))o3($,Z);try{return await h6.timeAsync("template-processing",async()=>{let Q=await UL($,X,Z,J,Y);if(G)Q=m4(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},W=(X.__stx_runtime_head||null)??wX(),K=(X.__stx_head_raw||"").trim(),z,U=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)z=U[1].trim(),K=K.replace(U[0],"").trim();let B=X.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),H={...w,...j&&{title:j},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15178
+ `+Y.slice(G)}async function O0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=F1($);let G=!X.__stxProcessingDepth;if(G)H6(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!m7()&&!D$())&&Z&&Z.endsWith(".stx"))o3($,Z);try{return await h6.timeAsync("template-processing",async()=>{let Q=await UL($,X,Z,J,Y);if(G)Q=m4(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},W=(X.__stx_runtime_head||null)??wX(),K=(X.__stx_head_raw||"").trim(),z,U=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)z=U[1].trim(),K=K.replace(U[0],"").trim();let B=X.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),H={...w,...j&&{title:j},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15100
15179
  `),...W.htmlAttrs&&{htmlAttrs:vQ(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},L=h4(Q);if(Q=hQ(Q,H,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)Q=gQ(Q,w),Q=xQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=j7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
15101
15180
  <meta name="stx-layout" content="${Hq(A)}">
15102
15181
  <meta name="stx-layout-group" content="${Hq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?f7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=g8(Q,(R,N)=>`<body${N} 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=fQ(Q);let w=J.app?.colorMode;if(w)Q=yQ(Q,w);Q=SQ(Q),Q=zL(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (oQ(),rQ))),q=J.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,z=a5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15103
15182
  `+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => ($w(),eQ))),q=await w(Q);if(q){let W=a5(Q,"data-stx-stores")||a5(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
15104
15183
  `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (Jw(),Zw))),q=J.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,z=a5(Q,"data-stx-stores")||a5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15105
- `+K+Q.slice(z.end)}}catch{}if(G)Q=bQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await i7(Q,void 0,J.buildMode==="serve");if(G)Q=c6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof C$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if($1.log(q,{filePath:Z,context:X}),T3.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function UL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!S0.isAbsolute(J.partialsDir)?S0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!S0.isAbsolute(J.componentsDir)?S0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!S0.isAbsolute(J.layoutsDir)?S0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,q=$;await _L(Z,X),BL(X,w),q=await P5(()=>UQ(q,X,Z,w),q,(F)=>{$1.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,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.tokens,z=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),U="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=NQ(q),q=await lQ(q,Z,Y);let B={};q=D4(q,B);let j={...X.__sections||{}},_="",H=SY(m$($)),L=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(q))q=`@section('content')
15184
+ `+K+Q.slice(z.end)}}catch{}if(G)Q=bQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await i7(Q,void 0,J.buildMode==="serve");if(G)Q=c6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof C$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if($1.log(q,{filePath:Z,context:X}),T3.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function UL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!S0.isAbsolute(J.partialsDir)?S0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!S0.isAbsolute(J.componentsDir)?S0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!S0.isAbsolute(J.layoutsDir)?S0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,q=$;await _L(Z,X),BL(X,w),q=await P5(()=>UQ(q,X,Z,w),q,(F)=>{$1.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,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.tokens,z=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),U="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=NQ(q),q=await lQ(q,Z,Y);let B={};q=D4(q,B);let j={...X.__sections||{}},_="",H=SY(m$($)),L=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(q))q=`@section('content')
15106
15185
  ${q.trim()}
15107
15186
  @endsection`}if(!_&&!L&&w.defaultLayout){let F=g4(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=S0.dirname(Z),N=w.layoutsDir?S0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=S0.join(R,"_layout.stx");if(await p(M)){A=M;break}let k=S0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)_=A;else if(w.layoutsDir){let T=S0.isAbsolute(w.layoutsDir)?w.layoutsDir:S0.resolve(process.cwd(),w.layoutsDir),M=S0.join(T,`${w.defaultLayout}.stx`);if(await p(M))_=M}if(_&&!V)q=`@section('content')
15108
15187
  ${q.trim()}
15109
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[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(),X);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",U5);else j[V]=A.trim();return""}),X.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=y4(q,B),_){let F=[],V=y1(q),A=w1(V.output,M5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
15188
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[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(),X);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",U5);else j[V]=A.trim();return""}),X.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=y4(q,B),_){let F=[],V=y1(q),A=q1(V.output,M5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
15110
15189
  `);j.content=j.content?`${j.content}
15111
15190
  ${R}`:R,X.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,Y.add(_);else F=await P5(()=>dX(_,Z,Q,Y),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let y=Q.layoutsDir;if(y){let I=S0.isAbsolute(y)?y:S0.resolve(process.cwd(),y);M=WL.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${_} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(k),{layoutPath:_,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new Y5(k,Z);return q}let V=await P5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`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 M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,C)=>{return M[b]=C.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(U5)){let C=j[S].indexOf(U5);j[S]=j[S].slice(0,C)+b+j[S].slice(C+U5.length)}else if(!j[S])j[S]=b;let y={...X,__sections:j},I=`@layout('${A[1]}')${k}`;return await O0(I,y,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=D4(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,y)=>{return T[k]=y.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,y)=>{if(j[k]){let I=j[k];if(I.includes(U5)){let S=T[k]||"",b=I.indexOf(U5);I=I.slice(0,b)+S+I.slice(b+U5.length)}return I}return y||""}),N=jL(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=y4(N,B),X.__originalFilePath=Z,q=await Lq(N,X,F,Q,Y),q=`<!-- stx-layout: ${_} -->
15112
- ${q}`,z(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await Lq(q,X,Z,Q,Y))}function jL($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,J,Y)=>{let G=X[J];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return Y||""})}function BL($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",J={};for(let[Y,G]of Object.entries(process.env))if(Y.startsWith(Z)&&G!==void 0)J[Y]=G;$.$env=J}async function _L($,X){await P5(()=>OQ($,X),void 0,(Z)=>{$1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function HL($,X,Z){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (v7(),v8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));$1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function OL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await e("stx/expressions",()=>Promise.resolve().then(() => (q1(),x6)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return $1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function Lq($,X,Z,J,Y){let G=$,Q=J;if(await HL(G,X,Z),G=await OL(G,X,Z),G=await QQ(G,X,Z),G=await wQ(G,X,Z),G=await tY(G,X,Z,Q),L1(G))G=vX(G,X),G=fX(G,X);G=xX(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (r3(),n3)));G=w(G,X),G=M4(G,X,Z,Q),G=await EQ(G,X,Z,Q,Y),G=await Z9(G,X,Z,Q,Y),G=S2(G,X,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => Gw));G=q(G,X,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => ww));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => zw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => jw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => Bw));G=B(G,X,Z);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => Lw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => Vw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (kw(),Mw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (dw(),uw)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (ew(),tw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Qq(),Gq)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (P7(),WX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)y();let I=T(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
15191
+ ${q}`,z(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await Lq(q,X,Z,Q,Y))}function jL($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,J,Y)=>{let G=X[J];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return Y||""})}function BL($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",J={};for(let[Y,G]of Object.entries(process.env))if(Y.startsWith(Z)&&G!==void 0)J[Y]=G;$.$env=J}async function _L($,X){await P5(()=>OQ($,X),void 0,(Z)=>{$1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function HL($,X,Z){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (v7(),v8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));$1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function OL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await e("stx/expressions",()=>Promise.resolve().then(() => (W1(),x6)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return $1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function Lq($,X,Z,J,Y){let G=$,Q=J;if(await HL(G,X,Z),G=await OL(G,X,Z),G=await QQ(G,X,Z),G=await wQ(G,X,Z),G=await tY(G,X,Z,Q),F1(G))G=vX(G,X),G=fX(G,X);G=xX(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (r3(),n3)));G=w(G,X),G=M4(G,X,Z,Q),G=await EQ(G,X,Z,Q,Y),G=await Z9(G,X,Z,Q,Y),G=S2(G,X,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => Gw));G=q(G,X,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => ww));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => zw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => jw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => Bw));G=B(G,X,Z);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => Lw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => Vw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (kw(),Mw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (dw(),uw)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (ew(),tw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Qq(),Gq)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (P7(),WX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)y();let I=T(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
15113
15192
  `;if(G=M(G,X),G=k(G,X),G=_Q(G),G=C3(G,X),G=sY(G),G=KQ(G),G=await E4(G,X,Z,Q,Y),G=await Z9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=L6(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=m4(G),G=Q5(G,X,Z),G=P3(G,X),G=v3(G,X),G=n$(G,X),G=wG(G,X),G=qG(G,X),G=await gY(G,X,Z,Q),G=await oZ(G,X,Z),G=await jG(G,X,Z,Q),G=M2(G,X,Z,Q),G=JY(G,X,Z,Q),G=YY(G,X,Z),G=GY(G,X,Z,Q),G=nY(G,X,Z,Q),G=u4(G,X),G=d4(G),G=pQ(G),!Q.skipEventDirectives)G=a2(G,X,Z);if(G=xY(G,X,Z),Q.debug){let n=/\bx-data\s*=/.test(G),s=e8($);if(n&&s)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15114
15193
  Both work on the same page, but they manage separate scopes.
15115
15194
  Prefer signals (state/derived/effect) for new components.`)}G=VQ(G,X),G=await b1(G,X,Z),G=iQ(G),G=nQ(G),G=EY(G);let{processXElementDirectives:S}=await e("stx/x-element",()=>Promise.resolve().then(() => Wq));G=S(G);let b=X.__originalFilePath||Z,C=k7(X);if(G=await gX(G,Q,b,C),G=JG(G,X),G=await jQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let n=Q.publicDir||"public",{rewriteImagesWithSiblings:s}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (zq(),Kq)));G=await s(G,{publicDir:n})}if(Q.seo?.enabled)G=QY(G,X,Q);let P=(n,s,K0=!0)=>{if(!s)return n;let I0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&w0){if(K0)n=n.replace(w0[0],I0[0]);if(s=s.replace(I0[0],"").trim(),!s)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${s}
@@ -15124,10 +15203,10 @@ ${TY()}
15124
15203
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
15125
15204
  ${s}`);else G=s+`
15126
15205
  `+G}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$))),s=[];for(let K0 of n(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let I0=K0.start+K0.fullMatch.indexOf(">")+1,w0=KL(G,I0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;s.push({start:K0.start,end:E})}for(let K0=s.length-1;K0>=0;K0--){let{start:I0,end:w0}=s[K0];G=G.substring(0,I0)+G.substring(w0)}}let u=b8(G,Z);if(u.hasScoped)G=u.html;let t=X.__stx_event_bindings||[],R0=!1,P0=[],j5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:B5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (h7(),$$)));for(let n of B5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))P0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:s,content:K0}of P0){R0=!0;let I0=K0;c4(K0,Z,J.strict,X.__originalFilePath);let w0=await I7(K0,{eventBindings:t,attrs:s,hasColonDirectives:j5,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:C});G=G.replace(n,()=>w0)}if(R0)X.__stx_event_bindings=[];if(!R0&&X.__stxProcessingDepth===1){let n=X.__stx_event_bindings||[];if(n.length>0){let s=p9(n);if(s){let K0=G.lastIndexOf("</body>");G=K0===-1?G+s:G.slice(0,K0)+s+`
15127
- `+G.slice(K0)}X.__stx_event_bindings=[]}}if(!PZ(G)&&vZ(G))G=await o8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=iY(G,X.cspNonce);return G}var U5="<!--PARENT_CONTENT_PLACEHOLDER-->";var Y$=D(()=>{d$();OX();r1();g9();MY();DY();bY();d9();h9();i9();E7();fY();hY();c$();rY();aY();$G();YG();F1();P7();q1();WG();BG();GQ();WQ();k4();mX();BQ();E5();HQ();v$();k0();LQ();AQ();TQ();DQ();GX();v4();uQ();h7();N4();cQ();l4();p4();T0();s3();e9();A7();s8();s8();l4();p4()});import V0 from"fs";import G0 from"path";import Y2 from"fs";import Sq from"path";var O9="resources/assets",G2="assets";function Q2($=process.cwd()){let X=Sq.resolve($,O9);return Y2.existsSync(X)&&Y2.statSync(X).isDirectory()?X:null}import H5 from"fs";import L9 from"path";var w2="_stx";function Cq($){return Bun.hash($).toString(16).slice(0,8)}function Pq($){let X=[],Z=(J)=>{for(let Y of H5.readdirSync(J,{withFileTypes:!0})){let G=L9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(H5.existsSync($))Z($);return X}var vq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function xq($,X=`/${w2}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of vq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${Cq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function q2($){let X={pages:0,assets:0,bytesInlined:0},Z=L9.join($,w2),J=new Set;for(let Y of Pq($)){let G=H5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=xq(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),H5.mkdirSync(Z,{recursive:!0}),H5.writeFileSync(L9.join(Z,W.filename),W.contents),X.assets++}H5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}x9();Y$();import{createHash as LL}from"crypto";function FL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var VL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function AL($){return Bun.hash($).toString(16)}function Fq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(VL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=FL(W);let K=AL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${LL("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${w}></script>`}),Y=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:J,chunks:Y}}var RL=new Set(["visible","idle"]);function Vq($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Z.exec($))!==null)X.set(J[1],J[2]);let Y=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(RL.has(X.get(Q[1])||""))Y.add(Q[2]);let w=$.lastIndexOf("</head>");if(Y.size===0||w===-1)return $;let q=Array.from(Y).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,w)+q+$.slice(w)}O1();import w8 from"fs";import _9 from"path";var NL="layout-types.d.ts";function TL($){let X=[],Z=(J,Y)=>{let G;try{G=w8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=_9.join(J,Q.name);if(Q.isDirectory())Z(w,Y?`${Y}/${Q.name}`:Q.name);else if(Q.isFile()&&Q.name.endsWith(".stx")&&Q.name!=="_layout.stx"){let q=Q.name.slice(0,-4);X.push(Y?`${Y}/${q}`:q)}}};return Z($,""),X.sort()}function ML($){let X=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return X.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),X.join(`
15206
+ `+G.slice(K0)}X.__stx_event_bindings=[]}}if(!PZ(G)&&vZ(G))G=await o8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=iY(G,X.cspNonce);return G}var U5="<!--PARENT_CONTENT_PLACEHOLDER-->";var Y$=D(()=>{d$();OX();r1();g9();MY();DY();bY();d9();h9();i9();E7();fY();hY();c$();rY();aY();$G();YG();V1();P7();W1();WG();BG();GQ();WQ();k4();mX();BQ();E5();HQ();v$();k0();LQ();AQ();TQ();DQ();GX();v4();uQ();h7();N4();cQ();l4();p4();T0();s3();e9();A7();s8();s8();l4();p4()});import F0 from"fs";import G0 from"path";import Y2 from"fs";import Sq from"path";var O9="resources/assets",G2="assets";function Q2($=process.cwd()){let X=Sq.resolve($,O9);return Y2.existsSync(X)&&Y2.statSync(X).isDirectory()?X:null}import H5 from"fs";import L9 from"path";var w2="_stx";function Cq($){return Bun.hash($).toString(16).slice(0,8)}function Pq($){let X=[],Z=(J)=>{for(let Y of H5.readdirSync(J,{withFileTypes:!0})){let G=L9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(H5.existsSync($))Z($);return X}var vq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function xq($,X=`/${w2}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of vq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${Cq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function q2($){let X={pages:0,assets:0,bytesInlined:0},Z=L9.join($,w2),J=new Set;for(let Y of Pq($)){let G=H5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=xq(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),H5.mkdirSync(Z,{recursive:!0}),H5.writeFileSync(L9.join(Z,W.filename),W.contents),X.assets++}H5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}x9();Y$();import{createHash as LL}from"crypto";function FL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var VL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function AL($){return Bun.hash($).toString(16)}function Fq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(VL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=FL(W);let K=AL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${LL("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${w}></script>`}),Y=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:J,chunks:Y}}var RL=new Set(["visible","idle"]);function Vq($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Z.exec($))!==null)X.set(J[1],J[2]);let Y=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(RL.has(X.get(Q[1])||""))Y.add(Q[2]);let w=$.lastIndexOf("</head>");if(Y.size===0||w===-1)return $;let q=Array.from(Y).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,w)+q+$.slice(w)}L1();import w8 from"fs";import _9 from"path";var NL="layout-types.d.ts";function TL($){let X=[],Z=(J,Y)=>{let G;try{G=w8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=_9.join(J,Q.name);if(Q.isDirectory())Z(w,Y?`${Y}/${Q.name}`:Q.name);else if(Q.isFile()&&Q.name.endsWith(".stx")&&Q.name!=="_layout.stx"){let q=Q.name.slice(0,-4);X.push(Y?`${Y}/${q}`:q)}}};return Z($,""),X.sort()}function ML($){let X=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return X.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),X.join(`
15128
15207
  `);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
15129
15208
  `)}function Aq($,X){if(!$)return[];let Z=_9.isAbsolute($)?$:_9.resolve(process.cwd(),$),J=TL(Z),Y=ML(J),G=_9.join(X,NL);try{if(w8.existsSync(G)&&w8.readFileSync(G,"utf8")===Y)return J;w8.mkdirSync(X,{recursive:!0}),w8.writeFileSync(G,Y)}catch{}return J}var kL=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X2($){let X=$.trim();if(!X)return null;let Z=/^https?:\/\//i.test(X)?X:`https://${X}`;try{return new URL(Z).origin+new URL(Z).pathname.replace(/\/$/,"")}catch{return null}}function IL($){for(let X of kL){let Z=$[X];if(!Z)continue;let J=X2(Z);if(J)return{url:J,source:"env",via:X}}return null}function Rq($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?X2(Z):null}async function EL($){let{existsSync:X}=await import("fs"),Z=await import("path");for(let J of["site.config.ts","site.config.js",".config/site.config.ts"]){let Y=Z.resolve($,J);if(!X(Y))continue;try{let G=await import(Y),Q=Rq(G.default??G);if(Q)return Q}catch{}}return null}async function Nq($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=X2($.explicit);if(Q)return{url:Q,source:"option"}}let J=Rq($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await EL(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=IL(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function Tq(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
15130
- `)}v$();F7();d$();M1();class Mq{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await V0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=V0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(V0.existsSync(G)){let Q=V0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class kq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await V0.promises.mkdir(G0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await V0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!V0.existsSync(X))return;let Z=await V0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await V0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function DL($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let J=Z[1];if(!J.includes("getStaticPaths"))return null;let Y=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Y)return null;return await Function(`
15209
+ `)}v$();F7();d$();k1();class Mq{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=F0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(F0.existsSync(G)){let Q=F0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class kq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await F0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!F0.existsSync(X))return;let Z=await F0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await F0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function DL($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let J=Z[1];if(!J.includes("getStaticPaths"))return null;let Y=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Y)return null;return await Function(`
15131
15210
  return (async function getStaticPaths() {
15132
15211
  ${Y[1]}
15133
15212
  })()
@@ -15167,10 +15246,10 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15167
15246
  ${Z.join(`
15168
15247
  `)}
15169
15248
  </channel>
15170
- </rss>`}async function hL($={}){let X=Date.now(),Z=await t0(),J=await Nq({explicit:$.domain,stxConfig:Z});if(J.source==="fallback"&&($.sitemap??!0))console.warn(Tq());let Y={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:J.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||B1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&V0.existsSync(Y.outputDir))await V0.promises.rm(Y.outputDir,{recursive:!0});await V0.promises.mkdir(Y.outputDir,{recursive:!0});let z=new Mq(Y.cacheDir);if(Y.cache)await z.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (d$(),NY));await R('<div class="bg-black"></div>')}catch{}w7();let U=Z?.routeMiddleware?.dir||"middleware";await W7(process.cwd(),U);let B=q7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];Aq(Z?.layoutsDir,B1(process.cwd()));let _=_7(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let R of _){let N=await yL(R);for(let T of N)H.push({route:R,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??Y.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let R=0;R<H.length;R+=Y.concurrency)O.push(H.slice(R,R+Y.concurrency));for(let R of O)await Promise.all(R.map(async(N)=>{let{route:T,url:M,params:k,props:y,revalidate:I}=N;try{await Y.hooks.onPageStart?.(M);let S=await Bun.file(T.filePath).text(),b=lL(S),C=b?.middleware?Array.isArray(b.middleware)?b.middleware:[b.middleware]:[],P=[...j,...C];if(P.length>0){let U0=K7(M,k,b||{}),A0=z7(U0,null,void 0,{isServer:!0}),u=await U7(P,A0);if(u.redirect){let t=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=cL(String(t),M),P0=pL(M,Y);await V0.promises.mkdir(G0.dirname(P0),{recursive:!0}),await Bun.write(P0,R0),G.successCount++,G.pages.push({route:M,outputPath:P0,size:Buffer.byteLength(R0),cached:!1}),L.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${t}`);return}if(u.abort){let t=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${t}`);return}}let x=S.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
15249
+ </rss>`}async function hL($={}){let X=Date.now(),Z=await t0(),J=await Nq({explicit:$.domain,stxConfig:Z});if(J.source==="fallback"&&($.sitemap??!0))console.warn(Tq());let Y={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:J.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||_1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&F0.existsSync(Y.outputDir))await F0.promises.rm(Y.outputDir,{recursive:!0});await F0.promises.mkdir(Y.outputDir,{recursive:!0});let z=new Mq(Y.cacheDir);if(Y.cache)await z.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (d$(),NY));await R('<div class="bg-black"></div>')}catch{}w7();let U=Z?.routeMiddleware?.dir||"middleware";await W7(process.cwd(),U);let B=q7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];Aq(Z?.layoutsDir,_1(process.cwd()));let _=_7(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let R of _){let N=await yL(R);for(let T of N)H.push({route:R,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??Y.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let R=0;R<H.length;R+=Y.concurrency)O.push(H.slice(R,R+Y.concurrency));for(let R of O)await Promise.all(R.map(async(N)=>{let{route:T,url:M,params:k,props:y,revalidate:I}=N;try{await Y.hooks.onPageStart?.(M);let S=await Bun.file(T.filePath).text(),b=lL(S),C=b?.middleware?Array.isArray(b.middleware)?b.middleware:[b.middleware]:[],P=[...j,...C];if(P.length>0){let U0=K7(M,k,b||{}),A0=z7(U0,null,void 0,{isServer:!0}),u=await U7(P,A0);if(u.redirect){let t=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=cL(String(t),M),P0=pL(M,Y);await F0.promises.mkdir(G0.dirname(P0),{recursive:!0}),await Bun.write(P0,R0),G.successCount++,G.pages.push({route:M,outputPath:P0,size:Buffer.byteLength(R0),cached:!1}),L.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${t}`);return}if(u.abort){let t=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${t}`);return}}let x=S.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
15171
15250
  const validate = ${x[1]};
15172
15251
  return validate(route);
15173
- `)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(Y.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await Iq(T,k,y,Y,Z);if(f=U0.html,Y.cache)z.set(M,T.filePath,U0.dependencies,f)}let $0;if(Y.trailingSlash)$0=G0.join(Y.outputDir,M,"index.html");else $0=M==="/"?G0.join(Y.outputDir,"index.html"):G0.join(Y.outputDir,`${M}.html`);if(Y.chunkIslands){let{html:U0,chunks:A0}=Fq(f,{integrity:Y.integrityIslands,minify:Y.minify});if(A0.length>0){let u=G0.join(Y.outputDir,"_stx","islands");await V0.promises.mkdir(u,{recursive:!0});for(let t of A0){let R0=G0.join(u,`${t.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,t.code);if(!Q.has(t.hash)){Q.add(t.hash);let P0=Buffer.byteLength(t.code,"utf8");w+=P0,q[t.hash]={bytes:P0,file:`/_stx/islands/${t.hash}.js`}}}if(W[M]=A0.map((t)=>t.hash),f=U0,Y.prefetchIslands)f=Vq(f)}}if(await V0.promises.mkdir(G0.dirname($0),{recursive:!0}),await Bun.write($0,f),!xL(M,f,b,Y.sitemapExclude))L.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let C0={route:M,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:l};if(I!==!1)C0.revalidateAt=Date.now()+I*1000;G.pages.push(C0),G.successCount++,await Y.hooks.onPageEnd?.(M,f)}catch(S){G.failedCount++,G.errors.push({route:M,error:S}),await Y.hooks.onError?.(S,M),console.error(`Error generating ${M}:`,S)}}));if(Y.cache)await z.save();if(Y.generate404){let R=G0.join(Y.pagesDir,"404.stx");if(await Bun.file(R).exists()){let N=new Set,T={...Z,debug:!1,cache:!1},M=await O0(await Bun.file(R).text(),{},R,T,N);await Bun.write(G0.join(Y.outputDir,"404.html"),M)}else await Bun.write(G0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
15252
+ `)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(Y.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await Iq(T,k,y,Y,Z);if(f=U0.html,Y.cache)z.set(M,T.filePath,U0.dependencies,f)}let $0;if(Y.trailingSlash)$0=G0.join(Y.outputDir,M,"index.html");else $0=M==="/"?G0.join(Y.outputDir,"index.html"):G0.join(Y.outputDir,`${M}.html`);if(Y.chunkIslands){let{html:U0,chunks:A0}=Fq(f,{integrity:Y.integrityIslands,minify:Y.minify});if(A0.length>0){let u=G0.join(Y.outputDir,"_stx","islands");await F0.promises.mkdir(u,{recursive:!0});for(let t of A0){let R0=G0.join(u,`${t.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,t.code);if(!Q.has(t.hash)){Q.add(t.hash);let P0=Buffer.byteLength(t.code,"utf8");w+=P0,q[t.hash]={bytes:P0,file:`/_stx/islands/${t.hash}.js`}}}if(W[M]=A0.map((t)=>t.hash),f=U0,Y.prefetchIslands)f=Vq(f)}}if(await F0.promises.mkdir(G0.dirname($0),{recursive:!0}),await Bun.write($0,f),!xL(M,f,b,Y.sitemapExclude))L.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let C0={route:M,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:l};if(I!==!1)C0.revalidateAt=Date.now()+I*1000;G.pages.push(C0),G.successCount++,await Y.hooks.onPageEnd?.(M,f)}catch(S){G.failedCount++,G.errors.push({route:M,error:S}),await Y.hooks.onError?.(S,M),console.error(`Error generating ${M}:`,S)}}));if(Y.cache)await z.save();if(Y.generate404){let R=G0.join(Y.pagesDir,"404.stx");if(await Bun.file(R).exists()){let N=new Set,T={...Z,debug:!1,cache:!1},M=await O0(await Bun.file(R).text(),{},R,T,N);await Bun.write(G0.join(Y.outputDir,"404.html"),M)}else await Bun.write(G0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
15174
15253
  <html lang="en">
15175
15254
  <head>
15176
15255
  <meta charset="UTF-8">
@@ -15191,7 +15270,7 @@ ${Z.join(`
15191
15270
  <a href="/">Go home</a>
15192
15271
  </div>
15193
15272
  </body>
15194
- </html>`)}for(let R of[500]){let N=G0.join(Y.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(Y.outputDir,`${R}.html`),k)}}let F=G0.join(Y.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(Y.outputDir,"error.html"),T)}if(Y.sitemap&&L.length>0){let R=fL(L,Y.domain),N=G0.join(Y.outputDir,"sitemap.xml");await Bun.write(N,R),G.sitemapPath=N,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(Y.robots!==!1){let R=typeof Y.robots==="object"?Y.robots:{},N=[...Y.sitemapExclude.filter((M)=>typeof M==="string"),...R.disallow||[]],T=WY({rules:[{userAgent:R.userAgent||"*",allow:R.allow||["/"],...N.length>0?{disallow:N}:{}}],...R.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",Y.domain).href}:{}});await Bun.write(G0.join(Y.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(Y.rss){let R=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},N=[];if(R.getItems)N=await R.getItems();let T=gL(R,N),M=G0.join(Y.outputDir,"rss.xml");await Bun.write(M,T),G.rssPath=M,console.log(`Generated rss.xml with ${N.length} items`)}let V=q2(Y.outputDir);if(V.assets>0)console.log(`Externalized ${V.assets} asset(s) from ${V.pages} page(s) (${(V.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(Y.publicDir&&V0.existsSync(Y.publicDir))await Z2(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`);let A=Q2();if(A)await Z2(A,G0.join(Y.outputDir,G2)),console.log(`Copied assets from ${O9}`)}catch(z){throw await Y.hooks.onError?.(z),z}if(G.buildTime=Date.now()-X,Q.size>0){G.islandChunks={count:Q.size,totalBytes:w};let z={generatedChunks:Q.size,totalBytes:w,chunks:q,pages:W};await Bun.write(G0.join(Y.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await Y.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
15273
+ </html>`)}for(let R of[500]){let N=G0.join(Y.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(Y.outputDir,`${R}.html`),k)}}let F=G0.join(Y.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(Y.outputDir,"error.html"),T)}if(Y.sitemap&&L.length>0){let R=fL(L,Y.domain),N=G0.join(Y.outputDir,"sitemap.xml");await Bun.write(N,R),G.sitemapPath=N,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(Y.robots!==!1){let R=typeof Y.robots==="object"?Y.robots:{},N=[...Y.sitemapExclude.filter((M)=>typeof M==="string"),...R.disallow||[]],T=WY({rules:[{userAgent:R.userAgent||"*",allow:R.allow||["/"],...N.length>0?{disallow:N}:{}}],...R.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",Y.domain).href}:{}});await Bun.write(G0.join(Y.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(Y.rss){let R=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},N=[];if(R.getItems)N=await R.getItems();let T=gL(R,N),M=G0.join(Y.outputDir,"rss.xml");await Bun.write(M,T),G.rssPath=M,console.log(`Generated rss.xml with ${N.length} items`)}let V=q2(Y.outputDir);if(V.assets>0)console.log(`Externalized ${V.assets} asset(s) from ${V.pages} page(s) (${(V.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(Y.publicDir&&F0.existsSync(Y.publicDir))await Z2(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`);let A=Q2();if(A)await Z2(A,G0.join(Y.outputDir,G2)),console.log(`Copied assets from ${O9}`)}catch(z){throw await Y.hooks.onError?.(z),z}if(G.buildTime=Date.now()-X,Q.size>0){G.islandChunks={count:Q.size,totalBytes:w};let z={generatedChunks:Q.size,totalBytes:w,chunks:q,pages:W};await Bun.write(G0.join(Y.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await Y.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
15195
15274
  Island chunks: ${G.islandChunks.count} (${(G.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
15196
15275
  Build complete!
15197
15276
  Total: ${G.totalPages} pages
@@ -15199,7 +15278,7 @@ Build complete!
15199
15278
  Cached: ${G.cachedCount}
15200
15279
  Failed: ${G.failedCount}
15201
15280
  Time: ${G.buildTime}ms${K}
15202
- `),G}async function Z2($,X){let Z=await V0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=G0.join($,J.name),G=G0.join(X,J.name);if(J.isDirectory())await V0.promises.mkdir(G,{recursive:!0}),await Z2(Y,G);else await V0.promises.copyFile(Y,G)}}function uL($={}){let X=$.cacheDir||B1(process.cwd(),"ssg-cache"),Z=new kq(X),J=$.revalidate||3600;return{async get(Y){let G=await Z.get(Y);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(Y).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(Y){let Q=_7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Y.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${Y}`);return}let w=Y.match(Q.regex),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await t0(),{html:K}=await Iq(Q,q,{},$,W);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:vL(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function dL($){return async()=>{return{paths:await $(),fallback:!1}}}function mL(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),J={},Y=X;if(Z){let W=Z[1];Y=X.slice(Z[0].length).trim();for(let K of W.split(`
15281
+ `),G}async function Z2($,X){await F0.promises.mkdir(X,{recursive:!0});let Z=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=G0.join($,J.name),G=G0.join(X,J.name);if(J.isDirectory())await F0.promises.mkdir(G,{recursive:!0}),await Z2(Y,G);else await F0.promises.copyFile(Y,G)}}function uL($={}){let X=$.cacheDir||_1(process.cwd(),"ssg-cache"),Z=new kq(X),J=$.revalidate||3600;return{async get(Y){let G=await Z.get(Y);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(Y).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(Y){let Q=_7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Y.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${Y}`);return}let w=Y.match(Q.regex),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await t0(),{html:K}=await Iq(Q,q,{},$,W);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:vL(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function dL($){return async()=>{return{paths:await $(),fallback:!1}}}function mL(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),J={},Y=X;if(Z){let W=Z[1];Y=X.slice(Z[0].length).trim();for(let K of W.split(`
15203
15282
  `)){let z=K.indexOf(":");if(z>0){let U=K.slice(0,z).trim(),B=K.slice(z+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[U]=B}}}let G=Y.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=w.exec(G))!==null){let W=parseInt(q[1],10),K=q[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:W})}return{content:G,data:J,toc:Q}}}}function lL($){return m$($)}function cL($,X){return`<!DOCTYPE html>
15204
15283
  <html>
15205
15284
  <head>
@@ -15212,4 +15291,4 @@ Build complete!
15212
15291
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
15213
15292
  <script>window.location.replace('${$}')</script>
15214
15293
  </body>
15215
- </html>`}function pL($,X){if($==="/"||$==="")return G0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return G0.join(X.outputDir,Z,"index.html");return G0.join(X.outputDir,`${Z}.html`)}var CD={generateStaticSite:hL,createISRHandler:uL,defineStaticPaths:dL,createMarkdownLoader:mL};export{xL as isExcludedFromSitemap,hL as generateStaticSite,dL as defineStaticPaths,CD as default,CL as declaresPageAction,mL as createMarkdownLoader,uL as createISRHandler};
15294
+ </html>`}function pL($,X){if($==="/"||$==="")return G0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return G0.join(X.outputDir,Z,"index.html");return G0.join(X.outputDir,`${Z}.html`)}var PD={generateStaticSite:hL,createISRHandler:uL,defineStaticPaths:dL,createMarkdownLoader:mL};export{xL as isExcludedFromSitemap,hL as generateStaticSite,dL as defineStaticPaths,PD as default,CL as declaresPageAction,mL as createMarkdownLoader,uL as createISRHandler};