@stacksjs/stx 0.2.115 → 0.2.117

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/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:X7,getOwnPropertyNames:CJ,getOwnPropertyDescriptor:vJ}=Object,xJ=Object.prototype.hasOwnProperty;function fJ($){return this[$]}var u6=($)=>{var Z=(m6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=X7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of CJ($))if(!xJ.call(Z,X))X7(Z,X,{get:fJ.bind($,X),enumerable:!(Y=vJ($,X))||Y.enumerable})}return m6.set($,Z),Z},m6;var gJ=($)=>$;function hJ($,Z){this[$]=gJ.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)X7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:hJ.bind(Z,Y)})};var y=($,Z)=>()=>($&&(Z=$($=0)),Z);var G0=import.meta.require;import q$ from"fs";import W$ from"path";function uJ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function lJ($,Z){let Y=W$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function pJ($,Z,Y){let X=W$.extname($).toLowerCase(),Q=mJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&lJ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function o6($,Z,Y,X){let Q=q$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=W$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;o6(G,Z,Y,X)}else if(J.isFile()){let K=q$.statSync(G),q=W$.relative(Z,G);if(pJ(q,K.size,Y)){let W=q$.readFileSync(G),U=uJ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function R1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!q$.existsSync($))return{entries:[],totalSize:0,fileCount:0};o6($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function U$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:X7,getOwnPropertyNames:vJ,getOwnPropertyDescriptor:xJ}=Object,fJ=Object.prototype.hasOwnProperty;function gJ($){return this[$]}var u6=($)=>{var Z=(m6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=X7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of vJ($))if(!fJ.call(Z,X))X7(Z,X,{get:gJ.bind($,X),enumerable:!(Y=xJ($,X))||Y.enumerable})}return m6.set($,Z),Z},m6;var hJ=($)=>$;function dJ($,Z){this[$]=hJ.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)X7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:dJ.bind(Z,Y)})};var y=($,Z)=>()=>($&&(Z=$($=0)),Z);var G0=import.meta.require;import q$ from"fs";import W$ from"path";function lJ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function pJ($,Z){let Y=W$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function cJ($,Z,Y){let X=W$.extname($).toLowerCase(),Q=uJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&pJ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function o6($,Z,Y,X){let Q=q$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=W$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;o6(G,Z,Y,X)}else if(J.isFile()){let K=q$.statSync(G),q=W$.relative(Z,G);if(cJ(q,K.size,Y)){let W=q$.readFileSync(G),U=lJ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function R1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!q$.existsSync($))return{entries:[],totalSize:0,fileCount:0};o6($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function U$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function s6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var mJ;var V5=y(()=>{mJ={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function cJ($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function J7($){return cJ($).className}function r6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=J7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function s6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var uJ;var V5=y(()=>{uJ={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function iJ($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function J7($){return iJ($).className}function r6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=J7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${W},
7
7
  ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(J.strategy==="network-first"||J.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=iJ(J.pattern);Q.push(`
11
+ })`);let q=nJ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||oJ(J.pattern)}',
16
+ cacheName: '${J.cacheName||sJ(J.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return Q.join(`
23
- `)}function iJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${nJ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${sJ($).replace(/\\\*/g,".*")}')`}function nJ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function oJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function sJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var $9={};o($9,{isWorkboxEnabled:()=>e6,getServiceWorkerGenerator:()=>$Q,generateWorkboxServiceWorker:()=>t6,generateWorkboxConfig:()=>a6});function a6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(J7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?R1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function t6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=a6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?R1(Z,$):null,q=K?U$(K):"[]",W=rJ(X.modules),U=r6($);return`/**
23
+ `)}function nJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${oJ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${rJ($).replace(/\\\*/g,".*")}')`}function oJ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function sJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function rJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var $9={};o($9,{isWorkboxEnabled:()=>e6,getServiceWorkerGenerator:()=>ZQ,generateWorkboxServiceWorker:()=>t6,generateWorkboxConfig:()=>a6});function a6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(J7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?R1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function t6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=a6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?R1(Z,$):null,q=K?U$(K):"[]",W=aJ(X.modules),U=r6($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?tJ(J):"// Push notifications disabled"}
172
+ ${J?.enabled?eJ(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?eJ(G):"// Background sync disabled"}
174
+ ${G?.enabled?$Q(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function rJ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${aJ(X)};`)}return Z.join(`
178
- `)}function aJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function tJ($){return`
177
+ `}function aJ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${tJ(X)};`)}return Z.join(`
178
+ `)}function tJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function eJ($){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
244
244
  })
245
245
  );
246
246
  });
247
- `}function eJ($){return`
247
+ `}function $Q($){return`
248
248
  // ============================================================================
249
249
  // Background Sync
250
250
  // ============================================================================
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function e6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function $Q($){if(e6($))return t6;let{generateServiceWorker:Z}=(w5(),u6(Y9));return Z}var Z9=y(()=>{V5()});var Y9={};o(Y9,{isWorkboxEnabled:()=>X9,getServiceWorkerFileName:()=>p1,generateServiceWorkerAuto:()=>XQ,generateServiceWorker:()=>z$});function z$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?R1(Z,$):null,B=z?U$(z):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function e6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function ZQ($){if(e6($))return t6;let{generateServiceWorker:Z}=(w5(),u6(Y9));return Z}var Z9=y(()=>{V5()});var Y9={};o(Y9,{isWorkboxEnabled:()=>X9,getServiceWorkerFileName:()=>p1,generateServiceWorkerAuto:()=>JQ,generateServiceWorker:()=>z$});function z$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?R1(Z,$):null,B=z?U$(z):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?ZQ():"// Push notifications disabled"}
504
+ ${q?.enabled?YQ():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?YQ():"// Background sync disabled"}
506
+ ${W?.enabled?XQ():"// Background sync disabled"}
507
507
 
508
508
  /**
509
509
  * Check if a route should be excluded from caching
@@ -868,7 +868,7 @@ async function purgeByEntryCount(entries, cache, maxEntries) {
868
868
  }
869
869
 
870
870
  console.log('[SW] Service Worker loaded - Version:', CACHE_VERSION);
871
- `}function ZQ(){return`
871
+ `}function YQ(){return`
872
872
  /**
873
873
  * Push event - handle incoming push notifications
874
874
  */
@@ -950,7 +950,7 @@ self.addEventListener('notificationclose', (event) => {
950
950
  // Could send analytics here
951
951
  }
952
952
  });
953
- `}function YQ(){return`
953
+ `}function XQ(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,7 +1132,7 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function p1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function X9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function XQ($,Z){if(!$.pwa?.enabled)return"";if(X9($)){let{generateWorkboxServiceWorker:Y}=(Z9(),u6($9));return Y($,Z)}return z$($,Z)}var w5=y(()=>{V5()});var J9={};o(J9,{injectPwaTags:()=>G7,generateThemeColorMeta:()=>GQ,generateSwRegistrationScript:()=>JQ,generatePwaTags:()=>B$,generateManifestLink:()=>QQ});function B$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=p1($),J=`
1135
+ `}function p1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function X9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function JQ($,Z){if(!$.pwa?.enabled)return"";if(X9($)){let{generateWorkboxServiceWorker:Y}=(Z9(),u6($9));return Y($,Z)}return z$($,Z)}var w5=y(()=>{V5()});var J9={};o(J9,{injectPwaTags:()=>G7,generateThemeColorMeta:()=>KQ,generateSwRegistrationScript:()=>QQ,generatePwaTags:()=>B$,generateManifestLink:()=>GQ});function B$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=p1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${Q7(Y?.themeColor||"#000000")}">
@@ -1178,7 +1178,7 @@ if ('serviceWorker' in navigator) {
1178
1178
  </script>
1179
1179
  <!-- End stx PWA -->`,J}function G7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=B$(Z);return $.slice(0,Q)+J+`
1180
1180
  `+$.slice(Q)}return $+B$(Z)}let X=B$(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function JQ($){if(!$.pwa?.enabled)return"";return`<script>
1181
+ </head>`)}function QQ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
1184
  navigator.serviceWorker.register('/${p1($)}')
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function QQ(){return'<link rel="manifest" href="/manifest.json">'}function GQ($){return`<meta name="theme-color" content="${Q7($)}">`}function Q7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var j$=y(()=>{w5()});import R5 from"path";function K9($){G9=$?.trim()||null}function A5(){return process.env[jQ]?.trim()||G9||c1}function N5($=process.cwd(),...Z){let Y=A5();return R5.isAbsolute(Y)?R5.join(Y,...Z):R5.join($,Y,...Z)}function T5($){if(!$||R5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==c1&&!Z.startsWith(`${c1}/`))return $;let Y=Z.slice(c1.length+1);return Y?R5.join(A5(),Y):A5()}var c1=".stx",jQ="STX_DIR",G9=null;var _$=()=>{};var _0;var q9=y(()=>{_0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function W9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var U9,z9;var K7=y(()=>{U9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},z9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function _Q($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...X1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1193
+ </script>`}function GQ(){return'<link rel="manifest" href="/manifest.json">'}function KQ($){return`<meta name="theme-color" content="${Q7($)}">`}function Q7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var j$=y(()=>{w5()});import R5 from"path";function K9($){G9=$?.trim()||null}function A5(){return process.env[_Q]?.trim()||G9||c1}function N5($=process.cwd(),...Z){let Y=A5();return R5.isAbsolute(Y)?R5.join(Y,...Z):R5.join($,Y,...Z)}function T5($){if(!$||R5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==c1&&!Z.startsWith(`${c1}/`))return $;let Y=Z.slice(c1.length+1);return Y?R5.join(A5(),Y):A5()}var c1=".stx",_Q="STX_DIR",G9=null;var _$=()=>{};var _0;var q9=y(()=>{_0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function W9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var U9,z9;var K7=y(()=>{U9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},z9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function HQ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...J1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1194
1194
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1195
1195
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1196
1196
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1200,7 +1200,7 @@ if ('serviceWorker' in navigator) {
1200
1200
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1201
1201
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1202
1202
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1203
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function HQ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function OQ(){return`
1204
1204
  <script data-stx-scoped>
1205
1205
  // Motion preferences handling
1206
1206
  (function() {
@@ -1228,7 +1228,7 @@ else {
1228
1228
  });
1229
1229
  })();
1230
1230
  </script>
1231
- `}function OQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function LQ($=0.1,Z="0px"){return`
1231
+ `}function LQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function FQ($=0.1,Z="0px"){return`
1232
1232
  <script data-stx-scoped>
1233
1233
  // Intersection Observer for scroll animations
1234
1234
  (function() {
@@ -1271,7 +1271,7 @@ else {
1271
1271
  }
1272
1272
  })();
1273
1273
  </script>
1274
- `}function FQ(){return`
1274
+ `}function VQ(){return`
1275
1275
  <style id="stx-animation-base">
1276
1276
  :root {
1277
1277
  --stx-transition-duration: 300ms;
@@ -1386,7 +1386,7 @@ else {
1386
1386
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1387
1387
  }
1388
1388
  </style>
1389
- `}function VQ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function wQ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1390
1390
  <script data-stx-scoped>
1391
1391
  // Animation Group: ${$}
1392
1392
  (function() {
@@ -1423,11 +1423,11 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function O9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!OQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=FQ();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=LQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var X1,B9,j9,_9,H9;var q7=y(()=>{X1={duration:300,delay:0,ease:"ease",direction:"both"};B9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||X1.duration:X1.duration,G=Z.length>2?Z[2]||X1.ease:X1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||X1.delay:X1.delay,q=Z.length>4?Z[4]||X1.direction:X1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=_Q(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},j9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=VQ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},H9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=HQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as L9}from"stx-router";var F9=y(()=>{W7()});async function wQ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=L9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var V9;var W7=y(()=>{F9();V9={name:"stxRouter",handler:wQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function w9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...RQ,...Z};return`
1426
+ `}function O9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!LQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=VQ();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=FQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
+ `+Q.slice(W)}}return Q}var J1,B9,j9,_9,H9;var q7=y(()=>{J1={duration:300,delay:0,ease:"ease",direction:"both"};B9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||J1.duration:J1.duration,G=Z.length>2?Z[2]||J1.ease:J1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||J1.delay:J1.delay,q=Z.length>4?Z[4]||J1.direction:J1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=HQ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},j9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=wQ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},H9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=OQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as L9}from"stx-router";var F9=y(()=>{W7()});async function RQ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=L9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var V9;var W7=y(()=>{F9();V9={name:"stxRouter",handler:RQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function w9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...AQ,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,7 +1810,7 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function R9($,Z){let Y=w9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function AQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var RQ,A9;var U7=y(()=>{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};A9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=AQ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return w9(Q)}}});function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function T9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1813
+ `}function R9($,Z){let Y=w9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function NQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var AQ,A9;var U7=y(()=>{AQ={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};A9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=NQ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return w9(Q)}}});function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function T9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1814
1814
  `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),U=K.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}J[W]=U}return{data:J,content:Q.trim()}}function M5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,B)=>{let j=J.length,_=z?` class="language-${K1(z)}"`:"";return J.push(`<pre><code${_}>${K1(B.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${K1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,B)=>{return`<img src="${N9(B)?K1(B):""}" alt="${K1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,B)=>{return`<a href="${N9(B)?K1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
1815
  `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,B)=>{let _=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${K1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1816
1816
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${K1(O)}</td>`).join("")}</tr>`}).join(`
@@ -1828,10 +1828,10 @@ ${H}
1828
1828
  `:`
1829
1829
  `)}</p>`);if(Q=K.join(`
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
- `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function u0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1831
+ `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function m0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import NQ from"process";function f0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(NQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var A1=()=>{};var I5={};o(I5,{hasUserImports:()=>MQ,bundleClientScript:()=>EQ});import H0 from"path";import y0 from"fs";function MQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!M9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!M9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function IQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(y0.existsSync(U)&&y0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(y0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(y0.existsSync(W)&&y0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function EQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||N5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${TQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let R=Bun.file(W),A=!0;if(await R.exists())try{let N=JSON.parse(await R.text());for(let T of N.files)try{if(y0.statSync(T.path).mtimeMs!==T.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=N5(X,"bundle-tmp"),B=H0.join(z,`${K}.ts`),j=H0.join(z,"out",K);y0.mkdirSync(z,{recursive:!0}),y0.mkdirSync(j,{recursive:!0});let _=H0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((R)=>{let A=R.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
- export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",H0.basename(Z));let w=new Set;try{let R=await Bun.build({entrypoints:[B],outdir:j,target:"browser",format:"esm",minify:Q,plugins:[IQ(X,_,B,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...f0()},root:X});if(!R.success){let D=R.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let A="";for(let D of R.outputs){A=await D.text();break}let N=[];for(let D of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let b of D[1].split(",")){let P=b.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){N.push([P[2],P[1]]);continue}let f=b.trim();if(/^[A-Za-z_$][\w$]*$/.test(f))N.push([f,f])}let T=A.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];A=A.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${K}`,I=N.map(([D,b])=>`${JSON.stringify(D)}: ${b}`).join(", "),k=N.map(([D])=>`var ${D} = undefined;`).join(`
1833
+ `}),$}import TQ from"process";function f0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(TQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var A1=()=>{};var I5={};o(I5,{hasUserImports:()=>IQ,bundleClientScript:()=>DQ});import H0 from"path";import y0 from"fs";function IQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!M9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!M9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function EQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(y0.existsSync(U)&&y0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(y0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(y0.existsSync(W)&&y0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function DQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||N5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${MQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let R=Bun.file(W),A=!0;if(await R.exists())try{let N=JSON.parse(await R.text());for(let T of N.files)try{if(y0.statSync(T.path).mtimeMs!==T.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=N5(X,"bundle-tmp"),B=H0.join(z,`${K}.ts`),j=H0.join(z,"out",K);y0.mkdirSync(z,{recursive:!0}),y0.mkdirSync(j,{recursive:!0});let _=H0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((R)=>{let A=R.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
+ export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",H0.basename(Z));let w=new Set;try{let R=await Bun.build({entrypoints:[B],outdir:j,target:"browser",format:"esm",minify:Q,plugins:[EQ(X,_,B,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...f0()},root:X});if(!R.success){let D=R.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let A="";for(let D of R.outputs){A=await D.text();break}let N=[];for(let D of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let b of D[1].split(",")){let P=b.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){N.push([P[2],P[1]]);continue}let f=b.trim();if(/^[A-Za-z_$][\w$]*$/.test(f))N.push([f,f])}let T=A.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];A=A.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${K}`,I=N.map(([D,b])=>`${JSON.stringify(D)}: ${b}`).join(", "),k=N.map(([D])=>`var ${D} = undefined;`).join(`
1835
1835
  `),E=N.map(([D])=>`${D} = ${M}[${JSON.stringify(D)}];`).join(`
1836
1836
  `);A=`${T.join(`
1837
1837
  `)}
@@ -1842,16 +1842,16 @@ return { ${I} };
1842
1842
  })();
1843
1843
  ${E}`.trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),y0.mkdirSync(J,{recursive:!0}),await Bun.write(q,A);let C=Array.from(w).map((D)=>{try{return{path:D,mtimeMs:y0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({files:C})),A}catch(R){let A=R instanceof Error?R.message:String(R),N=R?.errors,T=Array.isArray(N)&&N.length>0?`
1844
1844
  ${N.map((M)=>`- ${M?.message??M}`).join(`
1845
- `)}`:"";return console.warn(`[stx:bundler] error: ${A}${T}`),$}finally{try{y0.rmSync(B,{force:!0}),y0.rmSync(j,{recursive:!0,force:!0})}catch{}}}var TQ=4,M9;var E5=y(()=>{A1();_$();M9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var k9={};o(k9,{renderVendorStyleTags:()=>O$,processClientScript:()=>b5,generateServerDataBridge:()=>L$,generateAutoImportDestructuring:()=>D9,extractBridgeData:()=>k5,extractAndStripCssImports:()=>H$});import N1 from"path";import D5 from"fs";function kQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function bQ($,Z){let Y=Z;while(!0){let X=N1.join(Y,"node_modules",$,"package.json");if(D5.existsSync(X))return N1.dirname(X);let Q=N1.dirname(Y);if(Q===Y)return null;Y=Q}}function SQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function yQ($,Z){let Y=kQ($);if(!Y||!Y.subpath)return null;let X=bQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(D5.readFileSync(N1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=SQ(Q.exports,J);if(!G)return null;let K=N1.resolve(X,G);return D5.existsSync(K)?K:null}function H$($,Z){let Y=Z.filePath?N1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(DQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:N1.resolve(Y,q),!D5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=yQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=D5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function PQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${PQ(Z.source)}" data-stx-layer="vendor">
1845
+ `)}`:"";return console.warn(`[stx:bundler] error: ${A}${T}`),$}finally{try{y0.rmSync(B,{force:!0}),y0.rmSync(j,{recursive:!0,force:!0})}catch{}}}var MQ=4,M9;var E5=y(()=>{A1();_$();M9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var k9={};o(k9,{renderVendorStyleTags:()=>O$,processClientScript:()=>b5,generateServerDataBridge:()=>L$,generateAutoImportDestructuring:()=>D9,extractBridgeData:()=>k5,extractAndStripCssImports:()=>H$});import N1 from"path";import D5 from"fs";function bQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function SQ($,Z){let Y=Z;while(!0){let X=N1.join(Y,"node_modules",$,"package.json");if(D5.existsSync(X))return N1.dirname(X);let Q=N1.dirname(Y);if(Q===Y)return null;Y=Q}}function yQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function PQ($,Z){let Y=bQ($);if(!Y||!Y.subpath)return null;let X=SQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(D5.readFileSync(N1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=yQ(Q.exports,J);if(!G)return null;let K=N1.resolve(X,G);return D5.existsSync(K)?K:null}function H$($,Z){let Y=Z.filePath?N1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(kQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:N1.resolve(Y,q),!D5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=PQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=D5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function CQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${CQ(Z.source)}" data-stx-layer="vendor">
1846
1846
  @layer vendor {
1847
1847
  ${Z.contents}
1848
1848
  }
1849
1849
  </style>`}).join(`
1850
1850
  `)}
1851
- `}function fQ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!xQ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function gQ($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx"||W==="@stacksjs/stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of CQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of vQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=fQ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function D9($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1851
+ `}function gQ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!fQ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function hQ($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx"||W==="@stacksjs/stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of vQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of xQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=gQ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function D9($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1852
1852
  ${Y.join(`
1853
1853
  `)}
1854
- ${hQ($,Z)}`;return""}function hQ($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1854
+ ${dQ($,Z)}`;return""}function dQ($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1855
1855
  [${Y.join(", ")}].forEach(function (e) {
1856
1856
  if (e[1] !== 'undefined') return;
1857
1857
  console.error(
@@ -1860,10 +1860,10 @@ ${hQ($,Z)}`;return""}function hQ($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}
1860
1860
  + 'or it should be imported from a relative path so the bundler includes it.'
1861
1861
  );
1862
1862
  });
1863
- `}function k5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function I9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function dQ($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(I9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(I9(Y[1],!1).has(Z))return!0;return!1}function L$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(dQ($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1863
+ `}function k5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function I9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function mQ($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(I9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(I9(Y[1],!1).has(Z))return!0;return!1}function L$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(mQ($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1864
1864
  ${Y.join(`
1865
1865
  `)}
1866
- `}function uQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=mQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function lQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=uQ(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
1866
+ `}function lQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=uQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function pQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=lQ(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
1867
1867
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
1868
1868
  };`;function B(j){if(/\$emit\s*\(/.test(j))return`${z}
1869
1869
  ${j}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -1906,11 +1906,11 @@ else {
1906
1906
  else {
1907
1907
  ${Q}
1908
1908
  }
1909
- }${q})`}function pQ($){if($.length===0)return"";return`
1909
+ }${q})`}function cQ($){if($.length===0)return"";return`
1910
1910
  // STX: auto-generated event bindings
1911
- ${$.map((Y,X)=>lQ(Y,X)).join(`
1911
+ ${$.map((Y,X)=>pQ(Y,X)).join(`
1912
1912
  `)}`}function E9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1913
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let j=B.trim(),_=j.indexOf(":"),H=_>=0?j.slice(_+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function iQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let j;while((j=Y.exec(B))!==null){let _=j[0];if(!cQ.has(_))Z.add(_)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function b5($,Z={}){let Y=$,X="",Q=!1,J=H$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=O$(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),I5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=gQ(Y);Y=L.code,X=D9(L.stxImports,L.browserImports)}if(X=`${L$(Y,Z.serverData)}${X}`,Y=u0(Y),!Q&&T1(Z.attrs||""))Y=M1(Y);let W=pQ(Z.eventBindings||[]),U=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1913
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let j=B.trim(),_=j.indexOf(":"),H=_>=0?j.slice(_+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function nQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let j;while((j=Y.exec(B))!==null){let _=j[0];if(!iQ.has(_))Z.add(_)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function b5($,Z={}){let Y=$,X="",Q=!1,J=H$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=O$(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),I5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=hQ(Y);Y=L.code,X=D9(L.stxImports,L.browserImports)}if(X=`${L$(Y,Z.serverData)}${X}`,Y=m0(Y),!Q&&T1(Z.attrs||""))Y=M1(Y);let W=cQ(Z.eventBindings||[]),U=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1914
1914
  ${X}${Y}
1915
1915
  ${W}
1916
1916
  </script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),j=/function __stx_setup_/.test(Y),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
@@ -1919,12 +1919,12 @@ window.stx.mount(function() {
1919
1919
  'use strict';
1920
1920
  ${X}${Y}
1921
1921
  ${W}${F}
1922
- })</script>`}if(!_&&!j){if(B)return H(E9($));if(Z.templateContent){let L=E9($);if(L.length>0){let F=iQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1922
+ })</script>`}if(!_&&!j){if(B)return H(E9($));if(Z.templateContent){let L=E9($);if(L.length>0){let F=nQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1923
1923
  ;(function() {
1924
1924
  'use strict';
1925
1925
  ${X}${Y}
1926
1926
  ${W}
1927
- })()</script>`}var DQ,CQ,vQ,xQ,mQ,cQ;var S5=y(()=>{O0();DQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;CQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],vQ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],xQ=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"]);mQ={left:0,middle:1,right:2};cQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function rQ($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function aQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(oQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&P9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function tQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!P9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function F$($){let Z=$.trim(),Y=rQ(Z);aQ(Y,Z),tQ(Z);for(let X of y9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!S9.allowBracketNotation&&sQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function eQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||y9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=z7(X);else Z[Y]=X}return Z}function z7($,Z=0){if(Z>=S9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>z7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=z7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=eQ(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return F$($),!0}catch{return!1}}function L0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=F$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(C9.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1927
+ })()</script>`}var kQ,vQ,xQ,fQ,uQ,iQ;var S5=y(()=>{O0();kQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;vQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],xQ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],fQ=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"]);uQ={left:0,middle:1,right:2};iQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function aQ($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function tQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(sQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&P9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function eQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!P9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function F$($){let Z=$.trim(),Y=aQ(Z);tQ(Y,Z),eQ(Z);for(let X of y9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!S9.allowBracketNotation&&rQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function $G($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||y9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=z7(X);else Z[Y]=X}return Z}function z7($,Z=0){if(Z>=S9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>z7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=z7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=$G(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return F$($),!0}catch{return!1}}function L0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=F$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(C9.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1928
1928
  'use strict';
1929
1929
  try {
1930
1930
  return ${Y};
@@ -1935,7 +1935,7 @@ catch (e) {
1935
1935
  }
1936
1936
  throw e;
1937
1937
  }
1938
- `),K=G([]);if(J.length===Z.length)return b9(K,J,G);return b9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function b9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",j=J.exec(B);if(!(z instanceof ReferenceError)||!j)return;let _=j[1];if(q.has(_)||C9.has(_))return;q.add(_),K.push(_),G=Y(K),X?.(K)}return}}function V$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var nQ,S9,y9,oQ,P9,sQ,C9;var F0=y(()=>{nQ={maxSanitizeDepth:10,allowBracketNotation:!1},S9={...nQ},y9=[/\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/],oQ=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"]),P9=new Set(["__proto__","constructor","prototype"]),sQ=/[\w)\]]\s*\[\s*['"]/;C9=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 w$($,Z){let Y=$G++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return ZG.set(X,{type:$,expression:Z}),X}var $G=0,ZG;var v9=y(()=>{ZG=new Map});function x9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function R$($,Z){return x9($,Z,YG,XG)}function A$($,Z){return x9($,Z,JG,QG)}function N$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function q1($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function y5($){let{output:Z,tokens:Y}=q1($,R$,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function B7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var YG,XG,JG,QG;var P5=y(()=>{YG=/<script\b[^>]*>/iy,XG=/<\/script\s*>/ig,JG=/<style\b[^>]*>/iy,QG=/<\/style\s*>/ig});var u9={};o(u9,{usesSignalsInScript:()=>i1,unescapeHtml:()=>j7,registerFilters:()=>KG,registerFilter:()=>h9,processExpressions:()=>W1,interpolateScriptsInTemplate:()=>WG,interpolateScriptExpressions:()=>T$,getAllFilters:()=>d9,evaluateExpression:()=>g0,escapeHtml:()=>l0,defaultFilters:()=>v5,clearCustomFilters:()=>qG,applyFilters:()=>m9});function GG($){let Z=f9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),f9.set($,Z)}return Z.lastIndex=0,Z}function h9($,Z){if($ in v5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);C5[$]=Z}function KG($){for(let[Z,Y]of Object.entries($))h9(Z,Y)}function d9(){return{...v5,...C5}}function qG(){for(let $ of Object.keys(C5))delete C5[$]}function l0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function g9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function T$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=g0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=g0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function WG($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=T$(J,Z);return`<script${Q}>${G}</script>`})}function W1($,Z,Y,X){let Q=$,J=(B,j)=>{let _=A$(B,j);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(j,_))?-1:_},G=(B,j,_,H)=>{let L=_.length,{output:F,tokens:O}=q1(B,j,(V,w)=>H(L+w));return _.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,R$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||i1($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,j,_)=>{try{let H=g0(j,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return K0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${L}`,Y,$,_,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,j,_)=>{try{let H=g0(j,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return w$("raw",j.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return w$("raw",j.trim());let L=H instanceof Error?H.message:String(H);return K0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${L}`,Y,$,_,B)}}),Q=G(Q,R$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,j,_)=>{let H=j.trim();if(z.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),R=Boolean(V&&U.has(V)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(A),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=g0(j,Z);if(R)return B;if(W&&!g9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return w$("expr",H);return M!==void 0&&M!==null?l0(String(M)):""}catch(M){if(R)return B;if(W&&!g9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return K0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,_,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function m9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=C5[G]||v5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(d9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[g0(`(${z})`,Y,!0)];else{let B=[],j="",_=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(_){if(j+=w,w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w,j+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(j),j="";continue}j+=w}if(j)B.push(j);q=B.map((V)=>{let w=V.trim();return g0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function UG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function g0($,Z,Y=!1){try{let X=$.trim(),Q=UG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=g0(J,Z,!0);return m9(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=zG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function zG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=BG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function BG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function j7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var C5,f9,v5;var r0=y(()=>{F0();O0();v9();P5();C5={},f9=new Map;v5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return l0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(GG(q),String(W))}),K},t:($,Z,Y={})=>{return v5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function n1($="const",Z=[]){let Y=Z.length?M$.filter((X)=>!Z.includes(X)):M$;return`${$} { ${Y.join(", ")} } = window.stx;`}var M$,l9;var x5=y(()=>{M$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],l9=["onMount","onDestroy"]});class f5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function s1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!o1.has(Y)){if(o1.size>=jG){let X=o1.keys().next().value;if(X)o1.delete(X)}o1.set(Y,new RegExp($,Z))}return o1.get(Y)}class p9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1938
+ `),K=G([]);if(J.length===Z.length)return b9(K,J,G);return b9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function b9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",j=J.exec(B);if(!(z instanceof ReferenceError)||!j)return;let _=j[1];if(q.has(_)||C9.has(_))return;q.add(_),K.push(_),G=Y(K),X?.(K)}return}}function V$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var oQ,S9,y9,sQ,P9,rQ,C9;var F0=y(()=>{oQ={maxSanitizeDepth:10,allowBracketNotation:!1},S9={...oQ},y9=[/\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/],sQ=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"]),P9=new Set(["__proto__","constructor","prototype"]),rQ=/[\w)\]]\s*\[\s*['"]/;C9=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 w$($,Z){let Y=ZG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return YG.set(X,{type:$,expression:Z}),X}var ZG=0,YG;var v9=y(()=>{YG=new Map});function x9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function R$($,Z){return x9($,Z,XG,JG)}function A$($,Z){return x9($,Z,QG,GG)}function N$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function q1($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function y5($){let{output:Z,tokens:Y}=q1($,R$,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function B7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var XG,JG,QG,GG;var P5=y(()=>{XG=/<script\b[^>]*>/iy,JG=/<\/script\s*>/ig,QG=/<style\b[^>]*>/iy,GG=/<\/style\s*>/ig});var u9={};o(u9,{usesSignalsInScript:()=>i1,unescapeHtml:()=>j7,registerFilters:()=>qG,registerFilter:()=>h9,processExpressions:()=>W1,interpolateScriptsInTemplate:()=>UG,interpolateScriptExpressions:()=>T$,getAllFilters:()=>d9,evaluateExpression:()=>g0,escapeHtml:()=>u0,defaultFilters:()=>v5,clearCustomFilters:()=>WG,applyFilters:()=>m9});function KG($){let Z=f9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),f9.set($,Z)}return Z.lastIndex=0,Z}function h9($,Z){if($ in v5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);C5[$]=Z}function qG($){for(let[Z,Y]of Object.entries($))h9(Z,Y)}function d9(){return{...v5,...C5}}function WG(){for(let $ of Object.keys(C5))delete C5[$]}function u0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function g9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function T$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=g0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=g0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function UG($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=T$(J,Z);return`<script${Q}>${G}</script>`})}function W1($,Z,Y,X){let Q=$,J=(B,j)=>{let _=A$(B,j);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(j,_))?-1:_},G=(B,j,_,H)=>{let L=_.length,{output:F,tokens:O}=q1(B,j,(V,w)=>H(L+w));return _.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,R$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||i1($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,j,_)=>{try{let H=g0(j,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return K0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${L}`,Y,$,_,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,j,_)=>{try{let H=g0(j,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return w$("raw",j.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return w$("raw",j.trim());let L=H instanceof Error?H.message:String(H);return K0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${L}`,Y,$,_,B)}}),Q=G(Q,R$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,j,_)=>{let H=j.trim();if(z.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),R=Boolean(V&&U.has(V)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(A),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=g0(j,Z);if(R)return B;if(W&&!g9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return w$("expr",H);return M!==void 0&&M!==null?u0(String(M)):""}catch(M){if(R)return B;if(W&&!g9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return K0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,_,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function m9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=C5[G]||v5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(d9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[g0(`(${z})`,Y,!0)];else{let B=[],j="",_=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(_){if(j+=w,w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w,j+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(j),j="";continue}j+=w}if(j)B.push(j);q=B.map((V)=>{let w=V.trim();return g0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function zG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function g0($,Z,Y=!1){try{let X=$.trim(),Q=zG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=g0(J,Z,!0);return m9(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=BG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function BG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=jG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function jG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function j7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var C5,f9,v5;var r0=y(()=>{F0();O0();v9();P5();C5={},f9=new Map;v5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return u0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(KG(q),String(W))}),K},t:($,Z,Y={})=>{return v5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function n1($="const",Z=[]){let Y=Z.length?M$.filter((X)=>!Z.includes(X)):M$;return`${$} { ${Y.join(", ")} } = window.stx;`}var M$,l9;var x5=y(()=>{M$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],l9=["onMount","onDestroy"]});class f5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function s1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!o1.has(Y)){if(o1.size>=_G){let X=o1.keys().next().value;if(X)o1.delete(X)}o1.set(Y,new RegExp($,Z))}return o1.get(Y)}class p9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1939
1939
  'use strict';
1940
1940
  try {
1941
1941
  return ${q};
@@ -1946,33 +1946,33 @@ catch (e) {
1946
1946
  }
1947
1947
  throw e;
1948
1948
  }
1949
- `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class c9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function _G(){if(!_7)_7=new c9;return _7}var o1,jG=500,h_,_7=null,i9;var r1=y(()=>{o1=new Map;h_=new p9;i9=new Proxy({},{get($,Z){return _G()[Z]}})});function n9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function o9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=H7($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],j=`${Z}_${B}`;W.set(B,j)}}for(let U of K){let z=s9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1949
+ `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class c9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function HG(){if(!_7)_7=new c9;return _7}var o1,_G=500,h_,_7=null,i9;var r1=y(()=>{o1=new Map;h_=new p9;i9=new Proxy({},{get($,Z){return HG()[Z]}})});function n9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function o9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=H7($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],j=`${Z}_${B}`;W.set(B,j)}}for(let U of K){let z=s9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1950
1950
 
1951
1951
  `)}function H7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=H7(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:j.map((_)=>`${_.selector} { ${_.declarations} }`).join(`
1952
1952
  `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function s9($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=H7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>s9(B,Z,Y,X,Q,J)).join(`
1953
1953
  `);return`${G} {
1954
1954
  ${z}
1955
- }`}return`${G} { ${K} }`}let q=HG(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function HG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=OG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function OG($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function I$($,Z){if(!LG.test($))return{html:$,hasScoped:!1};let Y=n9(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${O7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=FG(W,X),z=q.replace(new RegExp(O7,"gi"),"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=VG(Q,X),{html:Q,hasScoped:!0}}function FG($,Z){return o9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function VG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var O7,LG;var L7=y(()=>{O7=String.raw`(?<![\w-])scoped(?![\w-])`,LG=new RegExp(`<style\\s+[^>]*${O7}`,"i")});function RG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return wG.test(Z)}function E$($){g5.lastIndex=0;let Z;while((Z=g5.exec($))!==null){if(Z[0].startsWith("</")||RG(Z[0]))continue;let Y=Z.index,X=g5.lastIndex,Q=1,J;while((J=g5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:g5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var g5,wG;var F7=y(()=>{g5=/<\/?template\b[^>]*>/gi,wG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var r9=()=>{};function D0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var V7={};o(V7,{useTitle:()=>EG,useSeoMeta:()=>k$,usePageTitle:()=>EG,useHead:()=>E1,resetHead:()=>TG,renderHtmlAttrs:()=>kG,renderHead:()=>DG,renderBodyAttrs:()=>bG,processTitleDirective:()=>PG,processMetaDirective:()=>CG,processHeadDirective:()=>yG,getPageMeta:()=>NG,getHead:()=>h5,definePageMeta:()=>IG,applyHead:()=>SG});function h5(){return U1}function NG(){return D$}function TG(){U1={},AG.length=0,D$={}}function E1($){U1=MG(U1,$)}function MG($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function k$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});E1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function IG($){if(D$={...D$,...$},$.title||$.description)k$({title:$.title,description:$.description})}function EG($){let Z=typeof $==="function"?$():$;E1({title:Z})}function DG($=U1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${I1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${I1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${I1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${I1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${I1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1956
- `)}function kG($=U1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${I1(Y)}"`).join(" ")}function bG($=U1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${I1(Y)}"`).join(" ")}function I1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function SG($=U1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function yG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1957
- `,""}),headContent:Z.trim()}}function PG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return E1({title:G}),""})}function CG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return E1({meta:[z]}),""})}var U1,AG,D$;var d5=y(()=>{U1={},AG=[],D$={}});var b$={};o(b$,{stripTypeScript:()=>Z8,hasVariables:()=>G8,extractVariables:()=>D1,extractScriptFromTemplate:()=>Q8,convertToCommonJS:()=>R7});import a1 from"path";import m5 from"process";function vG($){let Z=[],Y=0,X=$.split(`
1955
+ }`}return`${G} { ${K} }`}let q=OG(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function OG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=LG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function LG($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function I$($,Z){if(!FG.test($))return{html:$,hasScoped:!1};let Y=n9(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${O7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=VG(W,X),z=q.replace(new RegExp(O7,"gi"),"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=wG(Q,X),{html:Q,hasScoped:!0}}function VG($,Z){return o9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function wG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var O7,FG;var L7=y(()=>{O7=String.raw`(?<![\w-])scoped(?![\w-])`,FG=new RegExp(`<style\\s+[^>]*${O7}`,"i")});function AG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return RG.test(Z)}function E$($){g5.lastIndex=0;let Z;while((Z=g5.exec($))!==null){if(Z[0].startsWith("</")||AG(Z[0]))continue;let Y=Z.index,X=g5.lastIndex,Q=1,J;while((J=g5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:g5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var g5,RG;var F7=y(()=>{g5=/<\/?template\b[^>]*>/gi,RG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var r9=()=>{};function D0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var V7={};o(V7,{useTitle:()=>DG,useSeoMeta:()=>k$,usePageTitle:()=>DG,useHead:()=>E1,resetHead:()=>MG,renderHtmlAttrs:()=>bG,renderHead:()=>kG,renderBodyAttrs:()=>SG,processTitleDirective:()=>CG,processMetaDirective:()=>vG,processHeadDirective:()=>PG,getPageMeta:()=>TG,getHead:()=>h5,definePageMeta:()=>EG,applyHead:()=>yG});function h5(){return U1}function TG(){return D$}function MG(){U1={},NG.length=0,D$={}}function E1($){U1=IG(U1,$)}function IG($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function k$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});E1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function EG($){if(D$={...D$,...$},$.title||$.description)k$({title:$.title,description:$.description})}function DG($){let Z=typeof $==="function"?$():$;E1({title:Z})}function kG($=U1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${I1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${I1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${I1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${I1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${I1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1956
+ `)}function bG($=U1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${I1(Y)}"`).join(" ")}function SG($=U1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${I1(Y)}"`).join(" ")}function I1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function yG($=U1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function PG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1957
+ `,""}),headContent:Z.trim()}}function CG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return E1({title:G}),""})}function vG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return E1({meta:[z]}),""})}var U1,NG,D$;var d5=y(()=>{U1={},NG=[],D$={}});var b$={};o(b$,{stripTypeScript:()=>Z8,hasVariables:()=>G8,extractVariables:()=>D1,extractScriptFromTemplate:()=>Q8,convertToCommonJS:()=>R7});import a1 from"path";import m5 from"process";function xG($){let Z=[],Y=0,X=$.split(`
1958
1958
  `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((B)=>{let j=B.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function Z8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),B=z?U.slice(3):U,j=-1,_=0;for(let R=0;R<B.length;R++)if(B[R]==="<")_++;else if(B[R]===">")_--;else if(B[R]===":"&&_===0){j=R;break}if(j===-1)return W;let L=B.substring(0,j).trim().replace(/\?$/,""),F=B.substring(j+1),O=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let j=Z[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")W++;else if(j===">"&&W>0)W--;else if(W===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1959
1959
 
1960
- `),Z}async function D1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let S=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=S.transformSync(v)}catch{Q=Z8($)}let J={exports:{}},G=J.exports,K=m5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!S.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S));for(let S of W)try{let v=a1.resolve(K,"node_modules",S),x=a1.join(v,"package.json"),u=JSON.parse(G0("fs").readFileSync(x,"utf8")),r=u.main||"index.js";if(u.exports){let j0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof j0==="string")r=j0;else if(j0?.bun)r=j0.bun;else if(j0?.import)r=j0.import;else if(j0?.default)r=j0.default}q[S]=await import(a1.resolve(v,r))}catch{}let U=(S)=>{if(q[S])return q[S];return G0(S)},z=Z.props||{},B=(S)=>{if(!S)return z;let v={};for(let[x,u]of Object.entries(S)){let r=z[x];if(r!==void 0)v[x]=r;else if(typeof u==="function")v[x]=u();else v[x]=u}return v};for(let[S,v]of Object.entries(z))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let j=(S)=>{if(!S)return z;let v={...z};for(let[x,u]of Object.entries(S)){let r=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(v[x]===void 0&&r.default!==void 0)v[x]=typeof r.default==="function"?r.default():r.default}return v},_=()=>Z.slots||{},H=(S,v)=>{let x={...S};for(let[u,r]of Object.entries(v))if(x[u]===void 0)if(typeof r==="function")x[u]=r();else x[u]=r;return x},L=(S)=>{let v=()=>S;return v.set=(x)=>{},v.update=(x)=>{},v},F=(S)=>{let v,x=!1;return()=>{if(!x)try{v=S(),x=!0}catch{v=void 0}return v}},O=(S)=>{},V=(S)=>S(),w=(S)=>{},R=(S)=>{},A=(S)=>{},N=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",x=S?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},T=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),M=(S)=>{E1(S);let v=Z.__stx_runtime_head||{},x=S||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},I=(S)=>{k$(S);let v=h5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},k=(S)=>({value:S}),E=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),D=(S,v)=>{},b=(S)=>{},P=(S)=>{},f=(S)=>S?S():Promise.resolve(),g=(S)=>(v,...x)=>{},m=(S)=>{},a=(S,v)=>{},X0=(S,v)=>v,e0=()=>({value:"light"}),x0=()=>L(!1),N0=(S)=>L(!1),Z0=()=>N0("(prefers-color-scheme: dark)"),R0=()=>N0("(prefers-color-scheme: light)"),d0=()=>N0("(prefers-reduced-motion: reduce)"),$1=()=>N0("(prefers-contrast: more)"),n0={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:{}},s=new Proxy(n0,{get(S,v){if(v in S)return S[v];return},set(S,v,x){return S[v]=x,!0}}),t={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},d=console;try{let S=R7(Q,Y),v=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),u=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&x(i)),r=u.map((i)=>Z[i]),j0=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"]),E0=[],S0=[];for(let[i,G1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(j0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(S))continue;E0.push(i),S0.push(G1)}let O5=vG(S).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1961
- `),W0=Z.params??{},Z1=[],s0=[];for(let i=0;i<u.length;i++){if(u[i]==="params")continue;Z1.push(u[i]),s0.push(r[i])}let m0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...E0,...Z1,`return (async () => {
1960
+ `),Z}async function D1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let S=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=S.transformSync(v)}catch{Q=Z8($)}let J={exports:{}},G=J.exports,K=m5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!S.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S));for(let S of W)try{let v=a1.resolve(K,"node_modules",S),x=a1.join(v,"package.json"),u=JSON.parse(G0("fs").readFileSync(x,"utf8")),r=u.main||"index.js";if(u.exports){let j0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof j0==="string")r=j0;else if(j0?.bun)r=j0.bun;else if(j0?.import)r=j0.import;else if(j0?.default)r=j0.default}q[S]=await import(a1.resolve(v,r))}catch{}let U=(S)=>{if(q[S])return q[S];return G0(S)},z=Z.props||{},B=(S)=>{if(!S)return z;let v={};for(let[x,u]of Object.entries(S)){let r=z[x];if(r!==void 0)v[x]=r;else if(typeof u==="function")v[x]=u();else v[x]=u}return v};for(let[S,v]of Object.entries(z))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let j=(S)=>{if(!S)return z;let v={...z};for(let[x,u]of Object.entries(S)){let r=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(v[x]===void 0&&r.default!==void 0)v[x]=typeof r.default==="function"?r.default():r.default}return v},_=()=>Z.slots||{},H=(S,v)=>{let x={...S};for(let[u,r]of Object.entries(v))if(x[u]===void 0)if(typeof r==="function")x[u]=r();else x[u]=r;return x},L=(S)=>{let v=()=>S;return v.set=(x)=>{},v.update=(x)=>{},v},F=(S)=>{let v,x=!1;return()=>{if(!x)try{v=S(),x=!0}catch{v=void 0}return v}},O=(S)=>{},V=(S)=>S(),w=(S)=>{},R=(S)=>{},A=(S)=>{},N=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",x=S?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},T=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),M=(S)=>{E1(S);let v=Z.__stx_runtime_head||{},x=S||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},I=(S)=>{k$(S);let v=h5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},k=(S)=>({value:S}),E=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),D=(S,v)=>{},b=(S)=>{},P=(S)=>{},f=(S)=>S?S():Promise.resolve(),g=(S)=>(v,...x)=>{},m=(S)=>{},a=(S,v)=>{},X0=(S,v)=>v,e0=()=>({value:"light"}),x0=()=>L(!1),N0=(S)=>L(!1),Z0=()=>N0("(prefers-color-scheme: dark)"),R0=()=>N0("(prefers-color-scheme: light)"),d0=()=>N0("(prefers-reduced-motion: reduce)"),$1=()=>N0("(prefers-contrast: more)"),i0={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:{}},s=new Proxy(i0,{get(S,v){if(v in S)return S[v];return},set(S,v,x){return S[v]=x,!0}}),t={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},d=console;try{let S=R7(Q,Y),v=new Set(Object.keys(z)),x=(l)=>/^[a-z_$][\w$]*$/i.test(l),u=Object.keys(Z).filter((l)=>!v.has(l)&&l!=="props"&&x(l)),r=u.map((l)=>Z[l]),j0=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"]),E0=[],S0=[];for(let[l,s0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(l))continue;if(j0.has(l))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${l}\\b`).test(S))continue;E0.push(l),S0.push(s0)}let O5=xG(S).map((l)=>`module.exports.${l} = typeof ${l} !== 'undefined' ? ${l} : module.exports.${l};`).join(`
1961
+ `),W0=Z.params??{},Z1=[],o0=[];for(let l=0;l<u.length;l++){if(u[l]==="params")continue;Z1.push(u[l]),o0.push(r[l])}let Y1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...E0,...Z1,`return (async () => {
1962
1962
  ${S}
1963
1963
  ${O5}
1964
1964
  return module.exports
1965
- })()`)(J,G,U,z,B,j,H,L,F,O,V,w,R,A,N,T,M,I,k,E,C,D,b,P,f,g,m,_,a,X0,e0,x0,N0,Z0,R0,d0,$1,s,t,d,n0.confirm,n0.alert,n0.fetch,W0,...S0,...s0);if(X.preserveExisting){for(let[i,G1]of Object.entries(m0))if(!(i in Z)||Z[i]===void 0)Z[i]=G1}else Object.assign(Z,m0);for(let[i,G1]of Object.entries(z))if(!(i in Z))Z[i]=G1}catch(S){if(m5.env.STX_DEBUG){let v=S instanceof Error?S.message:String(S);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await dG(Q,Z,Y)}catch(v){if(m5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function R7($,Z){let Y=Z?a1.dirname(Z):m5.cwd(),X=$.split(`
1965
+ })()`)(J,G,U,z,B,j,H,L,F,O,V,w,R,A,N,T,M,I,k,E,C,D,b,P,f,g,m,_,a,X0,e0,x0,N0,Z0,R0,d0,$1,s,t,d,i0.confirm,i0.alert,i0.fetch,W0,...S0,...o0);if(X.preserveExisting){for(let[l,s0]of Object.entries(Y1))if(!(l in Z)||Z[l]===void 0)Z[l]=s0}else Object.assign(Z,Y1);for(let[l,s0]of Object.entries(z))if(!(l in Z))Z[l]=s0}catch(S){if(m5.env.STX_DEBUG){let v=S instanceof Error?S.message:String(S);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await mG(Q,Z,Y)}catch(v){if(m5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function R7($,Z){let Y=Z?a1.dirname(Z):m5.cwd(),X=$.split(`
1966
1966
  `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,B=X[W];for(let j=0;j<B.length;j++){let _=B[j];if(z){z=!1;continue}if(_==="\\"){z=!0;continue}if(U){if(_===U)U=null;continue}if(_==='"'||_==="'"||_==="`"){U=_;continue}if(_==="(")K++;else if(_===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),U=(z)=>{if(z.startsWith("."))return a1.resolve(Y,z);return z};if(K){let[,z,B]=K,j=U(B);Q.push(`const ${z} = await import('${j}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,j=z.trim(),_=U(B);Q.push(`const { ${j} } = await import('${_}')`);for(let H of j.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let z=U(W[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=a9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=w7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=a9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=w7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=w7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let B=X[z];for(let j of B)if(j==="{")U++;else if(j==="}")U--;if(z>J)W+=`
1967
- `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return xG(Q.join(`
1968
- `),Y)}function xG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1969
- `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=fG($,Q);if(z){let{quote:B,path:j,end:_}=z;if(j.startsWith(".")){let H=a1.resolve(Z,j);X+=`await import(${B}${H}${B})`,Q=_;continue}}}X+=W,Q++}return X}function fG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function Y8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=D0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function X8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=Y8(Y,X);if(K){let q=X8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function a9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let j=U.startsWith("{")?"}":"]",_=U;for(let H=Z+1;H<$.length;H++)if(_+=" "+$[H].trim(),z=H,$[H].includes(j))break;U=_}let B=Y8(U,0);if(B){let j=W[1],_=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(t9(L)){let A=e9($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=X8(_),w=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1967
+ `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return fG(Q.join(`
1968
+ `),Y)}function fG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1969
+ `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=gG($,Q);if(z){let{quote:B,path:j,end:_}=z;if(j.startsWith(".")){let H=a1.resolve(Z,j);X+=`await import(${B}${H}${B})`,Q=_;continue}}}X+=W,Q++}return X}function gG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function Y8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=D0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function X8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=Y8(Y,X);if(K){let q=X8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function a9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let j=U.startsWith("{")?"}":"]",_=U;for(let H=Z+1;H<$.length;H++)if(_+=" "+$[H].trim(),z=H,$[H].includes(j))break;U=_}let B=Y8(U,0);if(B){let j=W[1],_=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(t9(L)){let A=e9($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=X8(_),w=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1970
1970
  `);return{type:j,name:w,value:`${F}; ${j} ${_} = ${w};
1971
1971
  ${R}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(t9(G)){let W=e9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1972
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function w7($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(gG(Y)){let K=hG($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function t9($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!J8(Z)}function J8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function gG($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function e9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!J8(X)){let J=$[Q];X+=`
1972
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function w7($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(hG(Y)){let K=dG($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function t9($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!J8(Z)}function J8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function hG($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function e9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!J8(X)){let J=$[Q];X+=`
1973
1973
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1974
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function hG($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(D0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1975
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function $8($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...m5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function dG($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=$8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=$8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function Q8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function G8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=y(()=>{d5();A1();F0()});var A7={};o(A7,{renderSlot:()=>q8,processSlots:()=>U8,parseSlots:()=>K8,parseSlotElement:()=>cG,extractSlotContent:()=>oG,applySlots:()=>sG});function mG($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function lG($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function pG($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let B=$.indexOf("-->",J+4);Q=B===-1?$.length:B+3;continue}let G=lG($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let B=Y.lastIndexOf(U);if(B!==-1)Y.splice(B);Q=G;continue}if(U==="template"&&Y.length===0){let B=K.match(X);if(B){let j=mG($,G);if(j!==-1){let _=B[1]||B[2]||B[3];Z.push({start:J,end:j,slotName:_,content:$.slice(G,j-11).trim(),propsBinding:B[4]||void 0}),Q=j;continue}}}if(!/\/\s*>$/.test(K)&&!uG.has(U)){if(Y.push(U),U==="script"||U==="style"){let B=$.toLowerCase().indexOf(`</${U}>`,G);if(B!==-1){Q=B;continue}}}Q=G}return Z}function K8($){let Z={default:"",named:new Map},Y=$,X=pG($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,B,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(_+H).trim(),F=`<${W}${L?" "+L:""}>${j}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,B]=G,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function cG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function q8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=iG(Q,G)}return Q}function iG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=W8(Q,Z);return l0(String(J??""))}catch{return`{{ ${X} }}`}})}function W8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!J0($))return;return Q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function U8($,Z,Y){let X=$;X=await nG(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",j={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=_.exec(B))!==null){let L=H[1],F=H[2];j[L]=W8(F,Y)}return await q8(U,j,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function nG($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function oG($){let Z=K8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function sG($,Z,Y,X){return await U8($,{default:Z,named:Y},X)}var uG;var N7=y(()=>{r0();F0();uG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function z1($,Z){let Y=rG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function rG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function aG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function k1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function z8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=z1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,j=0;while(W<K.length){let _=K.indexOf("@",W);if(_===-1)break;W=_;let H=K.substring(_);if(aG(K,_)){W++;continue}if(/^@if\s*\(/.test(H)){j++,W++;continue}if(/^@endif(?![a-z])/.test(H)){j--,W+=6;continue}if(j===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=z1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function l5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=z8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function S$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=k1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let j=$.slice(z,B),_=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,_),name:Z,params:U,content:j,start:K,end:_}),Q.lastIndex=_,J=Q.exec($)}return X}function T7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=z1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),j=B.match(/^@switch\s*\(/),_=B.match(/^@endswitch(?![a-z])/);if(j){if(z++,U)U.content+=j[0];W+=j[0].length;continue}if(_){if(z--,U)U.content+=_[0];W+=_[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=z1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var B8=()=>{};var j8=()=>{};var y$=y(()=>{B8();j8()});function v$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(P0)X.add(P0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),p5)X.forEach((K)=>C$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function x$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,p5)X.forEach((G)=>C$.add(G));else X.forEach((G)=>G())},J=()=>{if(P0)X.add(P0);if(Y){let G=P0;P0=Q,P$.push(Q);try{Z=$()}finally{P$.pop(),P0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function f$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=P0;P0=Q,P$.push(Q);try{Y=$()}finally{P$.pop(),P0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function M7($){if(p5){$();return}p5=!0;try{$()}finally{p5=!1,C$.forEach((Z)=>Z()),C$.clear()}}function I7($){ZK.push($)}function E7($){YK.push($)}function g$($){return typeof $==="function"&&$._isSignal===!0}function h$($){return typeof $==="function"&&$._isDerived===!0}function D7($){if(g$($)||h$($))return $();return $}function d$($){let Z=P0;P0=null;try{return $()}finally{P0=Z}}function XK($,Z){let Y=typeof $==="function"?$:()=>$,X=v$([]),Q=x$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return f$(()=>{if(Y(),!J){J=!0;return}if(d$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var P0=null,P$,p5=!1,C$,ZK,YK;var k7=y(()=>{P$=[],C$=new Set,ZK=[],YK=[]});var H8={};o(H8,{useOptimistic:()=>XK,untrack:()=>D7,state:()=>v$,peek:()=>d$,onMount:()=>I7,onDestroy:()=>E7,isSignal:()=>g$,isDerived:()=>h$,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>_8,effect:()=>f$,derived:()=>x$,default:()=>QK,batch:()=>M7});function _8(){try{let $=JK(m$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return m$()}}function JK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function m$(){return`
1974
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function dG($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(D0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1975
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function $8($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...m5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function mG($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=$8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=$8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function Q8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function G8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=y(()=>{d5();A1();F0()});var A7={};o(A7,{renderSlot:()=>q8,processSlots:()=>U8,parseSlots:()=>K8,parseSlotElement:()=>iG,extractSlotContent:()=>sG,applySlots:()=>rG});function uG($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function pG($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function cG($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let B=$.indexOf("-->",J+4);Q=B===-1?$.length:B+3;continue}let G=pG($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let B=Y.lastIndexOf(U);if(B!==-1)Y.splice(B);Q=G;continue}if(U==="template"&&Y.length===0){let B=K.match(X);if(B){let j=uG($,G);if(j!==-1){let _=B[1]||B[2]||B[3];Z.push({start:J,end:j,slotName:_,content:$.slice(G,j-11).trim(),propsBinding:B[4]||void 0}),Q=j;continue}}}if(!/\/\s*>$/.test(K)&&!lG.has(U)){if(Y.push(U),U==="script"||U==="style"){let B=$.toLowerCase().indexOf(`</${U}>`,G);if(B!==-1){Q=B;continue}}}Q=G}return Z}function K8($){let Z={default:"",named:new Map},Y=$,X=cG($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,B,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(_+H).trim(),F=`<${W}${L?" "+L:""}>${j}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,B]=G,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function iG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function q8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=nG(Q,G)}return Q}function nG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=W8(Q,Z);return u0(String(J??""))}catch{return`{{ ${X} }}`}})}function W8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!J0($))return;return Q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function U8($,Z,Y){let X=$;X=await oG(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",j={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=_.exec(B))!==null){let L=H[1],F=H[2];j[L]=W8(F,Y)}return await q8(U,j,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function oG($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function sG($){let Z=K8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function rG($,Z,Y,X){return await U8($,{default:Z,named:Y},X)}var lG;var N7=y(()=>{r0();F0();lG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function z1($,Z){let Y=aG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function aG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function tG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function k1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function z8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=z1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,j=0;while(W<K.length){let _=K.indexOf("@",W);if(_===-1)break;W=_;let H=K.substring(_);if(tG(K,_)){W++;continue}if(/^@if\s*\(/.test(H)){j++,W++;continue}if(/^@endif(?![a-z])/.test(H)){j--,W+=6;continue}if(j===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=z1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function l5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=z8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function S$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=k1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let j=$.slice(z,B),_=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,_),name:Z,params:U,content:j,start:K,end:_}),Q.lastIndex=_,J=Q.exec($)}return X}function T7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=z1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),j=B.match(/^@switch\s*\(/),_=B.match(/^@endswitch(?![a-z])/);if(j){if(z++,U)U.content+=j[0];W+=j[0].length;continue}if(_){if(z--,U)U.content+=_[0];W+=_[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=z1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var B8=()=>{};var j8=()=>{};var y$=y(()=>{B8();j8()});function v$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(P0)X.add(P0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),p5)X.forEach((K)=>C$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function x$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,p5)X.forEach((G)=>C$.add(G));else X.forEach((G)=>G())},J=()=>{if(P0)X.add(P0);if(Y){let G=P0;P0=Q,P$.push(Q);try{Z=$()}finally{P$.pop(),P0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function f$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=P0;P0=Q,P$.push(Q);try{Y=$()}finally{P$.pop(),P0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function M7($){if(p5){$();return}p5=!0;try{$()}finally{p5=!1,C$.forEach((Z)=>Z()),C$.clear()}}function I7($){YK.push($)}function E7($){XK.push($)}function g$($){return typeof $==="function"&&$._isSignal===!0}function h$($){return typeof $==="function"&&$._isDerived===!0}function D7($){if(g$($)||h$($))return $();return $}function d$($){let Z=P0;P0=null;try{return $()}finally{P0=Z}}function JK($,Z){let Y=typeof $==="function"?$:()=>$,X=v$([]),Q=x$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return f$(()=>{if(Y(),!J){J=!0;return}if(d$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var P0=null,P$,p5=!1,C$,YK,XK;var k7=y(()=>{P$=[],C$=new Set,YK=[],XK=[]});var H8={};o(H8,{useOptimistic:()=>JK,untrack:()=>D7,state:()=>v$,peek:()=>d$,onMount:()=>I7,onDestroy:()=>E7,isSignal:()=>g$,isDerived:()=>h$,generateSignalsRuntimeDev:()=>m$,generateSignalsRuntime:()=>_8,effect:()=>f$,derived:()=>x$,default:()=>GK,batch:()=>M7});function _8(){try{let $=QK(m$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return m$()}}function QK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function m$(){return`
1976
1976
  // STX Signals Runtime (Development Build)
1977
1977
  console.log('[stx] signals runtime loading');
1978
1978
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -3893,6 +3893,7 @@ catch (e2) {
3893
3893
  Array.from(el.attributes).forEach(attr => {
3894
3894
  const name = attr.name;
3895
3895
  const value = attr.value;
3896
+ if (!name) return;
3896
3897
 
3897
3898
  if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
3898
3899
  console.log('[stx] attr iter:', el.tagName, 'name:', name);
@@ -3925,9 +3926,34 @@ catch (e2) {
3925
3926
  catch (e) { controlValue = String(v); }
3926
3927
  }
3927
3928
  controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
3928
- el.value = controlValue;
3929
- if (controlValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
3930
- else el.setAttribute(attrName, controlValue);
3929
+ el.__stx_bound_value = controlValue;
3930
+ var applyControlValue = function() {
3931
+ var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
3932
+ el.value = desiredValue;
3933
+ if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
3934
+ else if (el.getAttribute(attrName) !== desiredValue) el.setAttribute(attrName, desiredValue);
3935
+ };
3936
+ applyControlValue();
3937
+
3938
+ // A select's value binding is processed before its child
3939
+ // directives. When a nested :for creates the matching options
3940
+ // afterward, the browser otherwise leaves the first option
3941
+ // selected. Keep the desired value and reapply it whenever the
3942
+ // option tree changes, including later reactive list updates.
3943
+ if (el.tagName === 'SELECT' && !el.__stx_value_observer && typeof window.MutationObserver !== 'undefined') {
3944
+ el.__stx_value_observer = new window.MutationObserver(applyControlValue);
3945
+ el.__stx_value_observer.observe(el, {
3946
+ childList: true,
3947
+ subtree: true,
3948
+ attributes: true,
3949
+ attributeFilter: ['value'],
3950
+ });
3951
+ el.__stx_destroy = el.__stx_destroy || [];
3952
+ el.__stx_destroy.push(function() {
3953
+ if (el.__stx_value_observer) el.__stx_value_observer.disconnect();
3954
+ el.__stx_value_observer = null;
3955
+ });
3956
+ }
3931
3957
  return;
3932
3958
  }
3933
3959
  if (v === false || v === null || v === undefined) {
@@ -5162,7 +5188,11 @@ catch (e2) {
5162
5188
  const content = el.content;
5163
5189
  currentNodes = Array.from(content.childNodes).map(n => n.cloneNode(true));
5164
5190
  // Insert cloned content initially
5165
- currentNodes.forEach(node => parent.insertBefore(node, placeholder.nextSibling));
5191
+ // Capture the anchor once. Re-reading placeholder.nextSibling after
5192
+ // every insertion points at the node just inserted and reverses a
5193
+ // multi-root template branch.
5194
+ const initialAnchor = placeholder.nextSibling;
5195
+ currentNodes.forEach(node => parent.insertBefore(node, initialAnchor));
5166
5196
  el.remove(); // Remove the template element itself
5167
5197
  }
5168
5198
 
@@ -5243,7 +5273,8 @@ catch (e2) {
5243
5273
  if (value && !isInserted) {
5244
5274
  // Re-insert cloned content
5245
5275
  currentNodes = Array.from(el.content.childNodes).map(n => n.cloneNode(true));
5246
- currentNodes.forEach(node => parent.insertBefore(node, placeholder.nextSibling));
5276
+ const insertionAnchor = placeholder.nextSibling;
5277
+ currentNodes.forEach(node => parent.insertBefore(node, insertionAnchor));
5247
5278
  // Process the new nodes \u2014 use LIVE componentScope so all functions are available
5248
5279
  const childScope = { ...componentScope, ...(capturedElementScope || {}) };
5249
5280
  currentNodes.forEach(node => {
@@ -6386,7 +6417,8 @@ catch (e) {}
6386
6417
  var scopeId = el.getAttribute('data-stx-scope');
6387
6418
  var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
6388
6419
  if (!scopeVars) return;
6389
- el.__stx_parent_scope = { ...componentScope };
6420
+ el.__stx_parent_scope = el.__stx_parent_scope
6421
+ || resolveComponentCallerScope(el, componentScope);
6390
6422
  bindParentComponentProps(el, el.__stx_parent_scope);
6391
6423
  Object.assign(componentScope, scopeVars);
6392
6424
  el.__stx_disposers = trackEffects(function() { processElement(el, componentScope); });
@@ -7248,7 +7280,8 @@ else {
7248
7280
  // Forwarded props and events belong to the caller. Capture its scope
7249
7281
  // before this component's locals are merged, so identical child names
7250
7282
  // cannot shadow expressions such as :total-items="totalItems".
7251
- el.__stx_parent_scope = resolveComponentCallerScope(el, pageScopeSnapshot);
7283
+ el.__stx_parent_scope = el.__stx_parent_scope
7284
+ || resolveComponentCallerScope(el, pageScopeSnapshot);
7252
7285
  bindParentComponentProps(el, el.__stx_parent_scope);
7253
7286
 
7254
7287
  // Merge component scope vars into componentScope (don't restore - keep for head elements)
@@ -7629,7 +7662,8 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7629
7662
  return;
7630
7663
  }
7631
7664
  if (!scopeVars) return;
7632
- el.__stx_parent_scope = resolveComponentCallerScope(el, spaPageScopeSnapshot);
7665
+ el.__stx_parent_scope = el.__stx_parent_scope
7666
+ || resolveComponentCallerScope(el, spaPageScopeSnapshot);
7633
7667
  bindParentComponentProps(el, el.__stx_parent_scope);
7634
7668
  Object.assign(componentScope, scopeVars);
7635
7669
  if (el.__stx_disposers) return;
@@ -7717,7 +7751,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
7717
7751
  }
7718
7752
  }
7719
7753
  })();
7720
- `}var QK;var O8=y(()=>{k7();k7();QK={state:v$,derived:x$,effect:f$,batch:M7,onMount:I7,onDestroy:E7,isSignal:g$,isDerived:h$,untrack:D7,peek:d$,generateSignalsRuntime:_8,generateSignalsRuntimeDev:m$}});var b7={};o(b7,{templateCache:()=>L8,readFileCached:()=>GK,invalidateFileCacheByDir:()=>qK,invalidateFileCache:()=>KK,hashFilePath:()=>c5,getCachedSignalsRuntime:()=>zK,getCachedRouterScript:()=>BK,clearDevCaches:()=>jK,checkCache:()=>_K,cacheTemplate:()=>HK,__setSignalsGeneratorsForTest:()=>UK});import B1 from"fs";import t1 from"path";async function GK($){let Y;for(let X=0;X<3;X++)try{let J=(await B1.promises.stat($)).mtime.getTime(),G=b1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await B1.promises.stat($)).mtime.getTime();if(W!==J)continue;return b1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw b1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function KK($){b1.delete($)}function qK($){for(let Z of b1.keys())if(Z.startsWith($))b1.delete(Z)}function UK($){F8=$}async function zK($=!1){let Z=F8??await Promise.resolve().then(() => (O8(),H8));if($)return Z.generateSignalsRuntimeDev();if(u$===null)u$=Z.generateSignalsRuntime();return u$}async function BK(){if(l$===null){let{getRouterScript:$}=await import("stx-router");l$=$()}return l$}function jK(){b1.clear(),w8(),u$=null,WK=null,l$=null}function V8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function _K($,Z){try{if(!Z.cachePath)return null;let Y=t1.resolve(Z.cachePath),X=t1.join(Y,`${c5($)}.html`),Q=t1.join(Y,`${c5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==V8(Z))return null;if((await B1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await B1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function HK($,Z,Y,X){try{if(!X.cachePath)return;let Q=t1.resolve(X.cachePath);await B1.promises.mkdir(Q,{recursive:!0});let J=t1.join(Q,`${c5($)}.html`),G=t1.join(Q,`${c5($)}.meta.json`),K=await B1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:V8(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),L8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function c5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,OK)}var L8,b1,u$=null,WK=null,F8=null,l$=null,OK=16;var S7=y(()=>{O0();L8=new Map,b1=new Map});function R8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
7754
+ `}var GK;var O8=y(()=>{k7();k7();GK={state:v$,derived:x$,effect:f$,batch:M7,onMount:I7,onDestroy:E7,isSignal:g$,isDerived:h$,untrack:D7,peek:d$,generateSignalsRuntime:_8,generateSignalsRuntimeDev:m$}});var b7={};o(b7,{templateCache:()=>L8,readFileCached:()=>KK,invalidateFileCacheByDir:()=>WK,invalidateFileCache:()=>qK,hashFilePath:()=>c5,getCachedSignalsRuntime:()=>BK,getCachedRouterScript:()=>jK,clearDevCaches:()=>_K,checkCache:()=>HK,cacheTemplate:()=>OK,__setSignalsGeneratorsForTest:()=>zK});import B1 from"fs";import t1 from"path";async function KK($){let Y;for(let X=0;X<3;X++)try{let J=(await B1.promises.stat($)).mtime.getTime(),G=b1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await B1.promises.stat($)).mtime.getTime();if(W!==J)continue;return b1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw b1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function qK($){b1.delete($)}function WK($){for(let Z of b1.keys())if(Z.startsWith($))b1.delete(Z)}function zK($){F8=$}async function BK($=!1){let Z=F8??await Promise.resolve().then(() => (O8(),H8));if($)return Z.generateSignalsRuntimeDev();if(u$===null)u$=Z.generateSignalsRuntime();return u$}async function jK(){if(l$===null){let{getRouterScript:$}=await import("stx-router");l$=$()}return l$}function _K(){b1.clear(),w8(),u$=null,UK=null,l$=null}function V8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function HK($,Z){try{if(!Z.cachePath)return null;let Y=t1.resolve(Z.cachePath),X=t1.join(Y,`${c5($)}.html`),Q=t1.join(Y,`${c5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==V8(Z))return null;if((await B1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await B1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function OK($,Z,Y,X){try{if(!X.cachePath)return;let Q=t1.resolve(X.cachePath);await B1.promises.mkdir(Q,{recursive:!0});let J=t1.join(Q,`${c5($)}.html`),G=t1.join(Q,`${c5($)}.meta.json`),K=await B1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:V8(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),L8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function c5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,LK)}var L8,b1,u$=null,UK=null,F8=null,l$=null,LK=16;var S7=y(()=>{O0();L8=new Map,b1=new Map});function R8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
7721
7755
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
7722
7756
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
7723
7757
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -7735,34 +7769,34 @@ ${z}`);return z+`
7735
7769
  `+Q+$.slice(K+1)}return Q+`
7736
7770
  `+$}async function N8($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7737
7771
  `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (S7(),b7)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
7738
- </body>`+$.slice(G+7)}var n$={};o(n$,{scanScriptTags:()=>S8,rewriteStxImportSpecifiers:()=>v8,processSignals:()=>x7,processScriptSetup:()=>P8,preEvalLiteralReactiveIfs:()=>C7,parseLoopExpression:()=>y8,hasSignalsSyntax:()=>i$,findMarkupIndexOutsideScripts:()=>c$,extractExports:()=>C8,convertSignalLoopsToAttributes:()=>v7,convertSignalDirectivesToAttributes:()=>P7});function S8($,Z={}){let Y=[],X=0;while(X<$.length){M8.lastIndex=X;let Q=M8.exec($);if(!Q)break;let J=$.indexOf("<!--",X);if(J!==-1&&J<Q.index){let U=$.indexOf("-->",J+4);if(U===-1)break;X=U+3;continue}let G=Q[1],K=Q.index+Q[0].length,q=$.toLowerCase().indexOf("</script>",K);if(q===-1)break;let W=q+9;if(Z.skipAttrs&&Z.skipAttrs.test(G)){X=W;continue}Y.push({fullMatch:$.slice(Q.index,W),attrs:G,body:$.slice(K,q),start:Q.index,end:W}),X=W}return Y}function y8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=I8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=I8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function I8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function i$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function FK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function VK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function wK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function D8($,Z,Y){if(!$)return!1;let X=wK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(E8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(E8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function p$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(b8);if(J&&RK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function RK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function P7($,Z){let Y=VK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,B=U;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let j=J.substring(U,B-1).trim(),_=B,H=1,L=_,F=/@(if\s*\(|endif)/g;F.lastIndex=_;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(_,L-6).trim(),w;if(FK(V)){let R=l5(J.substring(W,L));if(R.length===0)continue;let A=R[0].branches.filter((M)=>M.type!=="else");if(!(A.length>0&&A.every((M)=>D8(M.condition,Y,Z))))continue;w=R[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return p$(I,"@else-if",M.condition??"");if(M.type==="else")return p$(I,"@else");return p$(I,"@if",M.condition??"")}).join(`
7739
- `)}else{if(!D8(j,Y,Z))continue;w=p$(X(V),"@if",j)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];J=J.substring(0,U)+B+J.substring(z)}return J}return X($)}function AK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function NK($,Z,Y,X){if(y7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let j=$.indexOf("-->",q+4);if(j===-1)return-1;q=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let j=$.indexOf(">",q);if(j===-1)return-1;if($[j-1]==="/"){q=j+1;continue}let _=J.indexOf(`</${U[1].toLowerCase()}`,q);if(_===-1)return-1;let H=$.indexOf(">",_);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!j){q++;continue}if(j[1].toLowerCase()===Q){if(K--,q+=j[0].length,K===0)return q;continue}q+=j[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let j=$.slice(q,B+1);if(!(/\/\s*>$/.test(j)||y7.has(Q)))K++}q=B+1}return-1}function MK($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return TK.test(J)}function C7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,j])=>z>=B&&z<j),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,j,_,H,L,F]=K,O=AK(H);if(O===void 0)continue;let V=K.index,w=V+z.length,N=!!F||/\/\s*>$/.test(z)||y7.has(B.toLowerCase())?w:NK($,V,B,w);if(N===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&MK($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${B}${j}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:j,replacement:_}=q[z];U=U.substring(0,B)+_+U.substring(j)}return U}function v7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,j=y8(z);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let N=A.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let _=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-_.length).trim(),w=V.match(b8),R;if(w){let[,A,N,T]=w;R=`<${A}${N} @for="${z}">${T}</${A}>`}else R=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function IK($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7772
+ </body>`+$.slice(G+7)}var n$={};o(n$,{scanScriptTags:()=>S8,rewriteStxImportSpecifiers:()=>v8,processSignals:()=>x7,processScriptSetup:()=>P8,preEvalLiteralReactiveIfs:()=>C7,parseLoopExpression:()=>y8,hasSignalsSyntax:()=>i$,findMarkupIndexOutsideScripts:()=>c$,extractExports:()=>C8,convertSignalLoopsToAttributes:()=>v7,convertSignalDirectivesToAttributes:()=>P7});function S8($,Z={}){let Y=[],X=0;while(X<$.length){M8.lastIndex=X;let Q=M8.exec($);if(!Q)break;let J=$.indexOf("<!--",X);if(J!==-1&&J<Q.index){let U=$.indexOf("-->",J+4);if(U===-1)break;X=U+3;continue}let G=Q[1],K=Q.index+Q[0].length,q=$.toLowerCase().indexOf("</script>",K);if(q===-1)break;let W=q+9;if(Z.skipAttrs&&Z.skipAttrs.test(G)){X=W;continue}Y.push({fullMatch:$.slice(Q.index,W),attrs:G,body:$.slice(K,q),start:Q.index,end:W}),X=W}return Y}function y8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=I8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=I8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function I8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function i$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function VK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function wK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function RK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function D8($,Z,Y){if(!$)return!1;let X=RK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(E8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(E8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function p$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(b8);if(J&&AK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function AK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function P7($,Z){let Y=wK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,B=U;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let j=J.substring(U,B-1).trim(),_=B,H=1,L=_,F=/@(if\s*\(|endif)/g;F.lastIndex=_;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(_,L-6).trim(),w;if(VK(V)){let R=l5(J.substring(W,L));if(R.length===0)continue;let A=R[0].branches.filter((M)=>M.type!=="else");if(!(A.length>0&&A.every((M)=>D8(M.condition,Y,Z))))continue;w=R[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return p$(I,"@else-if",M.condition??"");if(M.type==="else")return p$(I,"@else");return p$(I,"@if",M.condition??"")}).join(`
7773
+ `)}else{if(!D8(j,Y,Z))continue;w=p$(X(V),"@if",j)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];J=J.substring(0,U)+B+J.substring(z)}return J}return X($)}function NK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function TK($,Z,Y,X){if(y7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let j=$.indexOf("-->",q+4);if(j===-1)return-1;q=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let j=$.indexOf(">",q);if(j===-1)return-1;if($[j-1]==="/"){q=j+1;continue}let _=J.indexOf(`</${U[1].toLowerCase()}`,q);if(_===-1)return-1;let H=$.indexOf(">",_);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!j){q++;continue}if(j[1].toLowerCase()===Q){if(K--,q+=j[0].length,K===0)return q;continue}q+=j[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let j=$.slice(q,B+1);if(!(/\/\s*>$/.test(j)||y7.has(Q)))K++}q=B+1}return-1}function IK($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return MK.test(J)}function C7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,j])=>z>=B&&z<j),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,j,_,H,L,F]=K,O=NK(H);if(O===void 0)continue;let V=K.index,w=V+z.length,N=!!F||/\/\s*>$/.test(z)||y7.has(B.toLowerCase())?w:TK($,V,B,w);if(N===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&IK($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${B}${j}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:j,replacement:_}=q[z];U=U.substring(0,B)+_+U.substring(j)}return U}function v7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,j=y8(z);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let N=A.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let _=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-_.length).trim(),w=V.match(b8),R;if(w){let[,A,N,T]=w;R=`<${A}${N} @for="${z}">${T}</${A}>`}else R=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function EK($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7740
7774
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,B=0;while(z<J){let j=$[z];if(j==="/"&&$[z+1]==="/"){let _=z+2;while(_<J&&$[_]!==`
7741
- `)_++;z=_;continue}if(j==="/"&&$[z+1]==="*"){let _=z+2;while(_<J-1&&!($[_]==="*"&&$[_+1]==="/"))_++;z=_+2;continue}if(j==='"'||j==="'"||j==="`"){let _=z+1;while(_<J){if($[_]==="\\"){_+=2;continue}if($[_]===j){_++;break}_++}z=_;continue}if(j==="("||j==="["||j==="{"){B++,z++;continue}if(j===")"||j==="]"||j==="}"){B--,z++;continue}if(j===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let _=j[2],H=W(X+j[0].length);if(Z.has(_)){Y.push(`/* stx: deduped const ${_} */`),X=H;continue}Z.add(_),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function P8($,Z,Y){let X=S8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(T1(H.attrs))L=M1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${LK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),I5)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>v8(V));let F=u0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
7742
- ${F}`)}let U=W.join(`
7775
+ `)_++;z=_;continue}if(j==="/"&&$[z+1]==="*"){let _=z+2;while(_<J-1&&!($[_]==="*"&&$[_+1]==="/"))_++;z=_+2;continue}if(j==='"'||j==="'"||j==="`"){let _=z+1;while(_<J){if($[_]==="\\"){_+=2;continue}if($[_]===j){_++;break}_++}z=_;continue}if(j==="("||j==="["||j==="{"){B++,z++;continue}if(j===")"||j==="]"||j==="}"){B--,z++;continue}if(j===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let _=j[2],H=W(X+j[0].length);if(Z.has(_)){Y.push(`/* stx: deduped const ${_} */`),X=H;continue}Z.add(_),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function P8($,Z,Y){let X=S8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(T1(L.attrs))F=M1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${FK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),I5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>v8(w));let O=m0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
7776
+ ${O}`)}let U=W.join(`
7743
7777
 
7744
- `);U=IK(U);let z=C8(U),B=L$(U,Y),j=`
7778
+ `);U=EK(U);let z=C8(U),B=z.split(",").map((L)=>L.trim()).filter(Boolean),j=L$(U,Y),_=`
7745
7779
  <script data-stx-scoped>
7746
7780
  function ${G}() {
7747
- ${n1("const")}
7748
- ${B}${U}
7781
+ ${n1("const",B)}
7782
+ ${j}${U}
7749
7783
  return { ${z} };
7750
7784
  }
7751
7785
  window.__stx_latestSetup=${G};
7752
7786
  if(window.stx)window.stx._latestSetup=${G};
7753
- </script>`,_=$;for(let H of J)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${T8})>`),`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${T8})>`,"gi"),(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:_,setupCode:j}}function C8($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let _=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!_){_=!0,J++;continue}if(H==="]"&&_){_=!1,J++;continue}if(H==="/"&&!_){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
7787
+ </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${T8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${T8})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:_}}function C8($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let _=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!_){_=!0,J++;continue}if(H==="]"&&_){_=!1,J++;continue}if(H==="/"&&!_){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
7754
7788
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(_)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===_){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let _=1;while(J<G&&_>0)if(Z[J]==="{")_++,J++;else if(Z[J]==="}")_--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
7755
7789
  `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},j=()=>{if(Q!==0)return;let _=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let V=_[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))j();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function x7($,Z,Y,X){if(!i$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await P8(Q,Y,X);if(Q=J,Q=await A8(Q,Z),Q=R8(Q),G){let U=c$(Q,/<\/head>/i),z=U===-1?c$(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
7756
7790
  ${Q.slice(U)}`;else if(z!==-1){let B=/<body[^>]*>/i.exec(Q.slice(z))[0],j=z+B.length;Q=`${Q.slice(0,j)}
7757
7791
  ${G}${Q.slice(j)}`}else Q=`${Q}
7758
- ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=c$(Q,U);if(z!==-1){let B=Q.slice(0,z),j=Q.slice(z).replace(U,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+j}}return Q}function c$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function v8($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return k8;return`var ${Z.join(", ")}; ${k8}`}var LK=0,T8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,M8,b8,E8,y7,TK,k8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var i5=y(()=>{S5();y$();x5();O0();M8=/<script\b([^>]*)>/gi,b8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;E8=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"]);y7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);TK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import EK from"fs";import h from"path";function x8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function T1($){return!kK($)}function M1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function bK($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
7759
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let _=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of _)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let _=z[2];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!Y.has(_))Z.push(_),Y.add(_)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function SK($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function yK($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function PK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of SK(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=yK(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let j=Object.keys(Z),_=Function(...j,`"use strict"; return (${B});`);Z[z]=_(...j.map((H)=>Z[H]))}catch{}}}catch{}}async function s$($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=U??h.dirname(X),B=[],j=(L)=>{if(L&&!B.includes(L))B.push(L)},_=Y.__originalFilePath;if(_)j(h.join(h.dirname(_),"components"));j(Z),j(Q._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)j(typeof L==="string"?L:null);if(U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of W)if(await c(h.join(F,O)))return!0}return!1}function CK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function xK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function S1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (u5(),b$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=B&&B!=="load"&&CK(B)?B:"";try{let _=(d)=>d.split("-").map((S)=>S.charAt(0).toUpperCase()+S.slice(1)).join(""),H=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let d=[L,L.toLowerCase(),_(L),H(L)];for(let S of d)if(O.has(S)){F=O.get(S);break}}let V=[];if(!F){let d=[`${L}.stx`,`${_(L)}.stx`,`${H(L)}.stx`],S=[...new Set(d)],v=Q.__originalFilePath,x=[];if(v){let W0=h.join(h.dirname(v),"components");x.push(W0)}if(X)x.push(X);let u=G._rootComponentsDir;if(typeof u==="string"&&!x.includes(u))x.push(u);let r=h.join(h.dirname(J),"components");if(!x.includes(r))x.push(r);if(G.componentsDir&&G.componentsDir!==X&&!x.includes(G.componentsDir))x.push(G.componentsDir);let j0=G._pluginComponentDirs;if(Array.isArray(j0)){for(let W0 of j0)if(typeof W0==="string"&&!x.includes(W0))x.push(W0)}let E0=typeof G.root==="string"?h.resolve(G.root):void 0,S0=E0??h.dirname(J),o0=[];if(E0)o0.push(h.resolve(E0,"resources/views/components")),o0.push(h.resolve(E0,"resources/components")),o0.push(h.resolve(E0,"src/components")),o0.push(h.resolve(E0,"components"));o0.push(h.resolve(import.meta.dir,"components"));for(let W0 of o0)if(!x.includes(W0))x.push(W0);let O5=[...new Set(x.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(S0,W0)}))];if(x.length=0,x.push(...O5),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let W0 of x){if(!W0)continue;for(let Z1 of S){let s0=h.join(W0,Z1);if(V.push(s0),await c(s0)){F=s0;break}}if(F)break;if(!F)try{let Z1=await import("fs");if(!Z1.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let L5=8,m0=[{path:W0,depth:0}];while(m0.length>0&&!F){let i=m0.pop();if(i.depth>=L5)continue;let G1;try{G1=Z1.readdirSync(i.path,{withFileTypes:!0})}catch{continue}for(let F5 of G1){if(!F5.isDirectory())continue;if(F5.name==="node_modules"||F5.name.startsWith("."))continue;let d6=h.join(i.path,F5.name);for(let PJ of S){let Y7=h.join(d6,PJ);if(V.push(Y7),await c(Y7)){F=Y7;break}}if(F)break;m0.push({path:d6,depth:i.depth+1})}}}catch{}if(F)break}}if(!F||!await c(F)){let d=V.length>0?`
7792
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=c$(Q,U);if(z!==-1){let B=Q.slice(0,z),j=Q.slice(z).replace(U,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+j}}return Q}function c$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function v8($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return k8;return`var ${Z.join(", ")}; ${k8}`}var FK=0,T8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,M8,b8,E8,y7,MK,k8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var i5=y(()=>{S5();y$();x5();O0();M8=/<script\b([^>]*)>/gi,b8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;E8=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"]);y7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);MK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import DK from"fs";import h from"path";function x8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function T1($){return!bK($)}function M1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function SK($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
7793
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let _=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of _)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let _=z[2];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!Y.has(_))Z.push(_),Y.add(_)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function yK($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function PK($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function CK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of yK(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=PK(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let j=Object.keys(Z),_=Function(...j,`"use strict"; return (${B});`);Z[z]=_(...j.map((H)=>Z[H]))}catch{}}}catch{}}async function s$($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=U??h.dirname(X),B=[],j=(L)=>{if(L&&!B.includes(L))B.push(L)},_=Y.__originalFilePath;if(_)j(h.join(h.dirname(_),"components"));j(Z),j(Q._rootComponentsDir),j(h.join(h.dirname(X),"components")),j(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)j(typeof L==="string"?L:null);if(U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return i(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of W)if(await i(h.join(F,O)))return!0}return!1}function vK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function xK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function S1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (u5(),b$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=B&&B!=="load"&&vK(B)?B:"";try{let _=(d)=>d.split("-").map((S)=>S.charAt(0).toUpperCase()+S.slice(1)).join(""),H=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let d=[L,L.toLowerCase(),_(L),H(L)];for(let S of d)if(O.has(S)){F=O.get(S);break}}let V=[];if(!F){let d=[`${L}.stx`,`${_(L)}.stx`,`${H(L)}.stx`],S=[...new Set(d)],v=Q.__originalFilePath,x=[];if(v){let W0=h.join(h.dirname(v),"components");x.push(W0)}if(X)x.push(X);let u=G._rootComponentsDir;if(typeof u==="string"&&!x.includes(u))x.push(u);let r=h.join(h.dirname(J),"components");if(!x.includes(r))x.push(r);if(G.componentsDir&&G.componentsDir!==X&&!x.includes(G.componentsDir))x.push(G.componentsDir);let j0=G._pluginComponentDirs;if(Array.isArray(j0)){for(let W0 of j0)if(typeof W0==="string"&&!x.includes(W0))x.push(W0)}let E0=typeof G.root==="string"?h.resolve(G.root):void 0,S0=E0??h.dirname(J),n0=[];if(E0)n0.push(h.resolve(E0,"resources/views/components")),n0.push(h.resolve(E0,"resources/components")),n0.push(h.resolve(E0,"src/components")),n0.push(h.resolve(E0,"components"));n0.push(h.resolve(import.meta.dir,"components"));for(let W0 of n0)if(!x.includes(W0))x.push(W0);let O5=[...new Set(x.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(S0,W0)}))];if(x.length=0,x.push(...O5),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let W0 of x){if(!W0)continue;for(let Z1 of S){let o0=h.join(W0,Z1);if(V.push(o0),await i(o0)){F=o0;break}}if(F)break;if(!F)try{let Z1=await import("fs");if(!Z1.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let L5=8,Y1=[{path:W0,depth:0}];while(Y1.length>0&&!F){let l=Y1.pop();if(l.depth>=L5)continue;let s0;try{s0=Z1.readdirSync(l.path,{withFileTypes:!0})}catch{continue}for(let F5 of s0){if(!F5.isDirectory())continue;if(F5.name==="node_modules"||F5.name.startsWith("."))continue;let d6=h.join(l.path,F5.name);for(let CJ of S){let Y7=h.join(d6,CJ);if(V.push(Y7),await i(Y7)){F=Y7;break}}if(F)break;Y1.push({path:d6,depth:l.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let d=V.length>0?`
7760
7794
  Searched paths:
7761
7795
  ${V.map((S)=>` - ${S}`).join(`
7762
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(F);let w;if(o$.has(F))w=o$.get(F);else try{w=await Bun.file(F).text(),o$.set(F,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[d,S]of Object.entries(Q))if(!d.startsWith("__")||R.has(d))A[d]=S;let{extractSlotContent:N}=await Promise.resolve().then(() => (N7(),A7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[d,S]of T.namedSlots)M[d]=S.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...vK(Y)&&{__stx_force_signals:!0}};PK(w,I);let k=w,E=E$(k);if(E)k=E.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(C)],b=[];for(let d of D){let S=d[1]||"",v=d[2]||"",x=S.includes("server");if(T1(S)&&v.trim())v=M1(v);if(x&&v)try{await W(v,I,F)}catch(r){}if(!x){let r=v.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),j0=r.includes("{{")&&r.includes("}}"),E0=r.includes("{!!")&&r.includes("!!}");if(j0||E0)r=T$(r,I);let S0=S.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${S0}>${r}</script>`)}}let P=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),f=P?P[1]:"",g=P?P[2]:"",m="",a=f&&/\bscoped\b/i.test(f);if(P)m=`<style${f}>${g}</style>`;let X0=k;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,S=[];if(X0=X0.replace(d,(v,x)=>{let u=x.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(u)S.push(`<style${u[1]}>${u[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),S.length>0)m=`${m}${S.join(`
7763
- `)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:e0}=await Promise.resolve().then(() => (N7(),A7)),{defaultSlot:x0,namedSlots:N0}=T;X0=await e0(X0,x0,N0,I);for(let[d,S]of Object.entries(I))if(typeof S==="string"){if(S.includes("<")&&S.includes(">")||S.includes("&lt;")||S.includes("&quot;")){let v=j7(S);I[d]=v}}let Z0=b.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),R0=xK(b);if(R0.length>0)I.__stx_client_signal_names=R0;let d0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let $1=await V0(X0,I,F,d0,q),n0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let d of $1.matchAll(/\{\{([\s\S]*?)\}\}/g))n0.add(d[1].trim());if(n0.size>0)Q.__stx_preserved_client_expressions=[...n0];let s=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++DK}_${Math.random().toString(36).slice(2,8)}`,t=$1;if(Z0){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${x8(JSON.stringify(Z))}"`}catch{}let S=j?` stx-hydrate="${x8(j)}"`:"";t=`<div data-stx-scope="${s}"${d}${S}>${$1}</div>`;let v=await Promise.all(b.map(async(x)=>{let u=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!u)return x;let[,r,j0]=u,E0=H$(j0,{filePath:F,projectRoot:process.cwd()}),S0=E0.code,o0=O$(E0.styles),{hasUserImports:O5,bundleClientScript:W0}=await Promise.resolve().then(() => (E5(),I5));if(O5(S0))S0=await W0(S0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:Z1}=await Promise.resolve().then(() => (i5(),n$));S0=S0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(m0,i)=>Z1(i));let s0=u0(S0),L5=`
7796
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(F);let w;if(o$.has(F))w=o$.get(F);else try{w=await Bun.file(F).text(),o$.set(F,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[d,S]of Object.entries(Q))if(!d.startsWith("__")||R.has(d))A[d]=S;let{extractSlotContent:N}=await Promise.resolve().then(() => (N7(),A7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[d,S]of T.namedSlots)M[d]=S.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...xK(Y)&&{__stx_force_signals:!0}};CK(w,I);let k=w,E=E$(k);if(E)k=E.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(C)],b=[];for(let d of D){let S=d[1]||"",v=d[2]||"",x=S.includes("server");if(T1(S)&&v.trim())v=M1(v);if(x&&v)try{await W(v,I,F)}catch(r){}if(!x){let r=v.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),j0=r.includes("{{")&&r.includes("}}"),E0=r.includes("{!!")&&r.includes("!!}");if(j0||E0)r=T$(r,I);let S0=S.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${S0}>${r}</script>`)}}let P=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),f=P?P[1]:"",g=P?P[2]:"",m="",a=f&&/\bscoped\b/i.test(f);if(P)m=`<style${f}>${g}</style>`;let X0=k;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,S=[];if(X0=X0.replace(d,(v,x)=>{let u=x.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(u)S.push(`<style${u[1]}>${u[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),S.length>0)m=`${m}${S.join(`
7797
+ `)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:e0}=await Promise.resolve().then(() => (N7(),A7)),{defaultSlot:x0,namedSlots:N0}=T;X0=await e0(X0,x0,N0,I);for(let[d,S]of Object.entries(I))if(typeof S==="string"){if(S.includes("<")&&S.includes(">")||S.includes("&lt;")||S.includes("&quot;")){let v=j7(S);I[d]=v}}let Z0=b.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),R0=fK(b);if(R0.length>0)I.__stx_client_signal_names=R0;let d0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let $1=await V0(X0,I,F,d0,q),i0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let d of $1.matchAll(/\{\{([\s\S]*?)\}\}/g))i0.add(d[1].trim());if(i0.size>0)Q.__stx_preserved_client_expressions=[...i0];let s=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++kK}_${Math.random().toString(36).slice(2,8)}`,t=$1;if(Z0){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${x8(JSON.stringify(Z))}"`}catch{}let S=j?` stx-hydrate="${x8(j)}"`:"";t=`<div data-stx-scope="${s}"${d}${S}>${$1}</div>`;let v=await Promise.all(b.map(async(x)=>{let u=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!u)return x;let[,r,j0]=u,E0=H$(j0,{filePath:F,projectRoot:process.cwd()}),S0=E0.code,n0=O$(E0.styles),{hasUserImports:O5,bundleClientScript:W0}=await Promise.resolve().then(() => (E5(),I5));if(O5(S0))S0=await W0(S0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:Z1}=await Promise.resolve().then(() => (i5(),n$));S0=S0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(l,s0)=>Z1(s0));let o0=m0(S0),L5=SK(o0),Y1=`
7764
7798
  (function() {
7765
- ${n1("const",l9)}
7799
+ ${n1("const",[...l9,...L5])}
7766
7800
  const __scope = window.stx._scopes = window.stx._scopes || {};
7767
7801
  const __scopeVars = __scope['${s}'] = __scope['${s}'] || {};
7768
7802
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -7775,12 +7809,12 @@ ${V.map((S)=>` - ${S}`).join(`
7775
7809
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
7776
7810
 
7777
7811
  try {
7778
- ${s0}
7812
+ ${o0}
7779
7813
 
7780
7814
  // Register all defined signals and functions in this scope
7781
7815
  const __localVars = {};
7782
7816
  try {
7783
- ${bK(s0).map((m0)=>`if (typeof ${m0} !== 'undefined') __localVars['${m0}'] = ${m0};`).join(`
7817
+ ${L5.map((l)=>`if (typeof ${l} !== 'undefined') __localVars['${l}'] = ${l};`).join(`
7784
7818
  `)}
7785
7819
  }
7786
7820
  catch (e) {}
@@ -7789,13 +7823,13 @@ catch (e) {}
7789
7823
  finally {
7790
7824
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
7791
7825
  }
7792
- })();`;if(j)return`${o0}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${r}>${L5}</script>`;return`${o0}<script data-stx-scoped${r}>${L5}</script>`}));if(t=t+`
7826
+ })();`;if(j)return`${n0}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${r}>${Y1}</script>`;return`${n0}<script data-stx-scoped${r}>${Y1}</script>`}));if(t=t+`
7793
7827
  `+v.join(`
7794
7828
  `),m)t+=`
7795
7829
  `+m}else{if(m)t+=`
7796
7830
  `+m;if(b.length>0){let d=I.__stx_event_bindings||[],S=k5(I),v=await Promise.all(b.map(async(x)=>{let u=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!u)return x;return await b5(u[1],{eventBindings:d,templateContent:t,filePath:F,projectRoot:process.cwd(),serverData:S})}));t+=`
7797
7831
  `+v.join(`
7798
- `),I.__stx_event_bindings=[]}}if(a){let d=I$(t,F);if(d.hasScoped)t=d.html}return t}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function f7($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function g7($,Z,Y,X){let Q=await fK($,Z,Y,X);if(Q===null)return null;let J=f7(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(f7(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function fK($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),j=f7(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&X)X.add(j);return j}let G=h.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await c(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=h.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let j=h.join(q,"layouts"),_=!1;try{_=EK.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){K=j;break}let H=h.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=h.join(K,B);if(await c(j)){if(Y.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(B,j);if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let H=`${_}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await c(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in layouts path with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let B=h.join(K,$);if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function f8($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7832
+ `),I.__stx_event_bindings=[]}}if(a){let d=I$(t,F);if(d.hasScoped)t=d.html}return t}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function f7($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function g7($,Z,Y,X){let Q=await gK($,Z,Y,X);if(Q===null)return null;let J=f7(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(f7(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function gK($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),j=f7(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${j}`);if(await i(j)&&X)X.add(j);return j}let G=h.join(Q,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await i(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=h.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let j=h.join(q,"layouts"),_=!1;try{_=DK.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){K=j;break}let H=h.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=h.join(K,B);if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let _=`${j}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(B,j);if(await i(_)){if(Y.debug)console.log(`Found in options.layoutsDir: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let H=`${_}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await i(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let _=`${j}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in layouts path with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function f8($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7799
7833
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,B)=>{let j=W+B+1;return`${j===X?"> ":" "}${j}: ${z}`}).join(`
7800
7834
  `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return f8($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function K0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=f8(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
7801
7835
  `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
@@ -7810,8 +7844,8 @@ ${e.yellow}${e.bold}Message:${e.reset} ${Z}
7810
7844
  `,K)U+=`
7811
7845
  ${e.blue}${e.bold}Context:${e.reset}
7812
7846
  ${e.dim}${K}${e.reset}
7813
- `;return U}function w8(){o$.clear()}var o$,DK=0,e;var O0=y(()=>{S5();r0();x5();r1();r$();A1();L7();F7();r9();u5();o$=new f5(500);e={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 g8($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,j=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
7814
- `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){j=F;break}B=F+12}}if(j===-1)continue;let _=$.slice(U,j),H=$.slice(K,j+12);Q.push({fullMatch:H,options:W,content:_,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((_)=>{let H=_.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},j=M5(W.trim(),B);X=X.split(K).join(j)}catch(z){let B=z instanceof Error?z.message:String(z),j=K0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(j)}return X}async function h8($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),M5($.trim(),Q)}var h7=y(()=>{O0()});function dK($){if(gK.set($.name,$),$.client)hK.set($.name,$.client)}function a$($){return dK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=mK(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function mK($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var gK,hK;var d7=y(()=>{gK=new Map,hK=new Map});function m7($,Z=e1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${o5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function d8($,Z,Y=uK,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${o5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function u7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function o5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function l7($){return lK[$]||"application/octet-stream"}var e1,uK,n5,lK;var p7=y(()=>{e1=[320,480,640,768,1024,1280,1536,1920,2560],uK=[1,1.5,2,3],n5=["avif","webp","jpeg"],lK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function cK(){try{return await import("ts-images")}catch{return null}}async function iK($,Z={}){let Y={...pK,...Z},X=await cK();if(X)try{return await nK($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return oK($,Y)}async function nK($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function oK($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function m8($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
7847
+ `;return U}function w8(){o$.clear()}var o$,kK=0,e;var O0=y(()=>{S5();r0();x5();r1();r$();A1();L7();F7();r9();u5();o$=new f5(500);e={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 g8($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,j=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
7848
+ `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){j=F;break}B=F+12}}if(j===-1)continue;let _=$.slice(U,j),H=$.slice(K,j+12);Q.push({fullMatch:H,options:W,content:_,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((_)=>{let H=_.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},j=M5(W.trim(),B);X=X.split(K).join(j)}catch(z){let B=z instanceof Error?z.message:String(z),j=K0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(j)}return X}async function h8($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),M5($.trim(),Q)}var h7=y(()=>{O0()});function mK($){if(hK.set($.name,$),$.client)dK.set($.name,$.client)}function a$($){return mK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=uK(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function uK($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var hK,dK;var d7=y(()=>{hK=new Map,dK=new Map});function m7($,Z=e1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${o5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function d8($,Z,Y=lK,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${o5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function u7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function o5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function l7($){return pK[$]||"application/octet-stream"}var e1,lK,n5,pK;var p7=y(()=>{e1=[320,480,640,768,1024,1280,1536,1920,2560],lK=[1,1.5,2,3],n5=["avif","webp","jpeg"],pK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function iK(){try{return await import("ts-images")}catch{return null}}async function nK($,Z={}){let Y={...cK,...Z},X=await iK();if(X)try{return await oK($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return sK($,Y)}async function oK($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function sK($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function m8($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
7815
7849
  #${$} {
7816
7850
  --stx-img-transition-duration: ${X}ms;
7817
7851
  --stx-img-transition-easing: ${Q};
@@ -7828,7 +7862,7 @@ ${e.dim}${K}${e.reset}
7828
7862
  #${$}.stx-img-loaded img {
7829
7863
  opacity: 1;
7830
7864
  }
7831
- `.trim()}async function u8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(c7.has(Y))return c7.get(Y);let X=await iK($,Z);return c7.set(Y,X),X}var pK,i7,c7;var l8=y(()=>{pK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},i7=`
7865
+ `.trim()}async function u8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(c7.has(Y))return c7.get(Y);let X=await nK($,Z);return c7.set(Y,X),X}var cK,i7,c7;var l8=y(()=>{cK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},i7=`
7832
7866
  .stx-img-placeholder {
7833
7867
  position: relative;
7834
7868
  overflow: hidden;
@@ -7857,8 +7891,8 @@ ${e.dim}${K}${e.reset}
7857
7891
  filter: blur(0);
7858
7892
  transform: scale(1);
7859
7893
  }
7860
- `.trim();c7=new Map});import{createHash as c8}from"crypto";import{readFile as sK,stat as i8}from"fs/promises";async function T0($){try{let Z=await sK($);return c8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function p8($){return c8("sha256").update($).digest("hex").slice(0,16)}function t$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${p8($)}-${p8(Y)}`}async function n7($){try{return(await i8($)).mtimeMs}catch{return 0}}async function A0($){try{return await i8($),!0}catch{return!1}}var y1=()=>{};import{mkdir as rK,readFile as aK,writeFile as tK,readdir as QO,rm as eK,stat as GO}from"fs/promises";import{join as o8,dirname as $q}from"path";async function Zq($){try{await rK($,{recursive:!0})}catch{}}function s8($,Z,Y){return o8($,Y,`${Z}.json`)}async function n8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await n7(Z)!==$.srcMtime)return!1;return!0}async function e$($,Z,Y,X=o7){if(!X.enabled)return null;let Q=t$($,Z),J=$5.get(Q);if(J){if(await n8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;$5.delete(Q)}let G=s8(X.directory,Q,Y);if(await A0(G))try{let K=await aK(G,"utf-8"),q=JSON.parse(K);if(await n8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),$5.set(Q,q),q.data}catch{}return null}async function $4($,Z,Y,X,Q=o7){if(!Q.enabled)return;let J=t$($,Z),G=await T0($),K=await n7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:t$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};$5.set(J,q);let W=s8(Q.directory,J,X);try{await Zq($q(W)),await tK(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function Z4($,Z=o7){if($==="all")$5.clear();else $5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=o8(Z.directory,X);try{await eK(Q,{recursive:!0,force:!0})}catch{}}}var $5,o7;var s7=y(()=>{y1();$5=new Map,o7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class X4{config;constructor($={}){this.config={...Yq,...$}}async get($,Z){return e$($,Z,"image",this.config)}async set($,Z,Y){return $4($,Z,Y,"image",this.config)}async clear(){return Z4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function r7($){if(!Y4)Y4=new X4($);else if($)Y4.updateConfig($);return Y4}async function J4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return r7(X).get($,Z)}async function Q4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return r7(Q).set($,Z,Y)}async function r8(){return r7().clear()}var Yq,Y4=null;var a7=y(()=>{s7();Yq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Xq,basename as Jq,extname as Qq,join as Gq}from"path";import{mkdir as Kq}from"fs/promises";async function t7(){try{return await import("ts-images")}catch{return null}}function a8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function qq($,Z){let Y=Z?a8(Z):a8("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function t8($,Z,Y){let X=await t7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await J4($,Z,Y);if(Q)return Q;try{let J=Xq($);if(!await A0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=qq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await Kq(K,{recursive:!0});let W=await T0(J),U=Jq($,Qq($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},j=null;if(Z.transformations&&Z.transformations.length>0)j=await e7(J,Z.transformations,X);for(let _ of z){let H=G[_]||{},L=`${U}-${W}.${_}`,F=Gq(K,L);try{let O=await X.optimizeImage({input:j||J,output:F,format:_,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:_,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${_}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let _=await X.generateThumbHash(J);B.placeholder=_.dataUrl}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${_}`)}if(Z.useDominantColor)try{let _=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=_.dominantColor}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${_}`)}return await Q4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function e8($,Z,Y,X){let Q=await t7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function e7($,Z,Y){let X=Y||await t7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var $Z=y(()=>{y1();a7()});import{resolve as Wq,basename as Uq,extname as zq,join as Bq}from"path";import{mkdir as jq}from"fs/promises";async function _q(){try{return await import("ts-images")}catch{return null}}async function ZZ($,Z,Y){let X=await _q();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Wq($);if(!await A0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||Hq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await jq(K,{recursive:!0});let W=await T0(Q),U=Uq($,zq($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let _ of G){B.byFormat[_]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${_}`,O=Bq(K,F),V=`${q}/${F}`;try{let w=z[_]?.quality||80;if(await A0(O)){B.byFormat[_].push({path:O,url:V,width:L,height:0,format:_,size:0}),H.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:O,format:_,quality:w,resize:{width:L}});if(R)B.byFormat[_].push({path:O,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:_,size:R.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${_} at ${L}w: ${w}`)}}B.srcsets[_]=H.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let _=await X.generateThumbHash(Q);B.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:j}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return B.sizes=Z.sizes||Oq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function Oq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function YZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var Hq;var XZ=y(()=>{y1();Hq=[320,480,640,768,1024,1280,1536,1920]});var JZ={};o(JZ,{setCachedImageResult:()=>Q4,processImage:()=>t8,optimizeImage:()=>e8,getCachedImageResult:()=>J4,generateSrcset:()=>YZ,generateResponsiveVariants:()=>ZZ,clearImageCache:()=>r8,applyTransformations:()=>e7,ImageProcessorCache:()=>X4});var QZ=y(()=>{$Z();XZ();a7()});async function Lq(){try{return await Promise.resolve().then(() => (QZ(),JZ))}catch($){if(!GZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),GZ=!0;return null}}async function G4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return Rq(X,Y)}if(Y.processedResult?.processed)return X3($,Y.processedResult,Z);if(Y.responsiveVariants)return UZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=e1,dpr:U,formats:z=n5,quality:B=$3,params:j={},placeholder:_="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":q4,decoding:V=K4,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,k=$.id,E=$.data||{},{isDev:C=!1,baseUrl:D=""}=Z;if(C&&!Z.optimize)return wq($);let b,P,f=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!F)try{b=await u8(Q,{strategy:_,...H}),P=m8(f,b,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=Vq($,f,b,Z);else m=await Fq($,f,b,Z);let a;if(F){let x0=z.includes("webp")?"webp":z[0],N0=m7(Q,W,{...j,q:B},x0),Z0=typeof q==="object"?u7(q):q||"100vw";a=`<link rel="preload" as="image" imagesrcset="${N0}" imagesizes="${Z0}" />`}let X0=[];if(!KZ&&_!=="none")X0.push(i7),KZ=!0;if(P)X0.push(P);let e0=L?WZ(f):void 0;return{html:m,preloadLink:a,css:X0.length>0?X0.join(`
7861
- `):void 0,script:e0}}async function Fq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=e1,formats:U=n5,quality:z=$3,params:B={},lazy:j=!0,priority:_=!1,loading:H=_?"eager":q4,decoding:L=K4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?u7(q):q||"100vw",I=[];for(let C of U){let D=m7(Q,W,{...B,q:z},C),b=l7(C);if(j&&!_)I.push(` <source type="${b}" data-srcset="${D}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${D}" sizes="${M}" />`)}let k=Z3({src:o5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:_?void 0:H,decoding:L,fetchpriority:_?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:qZ(A,Y),style:Y3(N,O,V,Y),lazy:j&&!_,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
7894
+ `.trim();c7=new Map});import{createHash as c8}from"crypto";import{readFile as rK,stat as i8}from"fs/promises";async function T0($){try{let Z=await rK($);return c8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function p8($){return c8("sha256").update($).digest("hex").slice(0,16)}function t$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${p8($)}-${p8(Y)}`}async function n7($){try{return(await i8($)).mtimeMs}catch{return 0}}async function A0($){try{return await i8($),!0}catch{return!1}}var y1=()=>{};import{mkdir as aK,readFile as tK,writeFile as eK,readdir as QO,rm as $q,stat as GO}from"fs/promises";import{join as o8,dirname as Zq}from"path";async function Yq($){try{await aK($,{recursive:!0})}catch{}}function s8($,Z,Y){return o8($,Y,`${Z}.json`)}async function n8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await n7(Z)!==$.srcMtime)return!1;return!0}async function e$($,Z,Y,X=o7){if(!X.enabled)return null;let Q=t$($,Z),J=$5.get(Q);if(J){if(await n8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;$5.delete(Q)}let G=s8(X.directory,Q,Y);if(await A0(G))try{let K=await tK(G,"utf-8"),q=JSON.parse(K);if(await n8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),$5.set(Q,q),q.data}catch{}return null}async function $4($,Z,Y,X,Q=o7){if(!Q.enabled)return;let J=t$($,Z),G=await T0($),K=await n7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:t$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};$5.set(J,q);let W=s8(Q.directory,J,X);try{await Yq(Zq(W)),await eK(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function Z4($,Z=o7){if($==="all")$5.clear();else $5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=o8(Z.directory,X);try{await $q(Q,{recursive:!0,force:!0})}catch{}}}var $5,o7;var s7=y(()=>{y1();$5=new Map,o7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class X4{config;constructor($={}){this.config={...Xq,...$}}async get($,Z){return e$($,Z,"image",this.config)}async set($,Z,Y){return $4($,Z,Y,"image",this.config)}async clear(){return Z4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function r7($){if(!Y4)Y4=new X4($);else if($)Y4.updateConfig($);return Y4}async function J4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return r7(X).get($,Z)}async function Q4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return r7(Q).set($,Z,Y)}async function r8(){return r7().clear()}var Xq,Y4=null;var a7=y(()=>{s7();Xq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Jq,basename as Qq,extname as Gq,join as Kq}from"path";import{mkdir as qq}from"fs/promises";async function t7(){try{return await import("ts-images")}catch{return null}}function a8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function Wq($,Z){let Y=Z?a8(Z):a8("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function t8($,Z,Y){let X=await t7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await J4($,Z,Y);if(Q)return Q;try{let J=Jq($);if(!await A0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=Wq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await qq(K,{recursive:!0});let W=await T0(J),U=Qq($,Gq($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},j=null;if(Z.transformations&&Z.transformations.length>0)j=await e7(J,Z.transformations,X);for(let _ of z){let H=G[_]||{},L=`${U}-${W}.${_}`,F=Kq(K,L);try{let O=await X.optimizeImage({input:j||J,output:F,format:_,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:_,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${_}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let _=await X.generateThumbHash(J);B.placeholder=_.dataUrl}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${_}`)}if(Z.useDominantColor)try{let _=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=_.dominantColor}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${_}`)}return await Q4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function e8($,Z,Y,X){let Q=await t7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function e7($,Z,Y){let X=Y||await t7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var $Z=y(()=>{y1();a7()});import{resolve as Uq,basename as zq,extname as Bq,join as jq}from"path";import{mkdir as _q}from"fs/promises";async function Hq(){try{return await import("ts-images")}catch{return null}}async function ZZ($,Z,Y){let X=await Hq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Uq($);if(!await A0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||Oq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await _q(K,{recursive:!0});let W=await T0(Q),U=zq($,Bq($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let _ of G){B.byFormat[_]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${_}`,O=jq(K,F),V=`${q}/${F}`;try{let w=z[_]?.quality||80;if(await A0(O)){B.byFormat[_].push({path:O,url:V,width:L,height:0,format:_,size:0}),H.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:O,format:_,quality:w,resize:{width:L}});if(R)B.byFormat[_].push({path:O,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:_,size:R.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${_} at ${L}w: ${w}`)}}B.srcsets[_]=H.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let _=await X.generateThumbHash(Q);B.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:j}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return B.sizes=Z.sizes||Lq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function Lq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function YZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var Oq;var XZ=y(()=>{y1();Oq=[320,480,640,768,1024,1280,1536,1920]});var JZ={};o(JZ,{setCachedImageResult:()=>Q4,processImage:()=>t8,optimizeImage:()=>e8,getCachedImageResult:()=>J4,generateSrcset:()=>YZ,generateResponsiveVariants:()=>ZZ,clearImageCache:()=>r8,applyTransformations:()=>e7,ImageProcessorCache:()=>X4});var QZ=y(()=>{$Z();XZ();a7()});async function Fq(){try{return await Promise.resolve().then(() => (QZ(),JZ))}catch($){if(!GZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),GZ=!0;return null}}async function G4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return Aq(X,Y)}if(Y.processedResult?.processed)return X3($,Y.processedResult,Z);if(Y.responsiveVariants)return UZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=e1,dpr:U,formats:z=n5,quality:B=$3,params:j={},placeholder:_="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":q4,decoding:V=K4,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,k=$.id,E=$.data||{},{isDev:C=!1,baseUrl:D=""}=Z;if(C&&!Z.optimize)return Rq($);let b,P,f=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!F)try{b=await u8(Q,{strategy:_,...H}),P=m8(f,b,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=wq($,f,b,Z);else m=await Vq($,f,b,Z);let a;if(F){let x0=z.includes("webp")?"webp":z[0],N0=m7(Q,W,{...j,q:B},x0),Z0=typeof q==="object"?u7(q):q||"100vw";a=`<link rel="preload" as="image" imagesrcset="${N0}" imagesizes="${Z0}" />`}let X0=[];if(!KZ&&_!=="none")X0.push(i7),KZ=!0;if(P)X0.push(P);let e0=L?WZ(f):void 0;return{html:m,preloadLink:a,css:X0.length>0?X0.join(`
7895
+ `):void 0,script:e0}}async function Vq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=e1,formats:U=n5,quality:z=$3,params:B={},lazy:j=!0,priority:_=!1,loading:H=_?"eager":q4,decoding:L=K4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?u7(q):q||"100vw",I=[];for(let C of U){let D=m7(Q,W,{...B,q:z},C),b=l7(C);if(j&&!_)I.push(` <source type="${b}" data-srcset="${D}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${D}" sizes="${M}" />`)}let k=Z3({src:o5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:_?void 0:H,decoding:L,fetchpriority:_?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:qZ(A,Y),style:Y3(N,O,V,Y),lazy:j&&!_,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
7862
7896
  <picture>
7863
7897
  ${I.join(`
7864
7898
  `)}
@@ -7868,9 +7902,9 @@ ${I.join(`
7868
7902
  ${I.join(`
7869
7903
  `)}
7870
7904
  <img ${k} />
7871
- </picture>`;return E}function Vq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=$3,params:U={},lazy:z=!0,priority:B=!1,loading:j=B?"eager":q4,decoding:_=K4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=d8(Q,N,q,{...U,q:W}),M=Z3({src:o5(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:_,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:qZ(w,Y),style:Y3(R,L,F,Y),lazy:z&&!B,data:A}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
7905
+ </picture>`;return E}function wq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=$3,params:U={},lazy:z=!0,priority:B=!1,loading:j=B?"eager":q4,decoding:_=K4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=d8(Q,N,q,{...U,q:W}),M=Z3({src:o5(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:_,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:qZ(w,Y),style:Y3(R,L,F,Y),lazy:z&&!B,data:A}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
7872
7906
  <img ${M} ${I} />
7873
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function wq($){let{src:Z,alt:Y,width:X,height:Q,loading:J=q4,decoding:G=K4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,j=$.class,_=$.style,H=$.id,L=$.data||{};return{html:`<img ${Z3({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:j,style:Y3(_,q,W),id:H,data:L})} />`}}function Z3($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${p0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function qZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function Y3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WZ($){return`
7907
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function Rq($){let{src:Z,alt:Y,width:X,height:Q,loading:J=q4,decoding:G=K4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,j=$.class,_=$.style,H=$.id,L=$.data||{};return{html:`<img ${Z3({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:j,style:Y3(_,q,W),id:H,data:L})} />`}}function Z3($){let Z=[];if($.lazy)Z.push(`data-src="${l0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${l0($.src)}"`);if(Z.push(`alt="${l0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${l0($.className)}"`);if($.style)Z.push(`style="${l0($.style)}"`);if($.id)Z.push(`id="${l0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${l0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function qZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function Y3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function l0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WZ($){return`
7874
7908
  (function() {
7875
7909
  const container = document.getElementById('${$}');
7876
7910
  if (!container) return;
@@ -7907,7 +7941,7 @@ ${I.join(`
7907
7941
 
7908
7942
  observer.observe(container);
7909
7943
  })();
7910
- `.trim()}async function Rq($,Z){let Y=await Lq();if(!Y)return G4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return UZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return X3($,J,Z)}return G4({...$,process:!1},Z)}async function X3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,j=$.style,_=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),w=new Map;for(let P of L){if(!w.has(P.format))w.set(P.format,[]);w.get(P.format).push(P)}let R=[],A=["avif","webp","jpeg","png"];for(let P of A){let f=w.get(P);if(f&&f.length>0){let g=f.map((a)=>`${a.url} ${a.width}w`).join(", "),m=l7(P);if(G&&!K)R.push(` <source type="${m}" data-srcset="${g}" />`);else R.push(` <source type="${m}" srcset="${g}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${p0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${p0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${p0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)N.push(`style="${I.join("; ")}"`);let k=[];if(B)k.push(B);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[P,f]of Object.entries(H))N.push(`data-${P}="${p0(f)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${_}" class="stx-img-placeholder" style="${P}">
7944
+ `.trim()}async function Aq($,Z){let Y=await Fq();if(!Y)return G4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return UZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return X3($,J,Z)}return G4({...$,process:!1},Z)}async function X3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,j=$.style,_=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),w=new Map;for(let P of L){if(!w.has(P.format))w.set(P.format,[]);w.get(P.format).push(P)}let R=[],A=["avif","webp","jpeg","png"];for(let P of A){let f=w.get(P);if(f&&f.length>0){let g=f.map((a)=>`${a.url} ${a.width}w`).join(", "),m=l7(P);if(G&&!K)R.push(` <source type="${m}" data-srcset="${g}" />`);else R.push(` <source type="${m}" srcset="${g}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${l0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${l0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${l0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)N.push(`style="${I.join("; ")}"`);let k=[];if(B)k.push(B);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[P,f]of Object.entries(H))N.push(`data-${P}="${l0(f)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${_}" class="stx-img-placeholder" style="${P}">
7911
7945
  <picture>
7912
7946
  ${R.join(`
7913
7947
  `)}
@@ -7918,11 +7952,11 @@ ${R.join(`
7918
7952
  `)}
7919
7953
  <img ${N.join(" ")} />
7920
7954
  </picture>`;let C=[];if(Z.placeholder)C.push(i7);let D=G?WZ(_):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:b,css:C.length>0?C.join(`
7921
- `):void 0,script:D}}async function UZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return X3($,X,Y)}var GZ=!1,$3=80,K4="async",q4="lazy",KZ=!1;var zZ=y(()=>{p7();l8()});function Aq(){return a$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=Nq($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||e1,formats:G.formats||n5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await G4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
7955
+ `):void 0,script:D}}async function UZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return X3($,X,Y)}var GZ=!1,$3=80,K4="async",q4="lazy",KZ=!1;var zZ=y(()=>{p7();l8()});function Nq(){return a$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=Tq($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||e1,formats:G.formats||n5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await G4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
7922
7956
  `+U;if(W.css)U+=`
7923
7957
  <style>${W.css}</style>`;if(W.script)U+=`
7924
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Nq($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=Tq(X),J=J3(Q[0],Y)||"",G=J3(Q[1],Y)||"",K={};if(Q[2]){let q=J3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function Tq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function J3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var BZ;var jZ=y(()=>{d7();zZ();p7();BZ=Aq()});class U4{config;constructor($={}){this.config={...Mq,...$}}async get($,Z){return e$($,Z,"video",this.config)}async set($,Z,Y){return $4($,Z,Y,"video",this.config)}async clear(){return Z4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function Q3($){if(!W4)W4=new U4($);else if($)W4.updateConfig($);return W4}async function z4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Q3(X).get($,Z)}async function B4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Q3(Q).set($,Z,Y)}async function _Z(){return Q3().clear()}var Mq,W4=null;var G3=y(()=>{s7();Mq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as K3,basename as q3,extname as W3,join as j4}from"path";import{mkdir as U3}from"fs/promises";async function z3(){try{return await import("ts-videos")}catch{return null}}async function _4($,Z,Y,X){let Q=await z3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=K3($);if(!await A0(J))return null;await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=j4(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:z,url:`${X}/${U}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:W,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function H4($,Z,Y,X){let Q=await z3();if(!Q)return[];try{let J=K3($);if(!await A0(J))return[];await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,j=Z.interval||z/B,_=[];for(let L=0;L<B&&L*j<z;L++)_.push(L*j);let H=await Q.extractThumbnails(J,{timestamps:_,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||j4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:_[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function HZ($,Z,Y,X){let Q=await z3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=K3($);if(!await A0(J))return null;await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,j=Z.thumbnailWidth||160,_=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=j4(Y,O),w=[];for(let A=0;A<L;A++)w.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:w,width:j,height:_,format:H,quality:Z.quality||70,outputDir:j4(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=z*j,T=F*_,M=await A.createSprite({images:R.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:j,thumbnailHeight:_,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var B3=y(()=>{y1()});import{resolve as LZ,basename as FZ,extname as VZ,join as P1}from"path";import{mkdir as O4,writeFile as wZ}from"fs/promises";async function RZ(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,X,Q){let J=await RZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=LZ($);if(!await A0(G))return null;let K=await T0(G),q=FZ($,VZ($)),W=P1(Y,`${q}-${K}-hls`);await O4(W,{recursive:!0});let U=Z.length>0?Z:AZ,z=Q?.segmentDuration||6,_=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=P1(W,V.label);await O4(w,{recursive:!0});let R=`${V.label}.m3u8`,A=P1(w,R);try{let N=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=N.segmentCount||Math.ceil(_/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=P1(W,"master.m3u8"),O=Iq(H,X,q,K);return await wZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function Iq($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
7925
- `)}async function F4($,Z,Y,X,Q){let J=await RZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=LZ($);if(!await A0(G))return null;let K=await T0(G),q=FZ($,VZ($)),W=P1(Y,`${q}-${K}-dash`);await O4(W,{recursive:!0});let U=Z.length>0?Z:AZ,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=P1(W,R.label);await O4(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${N}`)}}if(L.length===0)return null;let O=P1(W,"manifest.mpd"),V=Eq(L,F,H,z,B);await wZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function Eq($,Z,Y,X,Q){let J=OZ(Y),G=OZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
7958
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Tq($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=Mq(X),J=J3(Q[0],Y)||"",G=J3(Q[1],Y)||"",K={};if(Q[2]){let q=J3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function Mq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function J3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var BZ;var jZ=y(()=>{d7();zZ();p7();BZ=Nq()});class U4{config;constructor($={}){this.config={...Iq,...$}}async get($,Z){return e$($,Z,"video",this.config)}async set($,Z,Y){return $4($,Z,Y,"video",this.config)}async clear(){return Z4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function Q3($){if(!W4)W4=new U4($);else if($)W4.updateConfig($);return W4}async function z4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Q3(X).get($,Z)}async function B4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Q3(Q).set($,Z,Y)}async function _Z(){return Q3().clear()}var Iq,W4=null;var G3=y(()=>{s7();Iq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as K3,basename as q3,extname as W3,join as j4}from"path";import{mkdir as U3}from"fs/promises";async function z3(){try{return await import("ts-videos")}catch{return null}}async function _4($,Z,Y,X){let Q=await z3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=K3($);if(!await A0(J))return null;await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=j4(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:z,url:`${X}/${U}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:W,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function H4($,Z,Y,X){let Q=await z3();if(!Q)return[];try{let J=K3($);if(!await A0(J))return[];await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,j=Z.interval||z/B,_=[];for(let L=0;L<B&&L*j<z;L++)_.push(L*j);let H=await Q.extractThumbnails(J,{timestamps:_,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||j4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:_[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function HZ($,Z,Y,X){let Q=await z3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=K3($);if(!await A0(J))return null;await U3(Y,{recursive:!0});let G=await T0(J),K=q3($,W3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,j=Z.thumbnailWidth||160,_=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=j4(Y,O),w=[];for(let A=0;A<L;A++)w.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:w,width:j,height:_,format:H,quality:Z.quality||70,outputDir:j4(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=z*j,T=F*_,M=await A.createSprite({images:R.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:j,thumbnailHeight:_,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var B3=y(()=>{y1()});import{resolve as LZ,basename as FZ,extname as VZ,join as P1}from"path";import{mkdir as O4,writeFile as wZ}from"fs/promises";async function RZ(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,X,Q){let J=await RZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=LZ($);if(!await A0(G))return null;let K=await T0(G),q=FZ($,VZ($)),W=P1(Y,`${q}-${K}-hls`);await O4(W,{recursive:!0});let U=Z.length>0?Z:AZ,z=Q?.segmentDuration||6,_=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=P1(W,V.label);await O4(w,{recursive:!0});let R=`${V.label}.m3u8`,A=P1(w,R);try{let N=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=N.segmentCount||Math.ceil(_/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=P1(W,"master.m3u8"),O=Eq(H,X,q,K);return await wZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function Eq($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
7959
+ `)}async function F4($,Z,Y,X,Q){let J=await RZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=LZ($);if(!await A0(G))return null;let K=await T0(G),q=FZ($,VZ($)),W=P1(Y,`${q}-${K}-dash`);await O4(W,{recursive:!0});let U=Z.length>0?Z:AZ,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=P1(W,R.label);await O4(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${N}`)}}if(L.length===0)return null;let O=P1(W,"manifest.mpd"),V=Dq(L,F,H,z,B);await wZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function Dq($,Z,Y,X,Q){let J=OZ(Y),G=OZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
7926
7960
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
7927
7961
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7928
7962
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -7948,7 +7982,7 @@ ${R.join(`
7948
7982
  </Representation>
7949
7983
  `}K+=` </AdaptationSet>
7950
7984
  `}return K+=` </Period>
7951
- </MPD>`,K}function OZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var AZ;var j3=y(()=>{y1();AZ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as NZ,basename as Dq,extname as kq,join as bq}from"path";import{mkdir as Sq}from"fs/promises";async function TZ(){try{return await import("ts-videos")}catch{return null}}function yq($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Pq($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _3($){let Z=await TZ();if(!Z)return null;try{let Y=NZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function MZ($,Z,Y,X){let Q=await TZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await z4($,Z,Y);if(J)return J;try{let G=NZ($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await Sq(K,{recursive:!0});let W=await T0(G),U=Dq($,kq($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await _3(G)||void 0;let B={};if(Z.quality)B.bitrate=yq(Z.quality);if(Z.platform)Object.assign(B,Pq(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${W}.mp4`,_=bq(K,j);try{let H=await Cq(G,_,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:_,url:`${q}/${j}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},_=await _4(G,j,K,q);if(_)z.poster=_}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await H4(G,Y.thumbnails,K,q);if(j.length>0)z.thumbnails=j}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let _=await L4(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)z.streaming={...z.streaming,hls:_}}if(j.format==="dash"){let _=await F4(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)z.streaming={...z.streaming,dash:_}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await B4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function Cq($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var IZ=y(()=>{y1();G3();B3();j3()});var EZ={};o(EZ,{setCachedVideoResult:()=>B4,processVideo:()=>MZ,getCachedVideoResult:()=>z4,generateThumbnails:()=>H4,generateSpriteSheet:()=>HZ,generatePoster:()=>_4,generateHLSManifest:()=>L4,generateDASHManifest:()=>F4,clearVideoCache:()=>_Z,analyzeVideo:()=>_3,VideoProcessorCache:()=>U4});var DZ=y(()=>{IZ();B3();j3();G3()});async function bZ(){try{return await Promise.resolve().then(() => (DZ(),EZ))}catch($){if(!kZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),kZ=!0;return null}}async function V4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return dq(X,Y)}if(Y.processedResult?.processed)return CZ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await mq(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=SZ,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:j=yZ,playsinline:_=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return fq($,Z);if(F&&F!=="video")return xq(J||"",F,$);let k=G.length>0?G:J?[{src:J,type:PZ(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(_)E.push("playsinline");if(R)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${j}"`),E.push('preload="none"'),N)E.push(`data-poster="${B0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${j}"`),N)E.push(`poster="${B0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(M)E.push(`style="${B0(M)}"`);let C=k.map((P)=>{return` <source ${H?`data-src="${B0(P.src)}"`:`src="${B0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
7985
+ </MPD>`,K}function OZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var AZ;var j3=y(()=>{y1();AZ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as NZ,basename as kq,extname as bq,join as Sq}from"path";import{mkdir as yq}from"fs/promises";async function TZ(){try{return await import("ts-videos")}catch{return null}}function Pq($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Cq($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _3($){let Z=await TZ();if(!Z)return null;try{let Y=NZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function MZ($,Z,Y,X){let Q=await TZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await z4($,Z,Y);if(J)return J;try{let G=NZ($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await yq(K,{recursive:!0});let W=await T0(G),U=kq($,bq($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await _3(G)||void 0;let B={};if(Z.quality)B.bitrate=Pq(Z.quality);if(Z.platform)Object.assign(B,Cq(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${W}.mp4`,_=Sq(K,j);try{let H=await vq(G,_,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:_,url:`${q}/${j}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},_=await _4(G,j,K,q);if(_)z.poster=_}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await H4(G,Y.thumbnails,K,q);if(j.length>0)z.thumbnails=j}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let _=await L4(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)z.streaming={...z.streaming,hls:_}}if(j.format==="dash"){let _=await F4(G,j.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)z.streaming={...z.streaming,dash:_}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await B4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function vq($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var IZ=y(()=>{y1();G3();B3();j3()});var EZ={};o(EZ,{setCachedVideoResult:()=>B4,processVideo:()=>MZ,getCachedVideoResult:()=>z4,generateThumbnails:()=>H4,generateSpriteSheet:()=>HZ,generatePoster:()=>_4,generateHLSManifest:()=>L4,generateDASHManifest:()=>F4,clearVideoCache:()=>_Z,analyzeVideo:()=>_3,VideoProcessorCache:()=>U4});var DZ=y(()=>{IZ();B3();j3();G3()});async function bZ(){try{return await Promise.resolve().then(() => (DZ(),EZ))}catch($){if(!kZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),kZ=!0;return null}}async function V4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return mq(X,Y)}if(Y.processedResult?.processed)return CZ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await uq(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=SZ,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:j=yZ,playsinline:_=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return gq($,Z);if(F&&F!=="video")return fq(J||"",F,$);let k=G.length>0?G:J?[{src:J,type:PZ(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(_)E.push("playsinline");if(R)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${j}"`),E.push('preload="none"'),N)E.push(`data-poster="${B0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${j}"`),N)E.push(`poster="${B0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(M)E.push(`style="${B0(M)}"`);let C=k.map((P)=>{return` <source ${H?`data-src="${B0(P.src)}"`:`src="${B0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
7952
7986
  `),D=`<video ${E.join(" ")}>
7953
7987
  ${C}
7954
7988
  Your browser does not support the video tag.
@@ -7987,9 +8021,9 @@ ${C}
7987
8021
 
7988
8022
  observer.observe(video);
7989
8023
  })();
7990
- `.trim();return{html:D,script:b}}function xq($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=gq($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=hq($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
8024
+ `.trim();return{html:D,script:b}}function fq($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=hq($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=dq($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
7991
8025
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
7992
- </div>`}}function fq($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:j}=$,_=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",H||""].filter(Boolean).join("; "),V=`
8026
+ </div>`}}function gq($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:j}=$,_=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",H||""].filter(Boolean).join("; "),V=`
7993
8027
  <div
7994
8028
  id="${L}"
7995
8029
  class="ts-video-player${_?" "+B0(_):""}"
@@ -8026,7 +8060,7 @@ ${C}
8026
8060
 
8027
8061
  // Load ts-video-player from CDN
8028
8062
  var script = document.createElement('script');
8029
- script.src = '${vq}';
8063
+ script.src = '${xq}';
8030
8064
  script.onload = initPlayer;
8031
8065
  script.onerror = function() {
8032
8066
  console.error('[stx] Failed to load ts-video-player');
@@ -8156,7 +8190,7 @@ else {
8156
8190
  .ts-video-player__play-button svg {
8157
8191
  margin-left: 4px;
8158
8192
  }
8159
- `.trim();return{html:V,script:w,css:R}}function PZ($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function gq($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function hq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function dq($,Z){let Y=await bZ();if(!Y)return V4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return CZ($,Q,Z);return V4({...$,process:!1},Z)}async function mq($,Z){let Y=await bZ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function CZ($,Z,Y){let{controls:X=SZ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=yZ,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:_=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=PZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(j)A.push("disablepictureinpicture");if(_)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let N=U||Z.metadata?.width,T=z||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${B0(H)}"`);if(L)A.push(`style="${B0(L)}"`);let I=` <source ${W?`data-src="${B0(O)}"`:`src="${B0(O)}"`} type="${V}" />`,k=`<video ${A.join(" ")}>
8193
+ `.trim();return{html:V,script:w,css:R}}function PZ($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function hq($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function dq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function mq($,Z){let Y=await bZ();if(!Y)return V4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return CZ($,Q,Z);return V4({...$,process:!1},Z)}async function uq($,Z){let Y=await bZ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function CZ($,Z,Y){let{controls:X=SZ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=yZ,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:_=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=PZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(j)A.push("disablepictureinpicture");if(_)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let N=U||Z.metadata?.width,T=z||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${B0(H)}"`);if(L)A.push(`style="${B0(L)}"`);let I=` <source ${W?`data-src="${B0(O)}"`:`src="${B0(O)}"`} type="${V}" />`,k=`<video ${A.join(" ")}>
8160
8194
  ${I}
8161
8195
  Your browser does not support the video tag.
8162
8196
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -8205,9 +8239,9 @@ ${k}
8205
8239
  width: 100%;
8206
8240
  height: auto;
8207
8241
  }
8208
- `.trim();return{html:k,script:E,css:C}}var kZ=!1,SZ=!0,yZ="metadata",vq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var vZ=y(()=>{O3()});function xZ(){return a$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=uq($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await V4(G,q),U=W.html;if(W.css)U+=`
8242
+ `.trim();return{html:k,script:E,css:C}}var kZ=!1,SZ=!0,yZ="metadata",xq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var vZ=y(()=>{O3()});function xZ(){return a$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=lq($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await V4(G,q),U=W.html;if(W.css)U+=`
8209
8243
  <style>${W.css}</style>`;if(W.script)U+=`
8210
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function uq($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=lq(X),J=fZ(Q[0],Y)||"",G={};if(Q[1]){let K=fZ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function lq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function fZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var H3;var O3=y(()=>{d7();vZ();H3=xZ()});function pq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
8244
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function lq($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=pq(X),J=fZ(Q[0],Y)||"",G={};if(Q[1]){let K=fZ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function pq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function fZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var H3;var O3=y(()=>{d7();vZ();H3=xZ()});function cq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
8211
8245
  ${$}
8212
8246
  </div>
8213
8247
  <script>
@@ -8252,7 +8286,7 @@ ${k}
8252
8286
  }
8253
8287
  }
8254
8288
  })();
8255
- </script>`}function cq($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
8289
+ </script>`}function iq($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
8256
8290
  <div class="stx-pwa-update-banner" style="
8257
8291
  position: fixed;
8258
8292
  bottom: 0;
@@ -8363,7 +8397,7 @@ else {
8363
8397
  // Also listen for custom event
8364
8398
  window.addEventListener('pwa-update-available', showUpdate);
8365
8399
  })();
8366
- </script>`}function iq($,Z){let Y=$.trim().length>0,X=`
8400
+ </script>`}function nq($,Z){let Y=$.trim().length>0,X=`
8367
8401
  <div class="stx-offline-indicator" style="
8368
8402
  position: fixed;
8369
8403
  top: 16px;
@@ -8424,7 +8458,7 @@ else {
8424
8458
  window.addEventListener('offline', updateStatus);
8425
8459
  updateStatus();
8426
8460
  })();
8427
- </script>`}function nq($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8461
+ </script>`}function oq($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8428
8462
  ${$}
8429
8463
  </div>
8430
8464
  <script>
@@ -8506,71 +8540,71 @@ catch (error) {
8506
8540
  init();
8507
8541
  }
8508
8542
  })();
8509
- </script>`}function QL($){return[...$,...L3]}var oq,sq,rq,aq,L3;var F3=y(()=>{oq={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return pq($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},sq={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return cq($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},rq={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return iq($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},aq={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return nq($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},L3=[oq,sq,rq,aq]});function V3($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var w4=y(()=>{n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function s5(){return!1}function r5(){return!s5()||process.env.STX_DEBUG==="true"}function R4(){return!1}import tq from"path";function A4(){return{...w3}}function N4($){if(!w3.showRelativePaths||!$)return $;let Z=w3.baseDir||process.cwd();try{let Y=tq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var eq,w3,T4,C1,M4;var I4=y(()=>{w4();eq={showRelativePaths:!1,enableAutoRecovery:r5(),logRecoveryWarnings:!0},w3={...eq};T4=class T4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=N4(this.filePath)}};C1=class C1 extends T4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};M4=class M4 extends T4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function hZ($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let O=QW(K,q);B=O.line,j=O.column}let _=Q?N4(Q):void 0,H=X?V3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:_,line:B,column:j,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=ZW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=YW(L,K,q);break;case"text":default:F=$W(L,K,q);break}return{formatted:F,data:L}}function $W($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
8510
- ${$.message}`),Z&&$.line){let J=XW(Z,$.line,2);if(J)X.push(`
8543
+ </script>`}function QL($){return[...$,...L3]}var sq,rq,aq,tq,L3;var F3=y(()=>{sq={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return cq($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},rq={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return iq($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},aq={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return nq($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},tq={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return oq($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},L3=[sq,rq,aq,tq]});function V3($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var w4=y(()=>{n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function s5(){return!1}function r5(){return!s5()||process.env.STX_DEBUG==="true"}function R4(){return!1}import eq from"path";function A4(){return{...w3}}function N4($){if(!w3.showRelativePaths||!$)return $;let Z=w3.baseDir||process.cwd();try{let Y=eq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var $W,w3,T4,C1,M4;var I4=y(()=>{w4();$W={showRelativePaths:!1,enableAutoRecovery:r5(),logRecoveryWarnings:!0},w3={...$W};T4=class T4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=N4(this.filePath)}};C1=class C1 extends T4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};M4=class M4 extends T4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function hZ($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let O=GW(K,q);B=O.line,j=O.column}let _=Q?N4(Q):void 0,H=X?V3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:_,line:B,column:j,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=YW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=XW(L,K,q);break;case"text":default:F=ZW(L,K,q);break}return{formatted:F,data:L}}function ZW($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
8544
+ ${$.message}`),Z&&$.line){let J=JW(Z,$.line,2);if(J)X.push(`
8511
8545
  ${J}`)}if($.snippet)X.push(`
8512
8546
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
8513
- Suggestion: ${$.suggestion}`);return X.join(" ")}function ZW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${gZ($.message)}`;if($.suggestion)X+=` | Suggestion: ${gZ($.suggestion)}`;return X+=" -->",X}function YW($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
8547
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function YW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${gZ($.message)}`;if($.suggestion)X+=` | Suggestion: ${gZ($.suggestion)}`;return X+=" -->",X}function XW($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
8514
8548
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
8515
8549
 
8516
- ${$.message}`),Z&&$.line){let z=JW(Z,$.line,2);if(z)W.push(`
8550
+ ${$.message}`),Z&&$.line){let z=QW(Z,$.line,2);if(z)W.push(`
8517
8551
 
8518
8552
  \x1B[90mContext:\x1B[0m
8519
8553
  ${z}`)}if($.suggestion)W.push(`
8520
8554
 
8521
8555
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
8522
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function XW($,Z,Y){let X=$.split(`
8556
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function JW($,Z,Y){let X=$.split(`
8523
8557
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
8524
- `)}function JW($,Z,Y){let X=$.split(`
8558
+ `)}function QW($,Z,Y){let X=$.split(`
8525
8559
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),B=U===Z-1,j=B?"\x1B[31m>\x1B[0m":" ",_=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${j}\x1B[90m${z}\x1B[0m | ${_}`)}return W.join(`
8526
- `)}function gZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function QW($,Z){let X=$.substring(0,Z).split(`
8560
+ `)}function gZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function GW($,Z){let X=$.substring(0,Z).split(`
8527
8561
  `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return hZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function Z5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var dZ=y(()=>{w4();I4()});class A3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
8528
8562
  `).slice(1).join(`
8529
8563
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
8530
8564
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
8531
8565
  `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let J=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
8532
8566
 
8533
- `),"utf-8")}}async flush(){await this.writeQueue}}var R3,c0,N3;var mZ=y(()=>{I4();R3={isEnabled(){return A4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=A4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
8534
- @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(r5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};c0=new A3,N3={isDevelopment(){return r5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8535
- `)}}});var uZ=()=>{};var lZ=y(()=>{w4();dZ();mZ();uZ();I4()});var J1=y(()=>{lZ()});function pZ($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${l(z)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let _=L0(z,Z);if(!_)return"";let H="<meta";if(_.name)H+=` name="${l(String(_.name))}"`;if(_.property)H+=` property="${l(String(_.property))}"`;if(_.httpEquiv)H+=` http-equiv="${l(String(_.httpEquiv))}"`;if(_.content)H+=` content="${l(String(_.content))}"`;return H+=">",H}catch(_){let H=_ instanceof Error?_.message:String(_);return $0("MetaTag",H,n.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function cZ($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let j=L0(U,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let _=j instanceof Error?j.message:String(j);return $0("StructuredData",_,n.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function iZ($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let j=W+B[0].length,_=Q.substring(K,W),H=Q.substring(G.index,j),L=((F)=>{try{let O=L0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
8536
- `,V+=`<meta name="title" content="${l(O.title)}">
8537
- `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
8538
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
8539
- `}if(O.robots)V+=`<meta name="robots" content="${l(O.robots)}">
8540
- `;if(O.canonical)V+=`<link rel="canonical" href="${l(O.canonical)}">
8541
- `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${l(w.type||"website")}">
8542
- `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${l(R)}">
8543
- `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${l(R)}">
8544
- `}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(R)}">
8545
- `}if(w.image){if(V+=`<meta property="og:image" content="${l(w.image)}">
8546
- `,w.imageAlt)V+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
8547
- `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
8548
- `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
8549
- `}if(w.siteName)V+=`<meta property="og:site_name" content="${l(w.siteName)}">
8550
- `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
8551
- `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(R)}">
8552
- `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(R)}">
8553
- `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${l(R)}">
8554
- `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
8555
- `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
8567
+ `),"utf-8")}}async flush(){await this.writeQueue}}var R3,p0,N3;var mZ=y(()=>{I4();R3={isEnabled(){return A4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=A4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
8568
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(r5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};p0=new A3,N3={isDevelopment(){return r5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8569
+ `)}}});var uZ=()=>{};var lZ=y(()=>{w4();dZ();mZ();uZ();I4()});var Q1=y(()=>{lZ()});function pZ($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let _=L0(z,Z);if(!_)return"";let H="<meta";if(_.name)H+=` name="${p(String(_.name))}"`;if(_.property)H+=` property="${p(String(_.property))}"`;if(_.httpEquiv)H+=` http-equiv="${p(String(_.httpEquiv))}"`;if(_.content)H+=` content="${p(String(_.content))}"`;return H+=">",H}catch(_){let H=_ instanceof Error?_.message:String(_);return $0("MetaTag",H,n.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function cZ($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let j=L0(U,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let _=j instanceof Error?j.message:String(j);return $0("StructuredData",_,n.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function iZ($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let j=W+B[0].length,_=Q.substring(K,W),H=Q.substring(G.index,j),L=((F)=>{try{let O=L0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
8570
+ `,V+=`<meta name="title" content="${p(O.title)}">
8571
+ `;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
8572
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(w)}">
8573
+ `}if(O.robots)V+=`<meta name="robots" content="${p(O.robots)}">
8574
+ `;if(O.canonical)V+=`<link rel="canonical" href="${p(O.canonical)}">
8575
+ `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${p(w.type||"website")}">
8576
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${p(R)}">
8577
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${p(R)}">
8578
+ `}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${p(R)}">
8579
+ `}if(w.image){if(V+=`<meta property="og:image" content="${p(w.image)}">
8580
+ `,w.imageAlt)V+=`<meta property="og:image:alt" content="${p(w.imageAlt)}">
8581
+ `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${p(String(w.imageWidth))}">
8582
+ `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${p(String(w.imageHeight))}">
8583
+ `}if(w.siteName)V+=`<meta property="og:site_name" content="${p(w.siteName)}">
8584
+ `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${p(w.card||"summary_large_image")}">
8585
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${p(R)}">
8586
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${p(R)}">
8587
+ `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(R)}">
8588
+ `}if(w.site)V+=`<meta name="twitter:site" content="${p(w.site)}">
8589
+ `;if(w.creator)V+=`<meta name="twitter:creator" content="${p(w.creator)}">
8556
8590
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
8557
8591
  `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,n.EVALUATION_ERROR)}})(_);Q=Q.substring(0,G.index)+L+Q.substring(j),J.lastIndex=G.index+L.length}return Q}function nZ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
8558
8592
  <!-- stx SEO Tags -->
8559
- <meta name="title" content="${l(G)}">
8560
- <meta name="description" content="${l(K)}">
8561
- <meta property="og:title" content="${l(G)}">
8562
- <meta property="og:description" content="${l(K)}">
8593
+ <meta name="title" content="${p(G)}">
8594
+ <meta name="description" content="${p(K)}">
8595
+ <meta property="og:title" content="${p(G)}">
8596
+ <meta property="og:description" content="${p(K)}">
8563
8597
  <meta property="og:type" content="website">
8564
8598
  <meta name="twitter:card" content="summary_large_image">
8565
- <meta name="twitter:title" content="${l(G)}">
8566
- <meta name="twitter:description" content="${l(K)}">
8599
+ <meta name="twitter:title" content="${p(G)}">
8600
+ <meta name="twitter:description" content="${p(K)}">
8567
8601
  `;if(q)W+=`
8568
- <meta property="og:image" content="${l(q)}">
8569
- <meta name="twitter:image" content="${l(q)}">
8602
+ <meta property="og:image" content="${p(q)}">
8603
+ <meta name="twitter:image" content="${p(q)}">
8570
8604
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
8571
- <title>${l(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
8605
+ <title>${p(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
8572
8606
  ${W}
8573
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var oZ,sZ;var T3=y(()=>{J1();F0();oZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},sZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",n.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",n.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,n.EVALUATION_ERROR)}},hasEndTag:!0}});import a5 from"path";function GW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let _=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)J=_[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function KW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
8607
+ `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var oZ,sZ;var T3=y(()=>{Q1();F0();oZ={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},sZ={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",n.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",n.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,n.EVALUATION_ERROR)}},hasEndTag:!0}});import a5 from"path";function KW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let _=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)J=_[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function qW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
8574
8608
  get ${z}() {
8575
8609
  return this.getAttribute('${z}') || '';
8576
8610
  }
@@ -8621,16 +8655,16 @@ ${U}
8621
8655
  }
8622
8656
 
8623
8657
  customElements.define('${Z}', ${G});
8624
- `}async function rZ($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[a5.join(a5.dirname(X),G,`${Q}.stx`),a5.join(process.cwd(),G,`${Q}.stx`),a5.join(a5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,n.FILE_NOT_FOUND);let W=GW(q,Q);return`<script type="module">
8625
- ${KW(W)}
8626
- </script>`}var aZ=y(()=>{J1();O0()});var tZ={};o(tZ,{timingPlugin:()=>BW,pluginManager:()=>qW,definePlugin:()=>E4,debugPlugin:()=>zW,createVariablesPlugin:()=>jW,createFilterPlugin:()=>UW,createDirectivePlugin:()=>WW,PluginManager:()=>M3});function E4($){return $}class M3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function WW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function UW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function jW($){return E4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var qW,zW,BW;var eZ=y(()=>{qW=new M3;zW=E4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),BW=E4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var Z2={};o(Z2,{validateConfig:()=>FW,loadStxConfig:()=>X5,defineStxConfig:()=>LW,defaultConfig:()=>v1,config:()=>E3});import I3 from"fs";import M0 from"path";import{loadConfigWithResult as _W}from"bunfig";function HW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=M0.join(process.cwd(),"resources","views"),Q=M0.join(process.cwd(),"resources","layouts");if(I3.existsSync(X)&&I3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=M0.join(process.cwd(),"resources","views","pages");if(I3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function OW($){if(K9($.stateDir),$.stateDir=A5(),$.cachePath=T5($.cachePath),$.build)$.build.cacheDir=T5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=T5($.media.cache.directory);if($.story)$.story.outDir=T5($.story.outDir)}async function X5($){if(!$){if(Y5)return Y5;if(D4)return D4}let Z=$?M0.resolve($):process.cwd(),Y=$2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await _W({name:"stx",alias:"ui",cwd:Z,defaultConfig:v1,verbose:!1})).config;OW(J);let G=HW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!M0.isAbsolute(J.partialsDir))J.partialsDir=M0.join(K,J.partialsDir);if(J.componentsDir&&!M0.isAbsolute(J.componentsDir))J.componentsDir=M0.join(K,J.componentsDir);if(J.layoutsDir&&!M0.isAbsolute(J.layoutsDir))J.layoutsDir=M0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (eZ(),tZ)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,_;try{j=await import(z),_=M0.dirname(G0.resolve(z))}catch{let L=M0.resolve(process.cwd(),z);j=await import(L),_=M0.dirname(L)}let H=j.default||j;if(K.register(H,J),H.components){let L=M0.resolve(_,H.components);q.push(L)}if(H.pages){let L=M0.resolve(_,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:_,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if($2.set(Z,X),!$)D4=X,X.then((Q)=>{Y5=Q}).catch(()=>{});return X}function LW($){return $}function FW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var v1,Y5=null,$2,D4=null,E3;var J5=y(()=>{K7();q7();W7();U7();h7();jZ();O3();F3();T3();_$();aZ();v1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:c1,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:h8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:rZ,hasEndTag:!1,description:"Include a web component in the template"},U9,z9,oZ,sZ,B9,_9,H9,j9,V9,A9,BZ,H3,...L3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};$2=new Map;E3=new Proxy(v1,{get($,Z){if(Y5&&Z in Y5)return Y5[Z];if(!D4)X5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import q0 from"path";import{hasLocalConfig as VW}from"bunfig/discovery";function b3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function k3($,Z){if(f1.has($))f1.delete($);else if(f1.size>=wW)f1.delete(f1.keys().next().value);f1.set($,Z)}async function RW($){if(!j1)return null;try{let Z=Bun.file(q0.join(j1,`cw-${b3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function AW($,Z){if(!j1)return;try{if(!fs.existsSync(j1))fs.mkdirSync(j1,{recursive:!0});await Bun.write(q0.join(j1,`cw-${b3($)}.css`),Z)}catch{}}async function X2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function NW(){let $=[],Z=process.cwd();while(Z!==q0.dirname(Z))$.push(q0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(q0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(q0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(q0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(q0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(q0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=q0.dirname(Z);return $}function TW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function MW(){if(Y2)return x1;Y2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await X2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(J))}`);return G}}return null},Z=await $(NW());if(Z)return x1=Z,x1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await X2(Q);if(J){if(x1=J,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return x1}}let X=await $(TW());if(X)return x1=X,x1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}async function IW($){try{if(!VW({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=q0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function EW($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function DW($,Z){try{let Y=await MW();if(!Y)return"";let X=EW($);if(X.size===0)return"";let Q=Z?q0.resolve(Z):process.cwd();if(!j1)j1=N5(Q,"cache");let J=[...X].sort().join(" "),G=`${D3||"default"}::${J}`,K=f1.get(G);if(K!==void 0)return k3(G,K),K;let q=await RW(G);if(q!==null)return k3(G,q),q;if(!k4){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (J5(),Z2)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=q0.isAbsolute(N.css)?N.css:q0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(R={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=q0.isAbsolute(N.css.config)?N.css.config:q0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}k4=R||await IW(Q);try{D3=b3(JSON.stringify(k4??{}))}catch{D3="unhashable"}}let W=Y.defaultConfig||Y.config,U=k4||{},z=W.theme||{},j=(U.theme||{}).extend||{},_={...z};if(Object.keys(j).length>0)_.extend=j;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:H},F=new Y.CSSGenerator(L);for(let R of H)F.generate(R);for(let R of X)F.generate(R);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
8658
+ `}async function rZ($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[a5.join(a5.dirname(X),G,`${Q}.stx`),a5.join(process.cwd(),G,`${Q}.stx`),a5.join(a5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,n.FILE_NOT_FOUND);let W=KW(q,Q);return`<script type="module">
8659
+ ${qW(W)}
8660
+ </script>`}var aZ=y(()=>{Q1();O0()});var tZ={};o(tZ,{timingPlugin:()=>jW,pluginManager:()=>WW,definePlugin:()=>E4,debugPlugin:()=>BW,createVariablesPlugin:()=>_W,createFilterPlugin:()=>zW,createDirectivePlugin:()=>UW,PluginManager:()=>M3});function E4($){return $}class M3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function UW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function zW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function _W($){return E4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var WW,BW,jW;var eZ=y(()=>{WW=new M3;BW=E4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),jW=E4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var Z2={};o(Z2,{validateConfig:()=>VW,loadStxConfig:()=>X5,defineStxConfig:()=>FW,defaultConfig:()=>v1,config:()=>E3});import I3 from"fs";import M0 from"path";import{loadConfigWithResult as HW}from"bunfig";function OW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=M0.join(process.cwd(),"resources","views"),Q=M0.join(process.cwd(),"resources","layouts");if(I3.existsSync(X)&&I3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=M0.join(process.cwd(),"resources","views","pages");if(I3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function LW($){if(K9($.stateDir),$.stateDir=A5(),$.cachePath=T5($.cachePath),$.build)$.build.cacheDir=T5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=T5($.media.cache.directory);if($.story)$.story.outDir=T5($.story.outDir)}async function X5($){if(!$){if(Y5)return Y5;if(D4)return D4}let Z=$?M0.resolve($):process.cwd(),Y=$2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await HW({name:"stx",alias:"ui",cwd:Z,defaultConfig:v1,verbose:!1})).config;LW(J);let G=OW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!M0.isAbsolute(J.partialsDir))J.partialsDir=M0.join(K,J.partialsDir);if(J.componentsDir&&!M0.isAbsolute(J.componentsDir))J.componentsDir=M0.join(K,J.componentsDir);if(J.layoutsDir&&!M0.isAbsolute(J.layoutsDir))J.layoutsDir=M0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (eZ(),tZ)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,_;try{j=await import(z),_=M0.dirname(G0.resolve(z))}catch{let L=M0.resolve(process.cwd(),z);j=await import(L),_=M0.dirname(L)}let H=j.default||j;if(K.register(H,J),H.components){let L=M0.resolve(_,H.components);q.push(L)}if(H.pages){let L=M0.resolve(_,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:_,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if($2.set(Z,X),!$)D4=X,X.then((Q)=>{Y5=Q}).catch(()=>{});return X}function FW($){return $}function VW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var v1,Y5=null,$2,D4=null,E3;var J5=y(()=>{K7();q7();W7();U7();h7();jZ();O3();F3();T3();_$();aZ();v1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:c1,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:h8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:rZ,hasEndTag:!1,description:"Include a web component in the template"},U9,z9,oZ,sZ,B9,_9,H9,j9,V9,A9,BZ,H3,...L3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};$2=new Map;E3=new Proxy(v1,{get($,Z){if(Y5&&Z in Y5)return Y5[Z];if(!D4)X5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import q0 from"path";import{hasLocalConfig as wW}from"bunfig/discovery";function b3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function k3($,Z){if(f1.has($))f1.delete($);else if(f1.size>=RW)f1.delete(f1.keys().next().value);f1.set($,Z)}async function AW($){if(!j1)return null;try{let Z=Bun.file(q0.join(j1,`cw-${b3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function NW($,Z){if(!j1)return;try{if(!fs.existsSync(j1))fs.mkdirSync(j1,{recursive:!0});await Bun.write(q0.join(j1,`cw-${b3($)}.css`),Z)}catch{}}async function X2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function TW(){let $=[],Z=process.cwd();while(Z!==q0.dirname(Z))$.push(q0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(q0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(q0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(q0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(q0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(q0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=q0.dirname(Z);return $}function MW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function IW(){if(Y2)return x1;Y2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await X2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(J))}`);return G}}return null},Z=await $(TW());if(Z)return x1=Z,x1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await X2(Q);if(J){if(x1=J,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return x1}}let X=await $(MW());if(X)return x1=X,x1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}async function EW($){try{if(!wW({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=q0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function DW($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function kW($,Z){try{let Y=await IW();if(!Y)return"";let X=DW($);if(X.size===0)return"";let Q=Z?q0.resolve(Z):process.cwd();if(!j1)j1=N5(Q,"cache");let J=[...X].sort().join(" "),G=`${D3||"default"}::${J}`,K=f1.get(G);if(K!==void 0)return k3(G,K),K;let q=await AW(G);if(q!==null)return k3(G,q),q;if(!k4){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (J5(),Z2)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=q0.isAbsolute(N.css)?N.css:q0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(R={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=q0.isAbsolute(N.css.config)?N.css.config:q0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}k4=R||await EW(Q);try{D3=b3(JSON.stringify(k4??{}))}catch{D3="unhashable"}}let W=Y.defaultConfig||Y.config,U=k4||{},z=W.theme||{},j=(U.theme||{}).extend||{},_={...z};if(Object.keys(j).length>0)_.extend=j;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:H},F=new Y.CSSGenerator(L);for(let R of H)F.generate(R);for(let R of X)F.generate(R);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
8627
8661
  `);for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let k=I.startsWith("dark:"),D=`.${(k?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let P=w[b].trim();if(P===`${D} {`||P.startsWith(`${D} {`)){let f=b,g="";while(f<w.length){if(g+=w[f],w[f].includes("}"))break;f++}let m=g.match(/\{([^}]+)\}/);if(m)if(k)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
8628
8662
  .${R} { ${T.join(" ")} }`;if(M.length)O+=`
8629
- @media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return k3(G,O),AW(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function J2($,Z){let Y=await DW($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
8663
+ @media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return k3(G,O),NW(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function J2($,Z){let Y=await kW($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
8630
8664
  ${Y}
8631
8665
  </style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let J=!1;return $.replace(Q,()=>{if(J)return"";return J=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
8632
8666
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8633
- ${X}`);return X+$}var x1=null,Y2=!1,k4=null,wW=256,f1,j1=null,D3=null;var Q2=y(()=>{_$();q9();f1=new Map});function G2(){return`
8667
+ ${X}`);return X+$}var x1=null,Y2=!1,k4=null,RW=256,f1,j1=null,D3=null;var Q2=y(()=>{_$();q9();f1=new Map});function G2(){return`
8634
8668
  // STX Lifecycle Runtime
8635
8669
  (function() {
8636
8670
  if (typeof window === 'undefined') return;
@@ -8975,7 +9009,7 @@ else {
8975
9009
 
8976
9010
  console.log('[stx] Lifecycle runtime initialized');
8977
9011
  })();
8978
- `}function S3($){return Symbol($)}var RF,AF,NF;var K2=y(()=>{RF=S3("theme"),AF=S3("router"),NF=S3("i18n")});import*as W2 from"crypto";function q2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function kW(){return`stx-${W2.randomBytes(4).toString("hex")}`}function bW($){return/\$\w+\./.test($)}function SW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],O=L[1],V=L[2];if(bW(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:O,expr:R,fullMatch:F,originalAttr:O}),q2(R).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let _=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(_)H=_[1];else H=kW(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:q2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function yW($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9012
+ `}function S3($){return Symbol($)}var RF,AF,NF;var K2=y(()=>{RF=S3("theme"),AF=S3("router"),NF=S3("i18n")});import*as W2 from"crypto";function q2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function bW(){return`stx-${W2.randomBytes(4).toString("hex")}`}function SW($){return/\$\w+\./.test($)}function yW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],O=L[1],V=L[2];if(SW(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:O,expr:R,fullMatch:F,originalAttr:O}),q2(R).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let _=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(_)H=_[1];else H=bW(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:q2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function PW($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
8979
9013
  <script>
8980
9014
  (function() {
8981
9015
  'use strict';
@@ -9133,10 +9167,10 @@ else {
9133
9167
  }
9134
9168
  })();
9135
9169
  </script>
9136
- `,X}function U2($){let{html:Z,bindings:Y,stores:X}=SW($);if(Y.length===0)return $;let Q=yW(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var z2=()=>{};function PW($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return CW(Z);case"google-analytics":return vW(Z);case"plausible":return xW(Z);case"self-hosted":return fW(Z);case"custom":return gW(Z);default:return""}}function CW($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${C0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${C0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9170
+ `,X}function U2($){let{html:Z,bindings:Y,stores:X}=yW($);if(Y.length===0)return $;let Q=PW(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var z2=()=>{};function CW($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return vW(Z);case"google-analytics":return xW(Z);case"plausible":return fW(Z);case"self-hosted":return gW(Z);case"custom":return hW(Z);default:return""}}function vW($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${C0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${C0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9137
9171
  <!-- Fathom Analytics -->
9138
9172
  <script src="${C0(Y)}" ${Q.join(" ")}${X}></script>
9139
- `}function vW($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=C0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9173
+ `}function xW($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=C0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9140
9174
  <!-- Google Analytics -->
9141
9175
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
9142
9176
  <script>
@@ -9146,10 +9180,10 @@ else {
9146
9180
  gtag('config', '${Y}');
9147
9181
  ${X}
9148
9182
  </script>
9149
- `}function xW($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${C0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9183
+ `}function fW($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${C0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9150
9184
  <!-- Plausible Analytics -->
9151
9185
  <script defer data-domain="${C0(Z.domain)}" src="${C0(Q)}"></script>
9152
- `}function fW($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=C0(Z.siteId),X=C0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9186
+ `}function gW($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=C0(Z.siteId),X=C0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9153
9187
  d.addEventListener('click',function(e){
9154
9188
  var a=e.target.closest('a');
9155
9189
  if(a&&a.hostname!==location.hostname){
@@ -9182,7 +9216,7 @@ else {
9182
9216
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
9183
9217
  })();
9184
9218
  </script>
9185
- `}function gW($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9219
+ `}function hW($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9186
9220
  <!-- Custom Analytics -->
9187
9221
  <script>
9188
9222
  ${Z.inlineScript}
@@ -9190,7 +9224,7 @@ ${Z.inlineScript}
9190
9224
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${C0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${C0(Q)}="${C0(J)}"`);return`
9191
9225
  <!-- Custom Analytics -->
9192
9226
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${C0(Z.scriptUrl)}" defer></script>
9193
- `}function B2($,Z){let Y=PW(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var j2=()=>{};function O2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(hW.has(X))Z.systemKeys.push(X);else if(X in L2)Z.mouse=X;else if(X in H2||/^[a-z]$/.test(X))Z.keys.push(H2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function F2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=B.exec(K))!==null){let[,H,L]=j,F=H.split("."),O=F[0];if(!_2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:O2(F.slice(1)),elementId:U})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=_.exec(K))!==null){let[,H,L]=j,F=H.split("."),O=F[0];if(!_2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:O2(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function dW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=L2[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function mW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function uW($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=dW($),Q=mW($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9227
+ `}function B2($,Z){let Y=CW(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var j2=()=>{};function O2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(dW.has(X))Z.systemKeys.push(X);else if(X in L2)Z.mouse=X;else if(X in H2||/^[a-z]$/.test(X))Z.keys.push(H2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function F2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=B.exec(K))!==null){let[,H,L]=j,F=H.split("."),O=F[0];if(!_2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:O2(F.slice(1)),elementId:U})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=_.exec(K))!==null){let[,H,L]=j,F=H.split("."),O=F[0];if(!_2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:O2(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function mW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=L2[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function uW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function lW($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=mW($),Q=uW($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9194
9228
  (function() {
9195
9229
  var $el = document.getElementById('${Y}');
9196
9230
  if (!$el) return;
@@ -9244,7 +9278,7 @@ else {
9244
9278
  __stx_runHandler('${K}', $event, $el);
9245
9279
  }
9246
9280
  }${G});
9247
- })();`}function lW($){if($.length===0)return"";return`
9281
+ })();`}function pW($){if($.length===0)return"";return`
9248
9282
  <script data-stx-events>
9249
9283
  (function() {
9250
9284
  'use strict';
@@ -9292,11 +9326,11 @@ else {
9292
9326
  }
9293
9327
 
9294
9328
  // Event listeners
9295
- ${$.flatMap((Y)=>Y.events).map(uW).join(`
9329
+ ${$.flatMap((Y)=>Y.events).map(lW).join(`
9296
9330
  `)}
9297
9331
  })();
9298
- </script>`}function pW($){let Z=F2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function V2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=pW($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=F2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(j,""),U=U.replace(_,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=lW(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
9299
- `+J.slice(K);else J+=G;return J}var _2,H2,hW,L2;var w2=y(()=>{_2=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"]),H2={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"},hW=new Set(["ctrl","alt","shift","meta"]),L2={left:0,middle:1,right:2}});function b4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function iW($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=R2(G,"x-data");if(!q)continue;let W=`__stx_scope_${N2++}`,U=R2(G,"x-init"),z=nW($,J,K+Q.length),B=$.slice(K,z.endIndex),j=oW(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Z}function nW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function oW($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=sW(J);Z.set(G,K)}return Z}function sW($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${cW++}`}function rW(){return`
9332
+ </script>`}function cW($){let Z=F2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function V2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=cW($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=F2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(j,""),U=U.replace(_,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=pW(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
9333
+ `+J.slice(K);else J+=G;return J}var _2,H2,dW,L2;var w2=y(()=>{_2=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"]),H2={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"},dW=new Set(["ctrl","alt","shift","meta"]),L2={left:0,middle:1,right:2}});function b4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function nW($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=R2(G,"x-data");if(!q)continue;let W=`__stx_scope_${N2++}`,U=R2(G,"x-init"),z=oW($,J,K+Q.length),B=$.slice(K,z.endIndex),j=sW(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Z}function oW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function sW($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=rW(J);Z.set(G,K)}return Z}function rW($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${iW++}`}function aW(){return`
9300
9334
  // STX Reactive Runtime - x-cloak and transition CSS
9301
9335
  (function() {
9302
9336
  var style = document.createElement('style');
@@ -9503,7 +9537,7 @@ window.__stx_reactive = (function() {
9503
9537
 
9504
9538
  return { initScope: initScope, reactive: reactive };
9505
9539
  })();
9506
- `}function A2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=g0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=g0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function aW($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=A2(X.stateExpr,Z),G=X.initExpr?A2(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
9540
+ `}function A2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=g0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=g0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function tW($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=A2(X.stateExpr,Z),G=X.initExpr?A2(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
9507
9541
  (function() {
9508
9542
  var scopeEl = document.querySelector('${X.selector}');
9509
9543
  if (!scopeEl) return;
@@ -9512,14 +9546,14 @@ window.__stx_reactive = (function() {
9512
9546
  })();`}).join(`
9513
9547
  `);return`
9514
9548
  <script data-stx-scoped data-stx-reactive>
9515
- ${rW()}
9549
+ ${aW()}
9516
9550
  ${Y}
9517
- </script>`}function T2($,Z,Y){if(N2=0,!eW($))return $;let X=iW($);if(X.length===0)return $;let Q=tW($,X),J=aW(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
9518
- `+Q.slice(G);else Q+=J;return Q}function tW($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${b4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${b4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${b4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${b4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function eW($){return/x-data\s*=\s*["']/.test($)}var N2=0,cW=0;var M2=y(()=>{r0()});import $U from"fs";import y3 from"path";import{createHighlighter as ZU}from"ts-syntax-highlighter";async function YU($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await $U.promises.stat($)).mtime.getTime();if(Z.cache&&P3.has($)){let z=P3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=T9(Q),K=Z.markdown||E3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=M5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await XU(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)P3.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function XU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!S4)try{S4=await ZU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!S4.getSupportedLanguages().includes(B))return K;return(await S4.highlight(z,B,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${W}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function I2($,Z,Y="",X={}){return await JU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!y3.isAbsolute(K))U=y3.resolve(y3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await YU(U,X),_={...Z,...j,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return _[V]!==void 0?String(_[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return K0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function JU($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var P3,S4=null;var E2=y(()=>{J5();O0();P3=new Map});function _1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var D2=y(()=>{F0()});function QU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=T7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&J0(z.value))B=Q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=Y0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function g1($,Z,Y){let X=$;X=QU(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=z1(X,K+7);if(!q)break;let W=q.endPos,U=k1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),B=q.expression,j=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){j=R.pos;break}}let _;if(j!==-1){let H=z.slice(0,j),L=z.slice(j+5);_=`@if (${B})${L}@else ${H}@endif`}else _=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+_+X.substring(U+10),J=!0}}X=v3(X,Z,Y),X=x3(X,Z,Y),X=C3(X,Z);let Q=()=>{let J=l5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&J0(U.condition))z=Q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=Y0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function k2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){j.lastIndex=B,_.lastIndex=B;let H=j.exec(K),L=_.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),j=/@else(?![a-z])/g,_=[],H;while((H=z.exec(K))!==null)_.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)_.push({pos:H.index,type:"close"});while((H=j.exec(K))!==null)_.push({pos:H.index,type:"else"});_.sort((L,F)=>L.pos-F.pos);for(let L of _)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),j=k2(B);if(j)U=j.value,z=W+5+j.consumed;else z=W+5;let _=X(Y,"auth","endauth",z);if(_===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,_),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?_1(`auth?.check && auth?.user?.[${U}]`,Z):_1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(_+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),j=k2(B);if(j)U=j.value,z=W+6+j.consumed;else z=W+6;let _=X(Y,"guest","endguest",z);if(_===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,_),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?_1(`!auth?.check || !auth?.user?.[${U}]`,Z):_1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(_+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=_1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,j=Y.slice(B+`@${K}`.length),_=G(j);if(!_)break;let H=B+`@${K}`.length+_.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,P)=>b.pos-P.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],k=0;for(let b=0;b<O.length;b++){let P=O[b];if(I.push({content:F.slice(k,P.pos),ability:void 0}),P.type==="elseDirective"){let f=F.slice(P.pos+`@${W}`.length),g=G(f);if(g){I[I.length-1]={content:F.slice(k,P.pos)},k=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[b+1],a=m?m.pos:F.length;I.push({content:F.slice(k,a),ability:g.ability,type:g.type,id:g.id}),k=a}}else k=P.pos+5}if(k<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(k)})}let E=J(_.ability,_.type,_.id),C=K==="can"?E:!E,D="";if(C)D=I[0]?.content||"";else{let b=!1;for(let P=1;P<I.length;P++){let f=I[P];if(f.isFinalElse){D=f.content,b=!0;break}if(f.ability){let g=J(f.ability,f.type,f.id);if(K==="can"?g:!g){D=f.content,b=!0;break}}}if(!b&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)D=P.content}}Y=Y.substring(0,B)+D+Y.substring(L+`@${q}`.length),U=!0}}return Y}function v3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let j=B.index,_=z1(J,j+`@${G}`.length);if(!_)break;let H=_.endPos,L=k1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=_.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=A;break}R=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,j)+N+J.substring(L+`@${K}`.length),U=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=$0(W,`Error processing @${G} directive: ${N}`,n.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=_1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=_1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function x3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),_=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(_);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=_.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,R=-1;while(V>0&&w<_.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(_),C=z.exec(_),D=E?E.index:1/0,b=C?C.index:1/0;if(D<b)V++,w=D+E[0].length;else if(b<1/0){if(V--,V===0){R=b;break}w=b+C[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=_.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let E=A.indexOf("@",M);if(E===-1)break;let C=A.substring(E);if(B.test(C)){T++,M=E+1;continue}if(j.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){N=E;break}M=E+1}let I;if(N!==-1){let E=A.slice(0,N),C=A.slice(N+5);I=W?E:C}else I=W?A:"";let k=`@${q}`.length;_=_.substring(0,F)+I+_.substring(R+k),H=!0}return _}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var y4=y(()=>{D2();J1();y$();F0()});function S2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function P4($,Z){if(!$)return Z?.nonceGenerator?.()??S2();let Y=b2.get($);if(!Y)Y=Z?.nonceGenerator?.()??S2(),b2.set($,Y);return Y}function GU($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function y2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${GU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function P2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?P4(Y,Z):void 0,Q=y2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
9519
- ${Q}`)}function C2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?P4(Z,J):void 0;return y2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return P4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=P4(Z,J);return Q}var b2;var v2=y(()=>{b2=new WeakMap});import KU from"crypto";function WU($=qU){let Z=KU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return f3=Z,Z}function UU(){if(!f3)WU();return f3}function zU($=x2){let Z=UU();return`<input type="hidden" name="${$}" value="${Z}">`}function f2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return zU(X||x2)})}var qU=40,x2="_token",f3=null;var g2=()=>{};async function h2($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await BU(Q,J,Z,Y,X);else Q=await jU(Q,J,Z,Y,X)}return Q}async function BU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=s1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[j,_="",H=""]=B,L=B.index||0;try{let F=_?d2(_):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:j,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:j,processed:$0("CustomDirective",`Error in @${J}${_?`(${_})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let j=z.length-1;j>=0;j--){let{original:_,processed:H}=z[j];W=W.replace(_,H)}return W}async function jU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=s1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[j,_=""]=U,H=U.index||0;try{let L=d2(_),F=await G("",L,Y,X);W.push({original:j,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:j,processed:$0("CustomDirective",`Error in @${J}(${_}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=s1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[j]=B,_=B.index||0;try{let H=await G("",[],Y,X);W.push({original:j,processed:H,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:j,processed:$0("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:_})}B=z.exec(K)}for(let j=W.length-1;j>=0;j--){let{original:_,processed:H}=W[j];K=K.replace(_,H)}return K}function d2($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var m2=y(()=>{J1();r1()});import _U from"crypto";function w0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function HU(){return _U.randomUUID()}function v4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=HU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${w0(J)}">`;return X}),Y}function p2($,Z,Y=l2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=H1(W),j=U.toUpperCase(),_=["GET","POST"].includes(j)?j:"POST",H=`<form method="${w0(_)}" action="${w0(z)}"${B?` ${B}`:""}>`;if(H+=`
9551
+ </script>`}function T2($,Z,Y){if(N2=0,!$U($))return $;let X=nW($);if(X.length===0)return $;let Q=eW($,X),J=tW(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
9552
+ `+Q.slice(G);else Q+=J;return Q}function eW($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${b4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${b4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${b4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${b4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function $U($){return/x-data\s*=\s*["']/.test($)}var N2=0,iW=0;var M2=y(()=>{r0()});import ZU from"fs";import y3 from"path";import{createHighlighter as YU}from"ts-syntax-highlighter";async function XU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await ZU.promises.stat($)).mtime.getTime();if(Z.cache&&P3.has($)){let z=P3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=T9(Q),K=Z.markdown||E3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=M5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await JU(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)P3.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function JU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!S4)try{S4=await YU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!S4.getSupportedLanguages().includes(B))return K;return(await S4.highlight(z,B,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${W}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function I2($,Z,Y="",X={}){return await QU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!y3.isAbsolute(K))U=y3.resolve(y3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await XU(U,X),_={...Z,...j,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return _[V]!==void 0?String(_[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return K0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function QU($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var P3,S4=null;var E2=y(()=>{J5();O0();P3=new Map});function _1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var D2=y(()=>{F0()});function GU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=T7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&J0(z.value))B=Q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=Y0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function g1($,Z,Y){let X=$;X=GU(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=z1(X,K+7);if(!q)break;let W=q.endPos,U=k1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),B=q.expression,j=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){j=R.pos;break}}let _;if(j!==-1){let H=z.slice(0,j),L=z.slice(j+5);_=`@if (${B})${L}@else ${H}@endif`}else _=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+_+X.substring(U+10),J=!0}}X=v3(X,Z,Y),X=x3(X,Z,Y),X=C3(X,Z);let Q=()=>{let J=l5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&J0(U.condition))z=Q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=Y0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function k2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){j.lastIndex=B,_.lastIndex=B;let H=j.exec(K),L=_.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),j=/@else(?![a-z])/g,_=[],H;while((H=z.exec(K))!==null)_.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)_.push({pos:H.index,type:"close"});while((H=j.exec(K))!==null)_.push({pos:H.index,type:"else"});_.sort((L,F)=>L.pos-F.pos);for(let L of _)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),j=k2(B);if(j)U=j.value,z=W+5+j.consumed;else z=W+5;let _=X(Y,"auth","endauth",z);if(_===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,_),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?_1(`auth?.check && auth?.user?.[${U}]`,Z):_1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(_+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),j=k2(B);if(j)U=j.value,z=W+6+j.consumed;else z=W+6;let _=X(Y,"guest","endguest",z);if(_===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,_),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?_1(`!auth?.check || !auth?.user?.[${U}]`,Z):_1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(_+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=_1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,j=Y.slice(B+`@${K}`.length),_=G(j);if(!_)break;let H=B+`@${K}`.length+_.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,P)=>b.pos-P.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],k=0;for(let b=0;b<O.length;b++){let P=O[b];if(I.push({content:F.slice(k,P.pos),ability:void 0}),P.type==="elseDirective"){let f=F.slice(P.pos+`@${W}`.length),g=G(f);if(g){I[I.length-1]={content:F.slice(k,P.pos)},k=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[b+1],a=m?m.pos:F.length;I.push({content:F.slice(k,a),ability:g.ability,type:g.type,id:g.id}),k=a}}else k=P.pos+5}if(k<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(k)})}let E=J(_.ability,_.type,_.id),C=K==="can"?E:!E,D="";if(C)D=I[0]?.content||"";else{let b=!1;for(let P=1;P<I.length;P++){let f=I[P];if(f.isFinalElse){D=f.content,b=!0;break}if(f.ability){let g=J(f.ability,f.type,f.id);if(K==="can"?g:!g){D=f.content,b=!0;break}}}if(!b&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)D=P.content}}Y=Y.substring(0,B)+D+Y.substring(L+`@${q}`.length),U=!0}}return Y}function v3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let j=B.index,_=z1(J,j+`@${G}`.length);if(!_)break;let H=_.endPos,L=k1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=_.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=A;break}R=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,j)+N+J.substring(L+`@${K}`.length),U=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=$0(W,`Error processing @${G} directive: ${N}`,n.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=_1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=_1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function x3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),_=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(_);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=_.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,R=-1;while(V>0&&w<_.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(_),C=z.exec(_),D=E?E.index:1/0,b=C?C.index:1/0;if(D<b)V++,w=D+E[0].length;else if(b<1/0){if(V--,V===0){R=b;break}w=b+C[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=_.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let E=A.indexOf("@",M);if(E===-1)break;let C=A.substring(E);if(B.test(C)){T++,M=E+1;continue}if(j.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){N=E;break}M=E+1}let I;if(N!==-1){let E=A.slice(0,N),C=A.slice(N+5);I=W?E:C}else I=W?A:"";let k=`@${q}`.length;_=_.substring(0,F)+I+_.substring(R+k),H=!0}return _}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var y4=y(()=>{D2();Q1();y$();F0()});function S2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function P4($,Z){if(!$)return Z?.nonceGenerator?.()??S2();let Y=b2.get($);if(!Y)Y=Z?.nonceGenerator?.()??S2(),b2.set($,Y);return Y}function KU($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function y2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${KU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function P2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?P4(Y,Z):void 0,Q=y2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
9553
+ ${Q}`)}function C2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?P4(Z,J):void 0;return y2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return P4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=P4(Z,J);return Q}var b2;var v2=y(()=>{b2=new WeakMap});import qU from"crypto";function UU($=WU){let Z=qU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return f3=Z,Z}function zU(){if(!f3)UU();return f3}function BU($=x2){let Z=zU();return`<input type="hidden" name="${$}" value="${Z}">`}function f2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return BU(X||x2)})}var WU=40,x2="_token",f3=null;var g2=()=>{};async function h2($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await jU(Q,J,Z,Y,X);else Q=await _U(Q,J,Z,Y,X)}return Q}async function jU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=s1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[j,_="",H=""]=B,L=B.index||0;try{let F=_?d2(_):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:j,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:j,processed:$0("CustomDirective",`Error in @${J}${_?`(${_})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let j=z.length-1;j>=0;j--){let{original:_,processed:H}=z[j];W=W.replace(_,H)}return W}async function _U($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=s1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[j,_=""]=U,H=U.index||0;try{let L=d2(_),F=await G("",L,Y,X);W.push({original:j,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:j,processed:$0("CustomDirective",`Error in @${J}(${_}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=s1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[j]=B,_=B.index||0;try{let H=await G("",[],Y,X);W.push({original:j,processed:H,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:j,processed:$0("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:_})}B=z.exec(K)}for(let j=W.length-1;j>=0;j--){let{original:_,processed:H}=W[j];K=K.replace(_,H)}return K}function d2($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var m2=y(()=>{Q1();r1()});import HU from"crypto";function w0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function C4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function OU(){return HU.randomUUID()}function v4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=OU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${w0(J)}">`;return X}),Y}function p2($,Z,Y=l2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=H1(W),j=U.toUpperCase(),_=["GET","POST"].includes(j)?j:"POST",H=`<form method="${w0(_)}" action="${w0(z)}"${B?` ${B}`:""}>`;if(H+=`
9520
9554
  ${v4("@csrf",Z)}`,!["GET","POST"].includes(j))H+=`
9521
- ${v4(`@method('${j}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=H1(W),j=t5(U,Z),_=j!==void 0&&j!==null?j:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=e5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=C4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${w0(L)}" name="${w0(U)}" value="${w0(_)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=H1(G),W=t5(J,Z)||K.trim(),U=e5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=C4(z?z[1]:"",Y.input,U,Y.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${w0(J)}" class="${B}"${j?` ${j}`:""}>${w0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=H1(G),W=t5(J,Z),U=e5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=C4(z?z[1]:"",Y.input,U,Y.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),_=K;if(W!==void 0)_=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${w0(J)}" class="${B}"${j?` ${j}`:""}>${_}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=H1(K),W=t5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((_)=>String(_)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${w0(J)}" value="${w0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=H1(K),W=t5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${w0(J)}" value="${w0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=H1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=e5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),j=C4(B?B[1]:"",Y.input,z,Y.inputError),_=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${w0(J)}"`,`class="${j}"`];if(W)H.push(`accept="${w0(W)}"`);if(U)H.push("multiple");if(_)H.push(_);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=H1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${w0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function c2($,Z,Y=l2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(e5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return u2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return u2(Q,Z)}let q=K.trim();if(J0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function e5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function u2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function t5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function H1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var l2;var i2=y(()=>{F0();l2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import d3 from"path";async function OU(){if($$!==void 0)return $$;try{$$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{$$=null}return $$}function LU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function FU($,Z){if({...l3,...Z.i18n}.cache&&m3[$]){let Q=m3[$],J=Z.i18n?.cacheMaxAge??0;if(!LU(Q,J))return Q.translations}if(Z$[$]?.state==="loading")return Z$[$].promise;g3[$]="loading";let X=u3($,Z).then((Q)=>{return g3[$]="loaded",delete Z$[$],Q}).catch((Q)=>{throw g3[$]="error",Z$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return Z$[$]={promise:X,state:"loading"},X}async function u3($,Z){let Y={...l3,...Z.i18n},X=d3.isAbsolute(Y.translationsDir)?Y.translationsDir:d3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await OU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:NU(Y.format)}):await VU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return u3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)m3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return u3(Y.defaultLocale,Z);return{}}}async function VU($,Z,Y){let X=d3.join(Y,`${$}${wU(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return RU(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function wU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function RU($){let Z={},Y=$.split(`
9522
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=AU(B)}}return Z}function AU($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function NU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function TU($,Z){return FU($,Z)}function MU($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function IU($,Z={}){return s2($,Z)}function s2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=EU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=DU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function EU($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function DU($,Z){let Y=kU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return bU(Q,Y.slice(2).join(","),Z);case"select":return yU(Q,Y.slice(2).join(","));case"selectordinal":return PU(Q,Y.slice(2).join(","));case"number":return vU(Q,Y[2]?.trim());case"date":return xU(Q,Y[2]?.trim());case"time":return fU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function kU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function bU($,Z,Y){let X=Number($)||0,Q=p3(Z),J=`=${X}`;if(Q[J])return h3(Q[J],X,Y);let G=SU(X);if(Q[G])return h3(Q[G],X,Y);if(Q.other)return h3(Q.other,X,Y);return String(X)}function h3($,Z,Y){let X=$.replace(/#/g,String(Z));return s2(X,Y)}function SU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function yU($,Z){let Y=String($||""),X=p3(Z);if(X[Y])return X[Y];return X.other||String($)}function PU($,Z){let Y=Number($)||0,X=p3(Z),Q=CU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function CU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function p3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function vU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function xU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function fU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function gU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function n2($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(gU(G))return IU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=MU(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function r2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...l3,...X.i18n},K=await TU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await o2(Q,J,async(U,z,B,j,_)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return L0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return n2(z,K,G.fallbackToKey,H)||j.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await o2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,j)=>{try{let _={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return L0(B,Z)}];for(let L of H)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return n2(z,K,G.fallbackToKey,_)}catch(_){if(X.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR)}}),Q}async function o2($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var $$,l3,m3,Z$,g3;var a2=y(()=>{J1();F0();l3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m3={},Z$={},g3={}});var n3={};o(n3,{streamingSuspenseDirective:()=>$Y,streamToResponse:()=>rU,streamTemplateSimple:()=>iU,streamTemplate:()=>dU,renderStreamingPage:()=>uU,registerStreamingDirectives:()=>oU,processStreamDirectives:()=>pU,processSectionDirectives:()=>sU,islandDirective:()=>ZY,generateHydrationRuntime:()=>aU,extractStreamBoundaries:()=>cU,createStreamRenderer:()=>nU,buildSuspenseResolveScript:()=>i3,SUSPENSE_RESOLVER_RUNTIME:()=>e2});import x4 from"path";function hU($){let Z=[],Y=0,X;t2.lastIndex=0;while((X=t2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function dU($,Z={},Y={}){let X={...v1,...Y,streaming:{...c3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:x4.dirname($)};if(q.trim())await D1(q,U,$);let z=hU(W),B=new Set;if(!z.some((_)=>_.type==="suspense")){let _=X.streaming?.strategy||"auto",H=new RegExp(h1.source,"g");if(!(_!=="manual"&&H.test(W))){let F=await V0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(h1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await V0(N,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await V0(R.content,U,$,X,B);J.enqueue(A),await new Promise((N)=>setTimeout(N,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let A=await V0(R,U,$,X,B);J.enqueue(A)}}}}else{let _=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
9555
+ ${v4(`@method('${j}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=H1(W),j=t5(U,Z),_=j!==void 0&&j!==null?j:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=e5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=C4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${w0(L)}" name="${w0(U)}" value="${w0(_)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=H1(G),W=t5(J,Z)||K.trim(),U=e5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=C4(z?z[1]:"",Y.input,U,Y.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${w0(J)}" class="${B}"${j?` ${j}`:""}>${w0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=H1(G),W=t5(J,Z),U=e5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=C4(z?z[1]:"",Y.input,U,Y.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),_=K;if(W!==void 0)_=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${w0(J)}" class="${B}"${j?` ${j}`:""}>${_}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=H1(K),W=t5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((_)=>String(_)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${w0(J)}" value="${w0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=H1(K),W=t5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${w0(J)}" value="${w0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=H1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=e5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),j=C4(B?B[1]:"",Y.input,z,Y.inputError),_=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${w0(J)}"`,`class="${j}"`];if(W)H.push(`accept="${w0(W)}"`);if(U)H.push("multiple");if(_)H.push(_);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=H1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${w0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function c2($,Z,Y=l2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(e5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return u2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return u2(Q,Z)}let q=K.trim();if(J0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function e5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function u2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function t5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function H1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var l2;var i2=y(()=>{F0();l2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import d3 from"path";async function LU(){if($$!==void 0)return $$;try{$$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{$$=null}return $$}function FU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function VU($,Z){if({...l3,...Z.i18n}.cache&&m3[$]){let Q=m3[$],J=Z.i18n?.cacheMaxAge??0;if(!FU(Q,J))return Q.translations}if(Z$[$]?.state==="loading")return Z$[$].promise;g3[$]="loading";let X=u3($,Z).then((Q)=>{return g3[$]="loaded",delete Z$[$],Q}).catch((Q)=>{throw g3[$]="error",Z$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return Z$[$]={promise:X,state:"loading"},X}async function u3($,Z){let Y={...l3,...Z.i18n},X=d3.isAbsolute(Y.translationsDir)?Y.translationsDir:d3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await LU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:TU(Y.format)}):await wU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return u3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)m3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return u3(Y.defaultLocale,Z);return{}}}async function wU($,Z,Y){let X=d3.join(Y,`${$}${RU(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return AU(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function RU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function AU($){let Z={},Y=$.split(`
9556
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=NU(B)}}return Z}function NU($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function TU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function MU($,Z){return VU($,Z)}function IU($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function EU($,Z={}){return s2($,Z)}function s2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=DU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=kU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function DU($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function kU($,Z){let Y=bU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return SU(Q,Y.slice(2).join(","),Z);case"select":return PU(Q,Y.slice(2).join(","));case"selectordinal":return CU(Q,Y.slice(2).join(","));case"number":return xU(Q,Y[2]?.trim());case"date":return fU(Q,Y[2]?.trim());case"time":return gU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function bU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function SU($,Z,Y){let X=Number($)||0,Q=p3(Z),J=`=${X}`;if(Q[J])return h3(Q[J],X,Y);let G=yU(X);if(Q[G])return h3(Q[G],X,Y);if(Q.other)return h3(Q.other,X,Y);return String(X)}function h3($,Z,Y){let X=$.replace(/#/g,String(Z));return s2(X,Y)}function yU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function PU($,Z){let Y=String($||""),X=p3(Z);if(X[Y])return X[Y];return X.other||String($)}function CU($,Z){let Y=Number($)||0,X=p3(Z),Q=vU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function vU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function p3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function xU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function fU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function gU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function hU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function n2($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(hU(G))return EU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=IU(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function r2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...l3,...X.i18n},K=await MU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await o2(Q,J,async(U,z,B,j,_)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return L0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return n2(z,K,G.fallbackToKey,H)||j.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await o2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,j)=>{try{let _={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return L0(B,Z)}];for(let L of H)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return n2(z,K,G.fallbackToKey,_)}catch(_){if(X.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR)}}),Q}async function o2($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var $$,l3,m3,Z$,g3;var a2=y(()=>{Q1();F0();l3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m3={},Z$={},g3={}});var n3={};o(n3,{streamingSuspenseDirective:()=>$Y,streamToResponse:()=>aU,streamTemplateSimple:()=>nU,streamTemplate:()=>mU,renderStreamingPage:()=>lU,registerStreamingDirectives:()=>sU,processStreamDirectives:()=>cU,processSectionDirectives:()=>rU,islandDirective:()=>ZY,generateHydrationRuntime:()=>tU,extractStreamBoundaries:()=>iU,createStreamRenderer:()=>oU,buildSuspenseResolveScript:()=>i3,SUSPENSE_RESOLVER_RUNTIME:()=>e2});import x4 from"path";function dU($){let Z=[],Y=0,X;t2.lastIndex=0;while((X=t2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function mU($,Z={},Y={}){let X={...v1,...Y,streaming:{...c3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:x4.dirname($)};if(q.trim())await D1(q,U,$);let z=dU(W),B=new Set;if(!z.some((_)=>_.type==="suspense")){let _=X.streaming?.strategy||"auto",H=new RegExp(h1.source,"g");if(!(_!=="manual"&&H.test(W))){let F=await V0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(h1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await V0(N,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await V0(R.content,U,$,X,B);J.enqueue(A),await new Promise((N)=>setTimeout(N,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let A=await V0(R,U,$,X,B);J.enqueue(A)}}}}else{let _=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
9523
9557
  <template data-suspense-fallback>Loading...</template>
9524
9558
  </div>`),_.set(L.name,V0(L.content,U,$,X,B))}J.enqueue(`
9525
9559
  <script>
@@ -9542,8 +9576,8 @@ ${Q}`)}function C2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?
9542
9576
  window.__stxSuspense.resolve('${$}', \`${X}\`);
9543
9577
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
9544
9578
  <script>
9545
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${l0(X)}</div>');
9546
- </script>`}}function mU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function uU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(e2),await Promise.all(Z.map(async(J)=>{let G=mU(J.render(),X,J.id);Q.enqueue(await i3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function pU($,Z){return $.replace(lU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function cU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function iU($,Z={},Y={}){let X={...v1,...Y,streaming:{...c3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:x4.dirname($)};if(q.trim())await D1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",j=new RegExp(h1.source,"g");if(!(B!=="manual"&&j.test(W))){let H=await V0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(h1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let R=W.slice(O,V.start);if(R.trim()){let A=await V0(R,U,$,X,z);J.enqueue(A)}}let w=await V0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await V0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function nU($,Z={}){let Y={...v1,...Z,streaming:{...c3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;h1.lastIndex=0;while((W=h1.exec(G))!==null){let B=W[1],j=W[2];q[B]=j}let U=G.replace(h1,"");return{renderShell:async(B={})=>{let j={...B,__filename:$,__dirname:x4.dirname($)};return await D1(J,j,$),V0(U,j,$,Y,new Set)},renderSection:async(B,j={})=>{try{if(!q[B])return`<div class="error-message">Section "${l0(B)}" not found in template "${l0($)}"</div>`;let _={...j,__filename:$,__dirname:x4.dirname($)};await D1(J,_,$);let H=new Set;return await V0(q[B],_,$,Y,H)}catch(_){let H=_ instanceof Error?_.message:String(_);return K0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function oU($={}){let Z=[];if($.streaming?.enabled)Z.push($Y);if($.hydration?.enabled)Z.push(ZY);return Z}async function sU($,Z,Y,X={}){return $}function rU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function aU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
9579
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${u0(X)}</div>');
9580
+ </script>`}}function uU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function lU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(e2),await Promise.all(Z.map(async(J)=>{let G=uU(J.render(),X,J.id);Q.enqueue(await i3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function cU($,Z){return $.replace(pU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function iU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function nU($,Z={},Y={}){let X={...v1,...Y,streaming:{...c3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:x4.dirname($)};if(q.trim())await D1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",j=new RegExp(h1.source,"g");if(!(B!=="manual"&&j.test(W))){let H=await V0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(h1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let R=W.slice(O,V.start);if(R.trim()){let A=await V0(R,U,$,X,z);J.enqueue(A)}}let w=await V0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await V0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function oU($,Z={}){let Y={...v1,...Z,streaming:{...c3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;h1.lastIndex=0;while((W=h1.exec(G))!==null){let B=W[1],j=W[2];q[B]=j}let U=G.replace(h1,"");return{renderShell:async(B={})=>{let j={...B,__filename:$,__dirname:x4.dirname($)};return await D1(J,j,$),V0(U,j,$,Y,new Set)},renderSection:async(B,j={})=>{try{if(!q[B])return`<div class="error-message">Section "${u0(B)}" not found in template "${u0($)}"</div>`;let _={...j,__filename:$,__dirname:x4.dirname($)};await D1(J,_,$);let H=new Set;return await V0(q[B],_,$,Y,H)}catch(_){let H=_ instanceof Error?_.message:String(_);return K0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function sU($={}){let Z=[];if($.streaming?.enabled)Z.push($Y);if($.hydration?.enabled)Z.push(ZY);return Z}async function rU($,Z,Y,X={}){return $}function aU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function tU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
9547
9581
  `);if(Z==="loader")return`
9548
9582
  (function() {
9549
9583
  window.__stx = window.__stx || {};
@@ -9705,25 +9739,25 @@ else {
9705
9739
  }
9706
9740
  };
9707
9741
  })();
9708
- </script>`,lU,$Y,ZY;var o3=y(()=>{J5();r0();r$();O0();c3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},h1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,t2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;lU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;$Y={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},ZY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
9742
+ </script>`,pU,$Y,ZY;var o3=y(()=>{J5();r0();r$();O0();c3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},h1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,t2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;pU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;$Y={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},ZY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
9709
9743
  ${W}
9710
9744
  <script type="application/json" data-island-props="${G}">
9711
9745
  ${q?`{${q}}`:"{}"}
9712
9746
  </script>
9713
- </div>`}}});var JY={};o(JY,{warnUnbalancedTags:()=>s3,findUnbalancedTags:()=>XY});function Q5($){return $.replace(/[^\n]/g," ")}function XY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Q5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Q5).replace(/<!--[\s\S]*?-->/g,Q5).replace(/\{\{\{[\s\S]*?\}\}\}/g,Q5).replace(/\{\{[\s\S]*?\}\}/g,Q5).replace(/\{!![\s\S]*?!!\}/g,Q5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(tU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
9714
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(eU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function s3($,Z){let Y;try{Y=XY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(YY.has(X))return;YY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var tU,eU,YY;var r3=y(()=>{tU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),eU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);YY=new Set});import h0 from"path";import a3 from"fs";function QY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function GY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class KY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),QY(Q),GY(Q)];for(let _ of j)if(J.has(_))return J.get(_)}let G=[...new Set([`${Q}.stx`,`${QY(Q)}.stx`,`${GY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=h0.resolve(h0.dirname(Z),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(h0.join(h0.dirname(W),"components"));if(q)K.push(q);let U=h0.join(h0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[h0.resolve(z,"src/components"),h0.resolve(z,"components"),h0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let _ of G){let H=h0.join(j,_);if(await c(H))return H}try{if(!a3.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=a3.readdirSync(j,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=h0.join(j,L.name);for(let O of G){let V=h0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var k0;var t3=y(()=>{O0();k0=new KY});function O1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $z($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var e3;var $6=y(()=>{e3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=$z($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${O1(X.value)}"`);else q.push(`href="${O1(X.value)}"`);if(Q)q.push(`class="${O1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${O1(J)}"`),q.push(`data-stx-exact-active-class="${O1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(O1(U))}else q.push(`${O1(U)}="${O1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Y6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function qY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=Zz[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function X6($,Z,Y,X){return Z.map((Q)=>`${Y$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function Yz($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${Y$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function Y$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Xz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Zz,Z6,J6;var Q6=y(()=>{Zz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Z6=[320,640,768,1024,1280,1536,1920];J6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=I0($,"src")||"",Q=I0($,"alt")||"",J=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),W=I0($,"densities"),U=I0($,"format"),z=I0($,"placeholder"),B=I0($,"placeholderColor")||"#e5e7eb",j=I0($,"provider"),_=I0($,"class")||I0($,"className")||"",H=I0($,"style")||"",L=I0($,"quality"),F=Y6($,"lazy",!0),O=Y6($,"preload",!1),V=Y6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=X6(X,Z6,j,U),N=qY(K);else if(!A&&W){let D=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Yz(X,D,w,j,U)}else if(K)N=qY(K);let T=[];if(H)T.push(H);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let D=Xz(w||16,R||9,B);T.push(`background-image:url(${D})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=Y$(X,w,R,j,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),_)I.push(`class="${z0(_)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(A)I.push(`srcset="${z0(A)}"`);if(N)I.push(`sizes="${z0(N)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[D,b]of Object.entries($.static)){if(k.has(D))continue;if(typeof b==="boolean"){if(b)I.push(z0(D))}else I.push(`${z0(D)}="${z0(b)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${b?` type="${b}"`:""}${A?` imagesrcset="${z0(A)}"`:""}${N?` imagesizes="${z0(N)}"`:""} />
9747
+ </div>`}}});var JY={};o(JY,{warnUnbalancedTags:()=>s3,findUnbalancedTags:()=>XY});function Q5($){return $.replace(/[^\n]/g," ")}function XY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Q5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Q5).replace(/<!--[\s\S]*?-->/g,Q5).replace(/\{\{\{[\s\S]*?\}\}\}/g,Q5).replace(/\{\{[\s\S]*?\}\}/g,Q5).replace(/\{!![\s\S]*?!!\}/g,Q5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(eU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
9748
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if($z.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function s3($,Z){let Y;try{Y=XY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(YY.has(X))return;YY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var eU,$z,YY;var r3=y(()=>{eU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$z=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);YY=new Set});import h0 from"path";import a3 from"fs";function QY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function GY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class KY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),QY(Q),GY(Q)];for(let _ of j)if(J.has(_))return J.get(_)}let G=[...new Set([`${Q}.stx`,`${QY(Q)}.stx`,`${GY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=h0.resolve(h0.dirname(Z),`${Q}.stx`);if(await i(j))return j;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(h0.join(h0.dirname(W),"components"));if(q)K.push(q);let U=h0.join(h0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[h0.resolve(z,"src/components"),h0.resolve(z,"components"),h0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let _ of G){let H=h0.join(j,_);if(await i(H))return H}try{if(!a3.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=a3.readdirSync(j,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=h0.join(j,L.name);for(let O of G){let V=h0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var k0;var t3=y(()=>{O0();k0=new KY});function O1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zz($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var e3;var $6=y(()=>{e3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=Zz($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${O1(X.value)}"`);else q.push(`href="${O1(X.value)}"`);if(Q)q.push(`class="${O1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${O1(J)}"`),q.push(`data-stx-exact-active-class="${O1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(O1(U))}else q.push(`${O1(U)}="${O1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Y6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function qY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=Yz[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function X6($,Z,Y,X){return Z.map((Q)=>`${Y$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function Xz($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${Y$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function Y$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Jz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Yz,Z6,J6;var Q6=y(()=>{Yz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Z6=[320,640,768,1024,1280,1536,1920];J6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=I0($,"src")||"",Q=I0($,"alt")||"",J=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),W=I0($,"densities"),U=I0($,"format"),z=I0($,"placeholder"),B=I0($,"placeholderColor")||"#e5e7eb",j=I0($,"provider"),_=I0($,"class")||I0($,"className")||"",H=I0($,"style")||"",L=I0($,"quality"),F=Y6($,"lazy",!0),O=Y6($,"preload",!1),V=Y6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=X6(X,Z6,j,U),N=qY(K);else if(!A&&W){let D=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Xz(X,D,w,j,U)}else if(K)N=qY(K);let T=[];if(H)T.push(H);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let D=Jz(w||16,R||9,B);T.push(`background-image:url(${D})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=Y$(X,w,R,j,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),_)I.push(`class="${z0(_)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(A)I.push(`srcset="${z0(A)}"`);if(N)I.push(`sizes="${z0(N)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[D,b]of Object.entries($.static)){if(k.has(D))continue;if(typeof b==="boolean"){if(b)I.push(z0(D))}else I.push(`${z0(D)}="${z0(b)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${b?` type="${b}"`:""}${A?` imagesrcset="${z0(A)}"`:""}${N?` imagesizes="${z0(N)}"`:""} />
9715
9749
  `}if(V){let D=[];if(U==="avif"||U==="auto"){let b=Y$(X,w,R,j,"avif"),P=A?X6(X,Z6,j,"avif"):`${b}`;D.push(`<source type="image/avif" srcset="${z0(P)}"${N?` sizes="${z0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=Y$(X,w,R,j,"webp"),P=A?X6(X,Z6,j,"webp"):`${b}`;D.push(`<source type="image/webp" srcset="${z0(P)}"${N?` sizes="${z0(N)}"`:""} />`)}return`${C}<picture>
9716
9750
  ${D.join(`
9717
9751
  `)}
9718
9752
  ${E}
9719
- </picture>`}return`${C}${E}`}}});function L1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function G5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Jz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",G6;var K6=y(()=>{G6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=G5($,"src")||"",Q=G5($,"alt")||"",J=G5($,"fallback")||"/images/safe-image-default.svg",G=G5($,"class")||G5($,"className")||"",K=G5($,"fallbackClassName")||"",q=[];if(q.push(`src="${L1(X)}"`),q.push(`alt="${L1(Q)}"`),G)q.push(`class="${L1(G)}"`);if(q.push(`data-fallback="${L1(J)}"`),K)q.push(`data-fallback-class="${L1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,j]of Object.entries($.static)){if(W.has(B))continue;if(typeof j==="boolean"){if(j)q.push(L1(B))}else q.push(`${L1(B)}="${L1(j)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Jz}${U}`;return U}}});function q6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function X$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function f4($,Z,Y){let X=X$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var W6;var U6=y(()=>{W6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=q6(X$($,"color")||"#6366f1"),Q=q6(X$($,"initialColor")||X$($,"initial-color")||""),J=q6(X$($,"height")||"3px"),G=f4($,"duration",2000),K=f4($,"throttle",200),q=f4($,"zIndex",999999)||f4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
9753
+ </picture>`}return`${C}${E}`}}});function L1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function G5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Qz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",G6;var K6=y(()=>{G6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=G5($,"src")||"",Q=G5($,"alt")||"",J=G5($,"fallback")||"/images/safe-image-default.svg",G=G5($,"class")||G5($,"className")||"",K=G5($,"fallbackClassName")||"",q=[];if(q.push(`src="${L1(X)}"`),q.push(`alt="${L1(Q)}"`),G)q.push(`class="${L1(G)}"`);if(q.push(`data-fallback="${L1(J)}"`),K)q.push(`data-fallback-class="${L1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,j]of Object.entries($.static)){if(W.has(B))continue;if(typeof j==="boolean"){if(j)q.push(L1(B))}else q.push(`${L1(B)}="${L1(j)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Qz}${U}`;return U}}});function q6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function X$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function f4($,Z,Y){let X=X$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var W6;var U6=y(()=>{W6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=q6(X$($,"color")||"#6366f1"),Q=q6(X$($,"initialColor")||X$($,"initial-color")||""),J=q6(X$($,"height")||"3px"),G=f4($,"duration",2000),K=f4($,"throttle",200),q=f4($,"zIndex",999999)||f4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
9720
9754
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
9721
9755
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
9722
9756
  </div>
9723
9757
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
9724
9758
  <script>
9725
9759
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
9726
- </script>`}}});function i0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Qz($,Z,Y){let X=UY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var WY,z6;var B6=y(()=>{WY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},z6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=i0(UY($,"position")||"top-right"),Q=Qz($,"max",5),J=WY[X]||WY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
9760
+ </script>`}}});function c0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Gz($,Z,Y){let X=UY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var WY,z6;var B6=y(()=>{WY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},z6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=c0(UY($,"position")||"top-right"),Q=Gz($,"max",5),J=WY[X]||WY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
9727
9761
  <style>
9728
9762
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
9729
9763
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -9731,7 +9765,7 @@ ${E}
9731
9765
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
9732
9766
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
9733
9767
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
9734
- </style>`}}});function g4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var zY,j6;var _6=y(()=>{zY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},j6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=g4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=i0(X),J=g4($,"size")||"md",G=g4($,"closeOnBackdrop")!=="false",K=g4($,"closeOnEscape")!=="false",q=zY[J]||zY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
9768
+ </style>`}}});function g4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var zY,j6;var _6=y(()=>{zY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},j6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=g4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=c0(X),J=g4($,"size")||"md",G=g4($,"closeOnBackdrop")!=="false",K=g4($,"closeOnEscape")!=="false",q=zY[J]||zY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
9735
9769
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
9736
9770
  <div style="padding:1.5rem">${Z}</div>
9737
9771
  </div>
@@ -9740,7 +9774,7 @@ ${E}
9740
9774
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
9741
9775
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
9742
9776
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
9743
- </style>`}}});function K5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var BY,H6;var O6=y(()=>{BY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},H6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=K5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=i0(X),J=K5($,"side")||"right",G=K5($,"size")||"md",K=K5($,"closeOnBackdrop")!=="false",q=K5($,"closeOnEscape")!=="false",W=K5($,"overlay")!=="false",U=BY[G]||BY.md,z=J==="left",B=z?"left:0":"right:0",j=z?"translateX(-100%)":"translateX(100%)",_=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
9777
+ </style>`}}});function K5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var BY,H6;var O6=y(()=>{BY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},H6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=K5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=c0(X),J=K5($,"side")||"right",G=K5($,"size")||"md",K=K5($,"closeOnBackdrop")!=="false",q=K5($,"closeOnEscape")!=="false",W=K5($,"overlay")!=="false",U=BY[G]||BY.md,z=J==="left",B=z?"left:0":"right:0",j=z?"translateX(-100%)":"translateX(100%)",_=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
9744
9778
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${U};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
9745
9779
  <div style="padding:1.5rem">${Z}</div>
9746
9780
  </div>
@@ -9749,18 +9783,18 @@ ${E}
9749
9783
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
9750
9784
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
9751
9785
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
9752
- </style>`}}});import{existsSync as Gz,readFileSync as Kz}from"fs";function qz($){if(jY.has($))return;jY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Wz($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Gz(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return G0.resolve(Y)}catch{}return null}function Uz($){if(h4.has($))return h4.get($);let Z=Wz($);if(!Z)return qz($),null;try{let Y=JSON.parse(Kz(Z,"utf8"));return h4.set($,Y.icons),Y.icons}catch{return null}}function q5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var h4,jY,L6;var F6=y(()=>{h4=new Map,jY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=q5($,"name")??q5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=i0(q5($,"size")||"24"),K=i0(q5($,"color")||"currentColor"),q=i0(q5($,"class")||""),W=i0(q5($,"style")||""),U=h4.get(Q)??Uz(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,j=z.height||24,_=`0 0 ${B} ${j}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${_}" fill="none"${L}${F}>${H}</svg>`}}});function _Y($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function HY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var V6;var w6=y(()=>{V6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=HY(Z,"fallback"),Q=X.rest,J=HY(Q,"error"),G=J.rest,K=X.region??_Y($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??_Y($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function d4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var R6;var A6=y(()=>{R6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(d4($,"name")||"v").replace(/["'<>]/g,""),Q=(d4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=d4($,"class"),G=d4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function OY(){k0.registerBuiltin(e3),k0.registerBuiltin(J6),k0.registerBuiltin(G6),k0.registerBuiltin(W6),k0.registerBuiltin(z6),k0.registerBuiltin(j6),k0.registerBuiltin(H6),k0.registerBuiltin(L6),k0.registerBuiltin(V6),k0.registerBuiltin(R6)}var LY=y(()=>{$6();Q6();K6();U6();B6();_6();O6();F6();w6();A6();t3();$6();Q6();K6();U6();B6();_6();O6();F6();w6();A6()});function m4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function FY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,j=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,j=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let _=$.slice(z,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:_,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
9753
- `||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:_,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function VY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var wY=y(()=>{F0();O0();P5()});var EY={};o(EY,{processESImports:()=>MY,processComponents:()=>l4});import u4 from"fs";import v0 from"path";function Bz($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let W=J(q.slice(6));X.serverDynamic[W]=VY(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K===N6?W:K;try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),j=Q0(U,z)(...Object.values(Z));if(j===void 0){let _=U.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((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=j}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(J0(U)){let B=Q0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let j=B[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let H=Q0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K===N6?"true":K}return X}function jz($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=N6}return Z}function AY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _z($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(k0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Hz($){let Z=NY.get($);if(Z)return Z;let Y=new Map,X=[v0.join($,"src"),v0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=u4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return NY.set($,Y),Y}function Oz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=v0.join(Y,"node_modules",$);try{if(u4.statSync(X).isDirectory())return X}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function MY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=z,_,H=[];while((_=B.exec(z))!==null){let[L,F,O,V]=_,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if(u4.statSync(M).isFile())R=M}catch{try{if(u4.statSync(T).isDirectory())w=T}catch{}}}}else w=Oz(V,G);if(!w&&!R)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&R)N(O,R),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let k=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:I,local:I}}),M=w?Hz(w):null;for(let{source:I,local:k}of T){let E=null;if(R)E=R;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(k,E),A=!0}}if(A)H.push({start:_.index,end:_.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)j=j.slice(0,H[L].start)+j.slice(H[L].end);return`<script${U}>${j}</script>`}),K}async function Lz($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let j=B.split("/"),H=j[j.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${B}.stx`),v0.resolve(v0.dirname(Y),B),v0.resolve(X.componentsDir||"components",`${B}.stx`),v0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function Fz($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,j=z+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let _=J.substring(z+1,j),H=j+1,L=_.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=_.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=L0(O,Z)}catch(k){let E=k instanceof Error?k.message:String(k);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await S1(F,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function Vz($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=y5(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,zz),J=B7(J,q.scripts),J;async function B(j,_,H,L){if(!j)return j;let F=j,O=FY(F,_,L);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?m4(w.tagName):w.tagName,A=jz(w.attributes),N=Bz(A,Z,X),T=k0.getBuiltin(w.tagName),M=T?await s$(R,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},D=T.render(N,w.content,C);if(Object.keys(N.clientReactive).length>0)D=TY(D,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([P,f])=>`${P}="${AY(f)}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await s$(R,G,Z,Y,X))continue;let I={};for(let[C,D]of Object.entries(N.static))I[C]=D;for(let[C,D]of Object.entries(N.serverDynamic))I[C]=D;let E=await S1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)E=TY(E,N.clientReactive);if(Object.keys(N.events).length>0){let C=IY(E);if(C){let D=Object.entries(N.events).map(([P,f])=>`${P}="${AY(f)}"`).join(" "),b=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${D}`+E.substring(C.insertPos)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function TY($,Z){let Y=IY($);if(!Y)return $;let X=new Set(["if","for","show"]),Q=Object.entries(Z).map(([K,q])=>`:${m4(K)}="${q.replace(/"/g,"&quot;")}"`).join(" "),J=Object.keys(Z).filter((K)=>!X.has(K)).map((K)=>m4(K)).join(" "),G=J?` data-stx-parent-bindings="${J}"`:"";return $.substring(0,Y.insertPos)+`${G} ${Q}`+$.substring(Y.insertPos)}function IY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function l4($,Z,Y,X,Q){if(!RY)OY(),RY=!0;let J=await MY($,Z,Y,X,Q);J=await Lz(J,Z,Y,X,Q),J=await Fz(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=q1(J,N$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await Vz(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=_z(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var RY=!1,N6="\x00stx-boolean-attribute",zz,NY;var T6=y(()=>{t3();LY();wY();P5();O0();F0();zz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);NY=new Map});var CY={};o(CY,{processLoops:()=>M6});function Az($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],_=U.slice(B[0].length),H=_.match(/^\s*,\s*/);if(!H)continue;let L=_.slice(H[0].length).trim();if(!L)continue;try{let F=L0(L,Z),O=JSON.stringify(F),V=`@component('${j}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function p4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let _=X[W];if(z){z=!1,W++;continue}if(_==="\\"&&U){z=!0,W++;continue}if(U){if(_===U)U=null;W++;continue}if(_==='"'||_==="'"||_==="`"){U=_,W++;continue}if(_==="(")q++;else if(_===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),j=Y(B);X=X.substring(0,G)+j+X.substring(W+1)}return X}function Nz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);F$(J);let W=Q0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function Tz($,Z){let Y=$;return Y=p4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?c4:""}catch{return""}}),Y=p4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?i4:""}catch{return""}}),Y}function Mz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,c4),Z=Z.replace(/@continue(?!\()/g,i4),Z}function DY($){let Z=$.includes(c4),Y=Z?$.substring(0,$.indexOf(c4)):$;return{hasBreak:Z,content:Y}}function kY($){let Z=$.includes(i4),Y=Z?$.substring(0,$.indexOf(i4)):$;return{hasContinue:Z,content:Y}}function SY($){let Z=$;return Z=p4(Z,"@break",(Y)=>{let X=Y.trim();if(!V$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=p4(Z,"@continue",(Y)=>{let X=Y.trim();if(!V$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Iz($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,j=0;while(z<=B){let _=z+B>>1;if(K[_].pos<=U)j=K[_].depth,z=_+1;else B=_-1}return j}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,j=z+1,_=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=$.substring(z+1,_),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=_+1,w=1,R=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){A.lastIndex=R,N.lastIndex=R;let D=A.exec($),b=N.exec($);if(!b)break;if(D&&D.index<b.index)w++,R=D.index+D[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,k=-1,E=0,C=0;while(C<M.length){let D=M.indexOf("@",C);if(D===-1)break;let b=M.substring(D);if(/^@forelse\s*\(/.test(b))E++,C=D+1;else if(b.startsWith("@endforelse"))E--,C=D+11;else if(E===0&&b.startsWith("@empty")){if(M.length<=D+6||!/[a-z]/i.test(M[D+6])){k=D;break}C=D+1}else C=D+1}if(k===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,k),emptyContent:M.substring(k+6)}}return null}function bY($,Z){let Y=$;while(!0){let X=Iz(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(J0(G))U=Q0(G,Object.keys(Z))(...Object.values(Z));else U=Y0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function M6($,Z,Y,X){let Q=$;Q=bY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,j=1,_=B+1,H=-1;while(_<q.length&&j>0){if(q[_]==="(")j++;else if(q[_]===")"){if(j--,j===0){H=_;break}}_++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),R=H+1,A=1,N=R,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),k=M.exec(q);if(!k)break;if(I&&I.index<k.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(R,k.index),C=k.index+11;return{start:O,end:C,arrayExpr:V,itemVar:w,content:E}}N=k.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:j,arrayExpr:_,itemVar:H,content:L}=z;try{let F=_.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+k+U.substring(j);continue}let w=X?.loops?.useAltLoopVariable??Rz,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let k=R.split("=>").map((E)=>E.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((E)=>E.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1],T=!0;else N=R}else N=R;let M="",I=O;for(let k=0;k<I.length;k++){let E=I[k],C={index:k,iteration:k+1,first:k===0,last:k===I.length-1,count:I.length},D={...W,loop:C,$loop:C};if(N.startsWith("[")&&N.endsWith("]")){let g=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,a)=>{if(m)D[m]=E[a]});else D[N]=E}else D[N]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)D[A]=E[0],D[N]=E[1];else D[A]=k;let b=Tz(L,D),P=kY(b);if(P.hasContinue){M+=P.content;continue}let f=DY(b);if(f.hasBreak){M+=f.content;break}if(b=bY(b,D),b=G(b,D),b=g1(b,D,Y),b=Mz(b),f=DY(b),f.hasBreak){M+=f.content;break}if(P=kY(b),P.hasContinue){M+=P.content;continue}b=W1(b,D,Y),b=Nz(b,D),b=Az(b,D),M+=b}U=U.substring(0,B)+M+U.substring(j)}catch(F){let O=$0("Foreach",`Error in @foreach(${_.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(j)}}return U}Q=G(Q,Z),Q=PY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??wz;return Q=kz(Q,Z,K),Q}function yY($){return V$($)}function PY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=S$(Q.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,_=K+B[0].end;if(!yY(U)){let H=$0("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(_),J=!0;continue}try{let H=Ez(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&L){let A=Dz({forExpr:U,content:j,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(_),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=SY(V);let R=Function(...F,`
9786
+ </style>`}}});import{existsSync as Kz,readFileSync as qz}from"fs";function Wz($){if(jY.has($))return;jY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Uz($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Kz(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return G0.resolve(Y)}catch{}return null}function zz($){if(h4.has($))return h4.get($);let Z=Uz($);if(!Z)return Wz($),null;try{let Y=JSON.parse(qz(Z,"utf8"));return h4.set($,Y.icons),Y.icons}catch{return null}}function q5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var h4,jY,L6;var F6=y(()=>{h4=new Map,jY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=q5($,"name")??q5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=c0(q5($,"size")||"24"),K=c0(q5($,"color")||"currentColor"),q=c0(q5($,"class")||""),W=c0(q5($,"style")||""),U=h4.get(Q)??zz(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,j=z.height||24,_=`0 0 ${B} ${j}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${_}" fill="none"${L}${F}>${H}</svg>`}}});function _Y($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function HY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var V6;var w6=y(()=>{V6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=HY(Z,"fallback"),Q=X.rest,J=HY(Q,"error"),G=J.rest,K=X.region??_Y($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??_Y($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function d4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var R6;var A6=y(()=>{R6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(d4($,"name")||"v").replace(/["'<>]/g,""),Q=(d4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=d4($,"class"),G=d4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function OY(){k0.registerBuiltin(e3),k0.registerBuiltin(J6),k0.registerBuiltin(G6),k0.registerBuiltin(W6),k0.registerBuiltin(z6),k0.registerBuiltin(j6),k0.registerBuiltin(H6),k0.registerBuiltin(L6),k0.registerBuiltin(V6),k0.registerBuiltin(R6)}var LY=y(()=>{$6();Q6();K6();U6();B6();_6();O6();F6();w6();A6();t3();$6();Q6();K6();U6();B6();_6();O6();F6();w6();A6()});function m4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function FY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,j=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,j=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let _=$.slice(z,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:_,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
9787
+ `||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:_,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function VY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var wY=y(()=>{F0();O0();P5()});var EY={};o(EY,{processESImports:()=>MY,processComponents:()=>l4});import u4 from"fs";import v0 from"path";function jz($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let W=J(q.slice(6));X.serverDynamic[W]=VY(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K===N6?W:K;try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),j=Q0(U,z)(...Object.values(Z));if(j===void 0){let _=U.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((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=j}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(J0(U)){let B=Q0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let j=B[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let H=Q0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K===N6?"true":K}return X}function _z($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=N6}return Z}function AY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hz($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(k0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Oz($){let Z=NY.get($);if(Z)return Z;let Y=new Map,X=[v0.join($,"src"),v0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=u4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return NY.set($,Y),Y}function Lz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=v0.join(Y,"node_modules",$);try{if(u4.statSync(X).isDirectory())return X}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function MY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=z,_,H=[];while((_=B.exec(z))!==null){let[L,F,O,V]=_,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if(u4.statSync(M).isFile())R=M}catch{try{if(u4.statSync(T).isDirectory())w=T}catch{}}}}else w=Lz(V,G);if(!w&&!R)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&R)N(O,R),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let k=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:I,local:I}}),M=w?Oz(w):null;for(let{source:I,local:k}of T){let E=null;if(R)E=R;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(k,E),A=!0}}if(A)H.push({start:_.index,end:_.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)j=j.slice(0,H[L].start)+j.slice(H[L].end);return`<script${U}>${j}</script>`}),K}async function Fz($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let j=B.split("/"),H=j[j.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${B}.stx`),v0.resolve(v0.dirname(Y),B),v0.resolve(X.componentsDir||"components",`${B}.stx`),v0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function Vz($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,j=z+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let _=J.substring(z+1,j),H=j+1,L=_.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=_.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=L0(O,Z)}catch(k){let E=k instanceof Error?k.message:String(k);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await S1(F,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function wz($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=y5(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,Bz),J=B7(J,q.scripts),J;async function B(j,_,H,L){if(!j)return j;let F=j,O=FY(F,_,L);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?m4(w.tagName):w.tagName,A=_z(w.attributes),N=jz(A,Z,X),T=k0.getBuiltin(w.tagName),M=T?await s$(R,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},D=T.render(N,w.content,C);if(Object.keys(N.clientReactive).length>0)D=TY(D,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([P,f])=>`${P}="${AY(f)}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await s$(R,G,Z,Y,X))continue;let I={};for(let[C,D]of Object.entries(N.static))I[C]=D;for(let[C,D]of Object.entries(N.serverDynamic))I[C]=D;let E=await S1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)E=TY(E,N.clientReactive);if(Object.keys(N.events).length>0){let C=IY(E);if(C){let D=Object.entries(N.events).map(([P,f])=>`${P}="${AY(f)}"`).join(" "),b=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${D}`+E.substring(C.insertPos)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function TY($,Z){let Y=IY($);if(!Y)return $;let X=new Set(["if","for","show"]),Q=Object.entries(Z).map(([K,q])=>`:${m4(K)}="${q.replace(/"/g,"&quot;")}"`).join(" "),J=Object.keys(Z).filter((K)=>!X.has(K)).map((K)=>m4(K)).join(" "),G=J?` data-stx-parent-bindings="${J}"`:"";return $.substring(0,Y.insertPos)+`${G} ${Q}`+$.substring(Y.insertPos)}function IY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function l4($,Z,Y,X,Q){if(!RY)OY(),RY=!0;let J=await MY($,Z,Y,X,Q);J=await Fz(J,Z,Y,X,Q),J=await Vz(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=q1(J,N$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await wz(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=Hz(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var RY=!1,N6="\x00stx-boolean-attribute",Bz,NY;var T6=y(()=>{t3();LY();wY();P5();O0();F0();Bz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);NY=new Map});var CY={};o(CY,{processLoops:()=>M6});function Nz($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],_=U.slice(B[0].length),H=_.match(/^\s*,\s*/);if(!H)continue;let L=_.slice(H[0].length).trim();if(!L)continue;try{let F=L0(L,Z),O=JSON.stringify(F),V=`@component('${j}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function p4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let _=X[W];if(z){z=!1,W++;continue}if(_==="\\"&&U){z=!0,W++;continue}if(U){if(_===U)U=null;W++;continue}if(_==='"'||_==="'"||_==="`"){U=_,W++;continue}if(_==="(")q++;else if(_===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),j=Y(B);X=X.substring(0,G)+j+X.substring(W+1)}return X}function Tz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);F$(J);let W=Q0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function Mz($,Z){let Y=$;return Y=p4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?c4:""}catch{return""}}),Y=p4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?i4:""}catch{return""}}),Y}function Iz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,c4),Z=Z.replace(/@continue(?!\()/g,i4),Z}function DY($){let Z=$.includes(c4),Y=Z?$.substring(0,$.indexOf(c4)):$;return{hasBreak:Z,content:Y}}function kY($){let Z=$.includes(i4),Y=Z?$.substring(0,$.indexOf(i4)):$;return{hasContinue:Z,content:Y}}function SY($){let Z=$;return Z=p4(Z,"@break",(Y)=>{let X=Y.trim();if(!V$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=p4(Z,"@continue",(Y)=>{let X=Y.trim();if(!V$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Ez($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,j=0;while(z<=B){let _=z+B>>1;if(K[_].pos<=U)j=K[_].depth,z=_+1;else B=_-1}return j}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,j=z+1,_=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=$.substring(z+1,_),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=_+1,w=1,R=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){A.lastIndex=R,N.lastIndex=R;let D=A.exec($),b=N.exec($);if(!b)break;if(D&&D.index<b.index)w++,R=D.index+D[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,k=-1,E=0,C=0;while(C<M.length){let D=M.indexOf("@",C);if(D===-1)break;let b=M.substring(D);if(/^@forelse\s*\(/.test(b))E++,C=D+1;else if(b.startsWith("@endforelse"))E--,C=D+11;else if(E===0&&b.startsWith("@empty")){if(M.length<=D+6||!/[a-z]/i.test(M[D+6])){k=D;break}C=D+1}else C=D+1}if(k===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,k),emptyContent:M.substring(k+6)}}return null}function bY($,Z){let Y=$;while(!0){let X=Ez(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(J0(G))U=Q0(G,Object.keys(Z))(...Object.values(Z));else U=Y0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function M6($,Z,Y,X){let Q=$;Q=bY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,j=1,_=B+1,H=-1;while(_<q.length&&j>0){if(q[_]==="(")j++;else if(q[_]===")"){if(j--,j===0){H=_;break}}_++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),R=H+1,A=1,N=R,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),k=M.exec(q);if(!k)break;if(I&&I.index<k.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(R,k.index),C=k.index+11;return{start:O,end:C,arrayExpr:V,itemVar:w,content:E}}N=k.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:j,arrayExpr:_,itemVar:H,content:L}=z;try{let F=_.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+k+U.substring(j);continue}let w=X?.loops?.useAltLoopVariable??Az,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let k=R.split("=>").map((E)=>E.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((E)=>E.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1],T=!0;else N=R}else N=R;let M="",I=O;for(let k=0;k<I.length;k++){let E=I[k],C={index:k,iteration:k+1,first:k===0,last:k===I.length-1,count:I.length},D={...W,loop:C,$loop:C};if(N.startsWith("[")&&N.endsWith("]")){let g=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,a)=>{if(m)D[m]=E[a]});else D[N]=E}else D[N]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)D[A]=E[0],D[N]=E[1];else D[A]=k;let b=Mz(L,D),P=kY(b);if(P.hasContinue){M+=P.content;continue}let f=DY(b);if(f.hasBreak){M+=f.content;break}if(b=bY(b,D),b=G(b,D),b=g1(b,D,Y),b=Iz(b),f=DY(b),f.hasBreak){M+=f.content;break}if(P=kY(b),P.hasContinue){M+=P.content;continue}b=W1(b,D,Y),b=Tz(b,D),b=Nz(b,D),M+=b}U=U.substring(0,B)+M+U.substring(j)}catch(F){let O=$0("Foreach",`Error in @foreach(${_.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(j)}}return U}Q=G(Q,Z),Q=PY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??Rz;return Q=bz(Q,Z,K),Q}function yY($){return V$($)}function PY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=S$(Q.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,_=K+B[0].end;if(!yY(U)){let H=$0("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(_),J=!0;continue}try{let H=Dz(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&L){let A=kz({forExpr:U,content:j,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(_),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=SY(V);let R=Function(...F,`
9754
9788
  let result = '';
9755
9789
  for (${U}) {
9756
9790
  result += \`${V}\`;
9757
9791
  }
9758
9792
  return result;
9759
- `)(...O);Q=Q.substring(0,K)+R+Q.substring(_),J=!0}catch(H){let L=$0("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(_),J=!0}}return Q}function Ez($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),j=B.indexOf("=");return(j>=0?B.slice(0,j):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function Dz($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
9793
+ `)(...O);Q=Q.substring(0,K)+R+Q.substring(_),J=!0}catch(H){let L=$0("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(_),J=!0}}return Q}function Dz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),j=B.indexOf("=");return(j>=0?B.slice(0,j):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function kz($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
9760
9794
  for (${Z}) {
9761
9795
  __pushIter([${X.join(", ")}])
9762
9796
  }
9763
- `),U=[];W(...q,(j)=>{U.push(j)});let z=J??"inline.stx",B="";for(let j of U){let _={...Q};X.forEach((L,F)=>{_[L]=j[F]});let H=PY(Y,_,J,G);H=g1(H,_,z),H=W1(H,_,z),B+=H}return B}function kz($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=S$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!yY(W)){let j=$0("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(B),Q=!0;continue}try{let j=Object.keys(Z),_=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=SY(H);let F=Function(...j,`
9797
+ `),U=[];W(...q,(j)=>{U.push(j)});let z=J??"inline.stx",B="";for(let j of U){let _={...Q};X.forEach((L,F)=>{_[L]=j[F]});let H=PY(Y,_,J,G);H=g1(H,_,z),H=W1(H,_,z),B+=H}return B}function bz($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=S$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!yY(W)){let j=$0("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(B),Q=!0;continue}try{let j=Object.keys(Z),_=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=SY(H);let F=Function(...j,`
9764
9798
  let result = '';
9765
9799
  let maxIterations = ${Y}; // Configurable safety limit
9766
9800
  let counter = 0;
@@ -9772,21 +9806,21 @@ ${E}
9772
9806
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
9773
9807
  }
9774
9808
  return result;
9775
- `)(..._);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let _=$0("While",`Error in @while(${W}): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+_+X.substring(B),Q=!0}}return X}var wz=1000,Rz=!1,c4="<!--__STX_BREAK__-->",i4="<!--__STX_CONTINUE__-->";var I6=y(()=>{y4();J1();r0();y$();F0()});import U0 from"path";function E6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function bz($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function Sz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function yz($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
9776
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let _=z[2];if(!X.has(_))Y.push(_),X.add(_);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!X.has(_))Y.push(_),X.add(_);return}let j=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!X.has(_))Y.push(_),X.add(_)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function xY($,Z=""){return`
9809
+ `)(..._);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let _=$0("While",`Error in @while(${W}): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+_+X.substring(B),Q=!0}}return X}var Rz=1000,Az=!1,c4="<!--__STX_BREAK__-->",i4="<!--__STX_CONTINUE__-->";var I6=y(()=>{y4();Q1();r0();y$();F0()});import U0 from"path";function E6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function Sz($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function yz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function xY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
9810
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let _=z[2];if(!X.has(_))Y.push(_),X.add(_);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!X.has(_))Y.push(_),X.add(_);return}let j=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!X.has(_))Y.push(_),X.add(_)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function fY($,Z=""){let Y=xY($).split(",").map((X)=>X.trim()).filter(Boolean);return`
9777
9811
  (function() {
9778
- ${n1("var")}
9812
+ ${n1("var",Y)}
9779
9813
  var __destroyHooks = [];
9780
9814
  var __origOnDestroy = onDestroy;
9781
9815
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
9782
9816
 
9783
9817
  ${$}
9784
9818
  ${Z}})();
9785
- `}function fY($,Z){return`
9819
+ `}function gY($,Z){return`
9786
9820
  // Register scope variables for STX runtime
9787
9821
  if (!window.stx._scopes) window.stx._scopes = {};
9788
9822
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
9789
- ${yz($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
9823
+ ${xY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
9790
9824
  `)}
9791
9825
  // #1767: when the bundler renamed a component const that collided with an
9792
9826
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -9794,7 +9828,7 @@ ${yz($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
9794
9828
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
9795
9829
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
9796
9830
  window.stx._scopes['${Z}'] = __scopeRegistration;
9797
- `}function Pz($,Z){let Y=fY($,Z),X=`
9831
+ `}function Pz($,Z){let Y=gY($,Z),X=`
9798
9832
  (function() {
9799
9833
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
9800
9834
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -9803,29 +9837,29 @@ ${yz($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
9803
9837
  } finally {
9804
9838
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9805
9839
  }
9806
- })();`;return X+xY($,Y)+`
9840
+ })();`;return X+fY($,Y)+`
9807
9841
  } finally {
9808
9842
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9809
9843
  }
9810
- })();`}function Cz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function xz($){if($.__onceStore instanceof Set)return $.__onceStore;return vz}async function D6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=bz($,"@partial","@include"),q=xz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let A=R[1],N=W(A,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),N=E6(A,0);if(N===-1){L.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let k=I[1],E=M.substring(I[0].length),C,D=E6(E,0);if(D!==-1)C=E.substring(D+1).trim();try{let b=`Boolean(${T})`,P;if(J0(b)){let m=Q0(b,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let f=H?!P:P,g="";if(f){let m=W(k,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${k}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(R),L.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),f=K0("Include",`Error evaluating ${_} condition: ${P}`,Y,$,O);K=K.substring(0,O)+f+K.substring(R),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let k,E=T.trim();if(J0(E))k=Q0(E,Object.keys(Z))(...Object.values(Z));else k=Y0(E,Z);let C="";if(Array.isArray(k)&&k.length>0)for(let D of k){let b={...Z,[M]:D},P=await z(N,b,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),_.lastIndex=0}catch(k){let E=k instanceof Error?k.message:String(k);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,K=K.replace(R,"");continue}let N=A[1],T=w.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,D=1;while(D<T.length&&C>0){if(T[D]==="{")C++;else if(T[D]==="}"){if(C--,C===0)break}D++}M=T.substring(0,D+1),T=T.slice(D+1)}let k,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)k=E[1];try{let C=JSON.parse(N.replace(/'/g,'"')),D={};if(M)try{D=L0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(X.debug){let g=K0("Include",`Error parsing includeFirst variables: ${f}`,Y,$,L,R);K=K.replace(R,()=>g)}else K=K.replace(R,()=>k||"");continue}let b=!1;for(let P of C){let f=W(P,G,Y);if(!f)continue;if(await c(f)){let g=await z(P,D,$,L);K=K.replace(R,()=>g),b=!0;break}}if(!b)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let P=K0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,R);K=K.replace(R,()=>P)}else K=K.replace(R,"")}catch(C){let D=C instanceof Error?C.message:String(C),b=K0("Include",`Error processing @includeFirst: ${D}`,Y,$,L,R);K=K.replace(R,()=>b)}_.lastIndex=0}}function W(_,H,L){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let R=U0.normalize(w),A=R.startsWith(O+U0.sep)||R===O,N=R.startsWith(V+U0.sep)||R===V,T=!1,M=U0.dirname(V);if(R.startsWith(M+U0.sep)){if(!U0.relative(M,R).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(_,H={},L,F){let O=W(_,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${_}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>U0.basename(R)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return K0("Include",`Error loading include file ${_}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (o3(),n3));w=g(w,Z)}if(w&&(X.debug||!s5()&&!R4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (r3(),JY));g(w,O)}catch{}let R=w;try{let{processESImports:g}=await Promise.resolve().then(() => (T6(),EY));await g(w,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let A=E$(R);if(A)R=A.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(k)],C="",D=null;for(let g of E){let m=g[1]||"",a=g[2]||"",X0=m.includes("server"),e0=T1(m),x0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:R0}=await Promise.resolve().then(() => (S5(),k9)),d0=Z0(a,{filePath:O,projectRoot:process.cwd()});a=d0.code,x0=R0(d0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if(e0&&a.trim())a=M1(a);if(!X0)try{let{hasUserImports:Z0,bundleClientScript:R0}=await Promise.resolve().then(() => (E5(),I5));if(Z0(a))a=await R0(a,O,{projectRoot:process.cwd()})}catch(Z0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let N0=Sz(a);if(N0&&!X0){D=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vY}`;let Z0=u0(a),R0=Pz(Z0,D);C+=`${x0}<script data-stx-scoped>${R0}</script>
9811
- `;continue}if(X0)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (u5(),b$));await Z0(a,I,O)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!X0&&!N0){let Z0=m.replace(/\bclient\b/i,"").trim();D=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vY}`;let R0=u0(a),d0=fY(R0,D),$1=xY(R0,d0);C+=`${x0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${$1}</script>
9844
+ })();`}function Cz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function xz($){if($.__onceStore instanceof Set)return $.__onceStore;return vz}async function D6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=Sz($,"@partial","@include"),q=xz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let A=R[1],N=W(A,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),N=E6(A,0);if(N===-1){L.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let k=I[1],E=M.substring(I[0].length),C,D=E6(E,0);if(D!==-1)C=E.substring(D+1).trim();try{let b=`Boolean(${T})`,P;if(J0(b)){let m=Q0(b,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean(Y0(b,Z));let f=H?!P:P,g="";if(f){let m=W(k,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${k}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(R),L.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),f=K0("Include",`Error evaluating ${_} condition: ${P}`,Y,$,O);K=K.substring(0,O)+f+K.substring(R),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let k,E=T.trim();if(J0(E))k=Q0(E,Object.keys(Z))(...Object.values(Z));else k=Y0(E,Z);let C="";if(Array.isArray(k)&&k.length>0)for(let D of k){let b={...Z,[M]:D},P=await z(N,b,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),_.lastIndex=0}catch(k){let E=k instanceof Error?k.message:String(k);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,K=K.replace(R,"");continue}let N=A[1],T=w.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,D=1;while(D<T.length&&C>0){if(T[D]==="{")C++;else if(T[D]==="}"){if(C--,C===0)break}D++}M=T.substring(0,D+1),T=T.slice(D+1)}let k,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)k=E[1];try{let C=JSON.parse(N.replace(/'/g,'"')),D={};if(M)try{D=L0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(X.debug){let g=K0("Include",`Error parsing includeFirst variables: ${f}`,Y,$,L,R);K=K.replace(R,()=>g)}else K=K.replace(R,()=>k||"");continue}let b=!1;for(let P of C){let f=W(P,G,Y);if(!f)continue;if(await i(f)){let g=await z(P,D,$,L);K=K.replace(R,()=>g),b=!0;break}}if(!b)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let P=K0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,R);K=K.replace(R,()=>P)}else K=K.replace(R,"")}catch(C){let D=C instanceof Error?C.message:String(C),b=K0("Include",`Error processing @includeFirst: ${D}`,Y,$,L,R);K=K.replace(R,()=>b)}_.lastIndex=0}}function W(_,H,L){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let R=U0.normalize(w),A=R.startsWith(O+U0.sep)||R===O,N=R.startsWith(V+U0.sep)||R===V,T=!1,M=U0.dirname(V);if(R.startsWith(M+U0.sep)){if(!U0.relative(M,R).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(_,H={},L,F){let O=W(_,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${_}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>U0.basename(R)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return K0("Include",`Error loading include file ${_}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (o3(),n3));w=g(w,Z)}if(w&&(X.debug||!s5()&&!R4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (r3(),JY));g(w,O)}catch{}let R=w;try{let{processESImports:g}=await Promise.resolve().then(() => (T6(),EY));await g(w,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let A=E$(R);if(A)R=A.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(k)],C="",D=null;for(let g of E){let m=g[1]||"",a=g[2]||"",X0=m.includes("server"),e0=T1(m),x0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:R0}=await Promise.resolve().then(() => (S5(),k9)),d0=Z0(a,{filePath:O,projectRoot:process.cwd()});a=d0.code,x0=R0(d0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if(e0&&a.trim())a=M1(a);if(!X0)try{let{hasUserImports:Z0,bundleClientScript:R0}=await Promise.resolve().then(() => (E5(),I5));if(Z0(a))a=await R0(a,O,{projectRoot:process.cwd()})}catch(Z0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let N0=yz(a);if(N0&&!X0){D=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vY}`;let Z0=m0(a),R0=Pz(Z0,D);C+=`${x0}<script data-stx-scoped>${R0}</script>
9845
+ `;continue}if(X0)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (u5(),b$));await Z0(a,I,O)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!X0&&!N0){let Z0=m.replace(/\bclient\b/i,"").trim();D=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vY}`;let R0=m0(a),d0=gY(R0,D),$1=fY(R0,d0);C+=`${x0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${$1}</script>
9812
9846
  `}}if(D){let g=Cz(R,D);if(R=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${D}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),D=g.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await D6(R,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (I6(),CY)),P=b(R,I,O);P=g1(P,I,O);let f=i1(w);if(P=W1(P,I,O,{forceSignals:f}),M)P+=`
9813
9847
  `+M;if(C)P+=`
9814
9848
  `+C;return P}catch(w){let R=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${_}: ${R}`,Y,L,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let _=j.index,H=_+j[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(_,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let R=w[1],A,N=V.substring(w[0].length),T=E6(N,0);if(T!==-1)A=N.substring(T+1).trim();let M={};if(A)try{M=L0(A,Z)}catch(k){let E=k instanceof Error?k.message:String(k);K=K.replace(O,K0("Include",`Error parsing include variables for ${R}: ${E}`,Y,$,_)),B.lastIndex=0;continue}let I=await z(R,M,$,_);K=K.substring(0,_)+I+K.substring(F),B.lastIndex=0}return K}function k6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,j=z[1],_=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=_,V=-1;while(F>0&&O<q.length){let R=q.slice(O),A=R.match(H),N=R.match(L),T=A?O+A.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(A[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(_,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function b6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
9815
- `)})}var vY=0,kw,vz;var gY=y(()=>{F7();y4();r0();x5();r1();F0();O0();kw=new f5(500),vz=new Set});import*as S6 from"path";async function hY($,Z,Y=""){if(S6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return mY($,Z,Y,"@js","@endjs")}async function dY($,Z,Y=""){if(S6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return mY($,Z,Y,"@ts","@endts")}async function mY($,Z,Y,X,Q){let J=$,G=s1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),j=Object.values(Z),_=U.trim();if(X==="@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),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
9849
+ `)})}var vY=0,kw,vz;var hY=y(()=>{F7();y4();r0();x5();r1();F0();O0();kw=new f5(500),vz=new Set});import*as S6 from"path";async function dY($,Z,Y=""){if(S6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return uY($,Z,Y,"@js","@endjs")}async function mY($,Z,Y=""){if(S6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return uY($,Z,Y,"@ts","@endts")}async function uY($,Z,Y,X,Q){let J=$,G=s1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),j=Object.values(Z),_=U.trim();if(X==="@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),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
9816
9850
  ${_}
9817
9851
  ${F}
9818
- `,w=Function(...B,O)(...j);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let j=B instanceof Error?B.message:String(B),_=K0(`${X} Directive`,`Error executing code: ${j}`,Y,$,z,W);console.error(_),J=J.replace(W,"")}return J}var uY=y(()=>{r1();O0()});function fz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function lY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return fz(X,J||"_method")})}async function pY($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
9819
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${l0(W)}</div>
9820
- `)}}}return J}async function cY($,Z,Y,X){return pY($,Z,Y,X,"before")}async function iY($,Z,Y,X){return pY($,Z,Y,X,"after")}var nY=y(()=>{r0();O0()});import{defineRoute as uw,defineRoutes as lw,resetRoutes as pw,route as cw,setAppUrl as iw}from"stx-router";import{route as gz}from"stx-router";function oY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?L0(Q,{}):{};return gz(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var sY=y(()=>{F0()});async function rY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(J$.exact[$])for(let X of J$.exact[$])await Promise.resolve(X(Z,$));if(J$.exact[Y])for(let X of J$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of J$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var J$;var aY=y(()=>{J$={patterns:[],exact:{}}});function tY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>tY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function eY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,_=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=tY(R);if(A){let N=j.match(/\sclass="([^"]*)"/);if(N)j=j.replace(N[0],` class="${N[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");_=!0;continue}if(hz.has(H)){if(R)j=j.replace(B[0],` ${H}`);else j=j.replace(B[0],"");_=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${H}="${A}"`)}_=!0}catch{continue}}if(_){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${j}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var hz;var $X=y(()=>{hz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function d1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||dz.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function uz($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=uz($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function ZX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function W5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function F1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function V1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function lz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function pz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=F1(X.attrs,"v-for"),U=F1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U),_=`@foreach(${q})
9852
+ `,w=Function(...B,O)(...j);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let j=B instanceof Error?B.message:String(B),_=K0(`${X} Directive`,`Error executing code: ${j}`,Y,$,z,W);console.error(_),J=J.replace(W,"")}return J}var lY=y(()=>{r1();O0()});function fz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function pY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return fz(X,J||"_method")})}async function cY($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
9853
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${u0(W)}</div>
9854
+ `)}}}return J}async function iY($,Z,Y,X){return cY($,Z,Y,X,"before")}async function nY($,Z,Y,X){return cY($,Z,Y,X,"after")}var oY=y(()=>{r0();O0()});import{defineRoute as uw,defineRoutes as lw,resetRoutes as pw,route as cw,setAppUrl as iw}from"stx-router";import{route as gz}from"stx-router";function sY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?L0(Q,{}):{};return gz(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var rY=y(()=>{F0()});async function aY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(J$.exact[$])for(let X of J$.exact[$])await Promise.resolve(X(Z,$));if(J$.exact[Y])for(let X of J$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of J$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var J$;var tY=y(()=>{J$={patterns:[],exact:{}}});function eY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>eY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $X($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,_=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=eY(R);if(A){let N=j.match(/\sclass="([^"]*)"/);if(N)j=j.replace(N[0],` class="${N[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");_=!0;continue}if(hz.has(H)){if(R)j=j.replace(B[0],` ${H}`);else j=j.replace(B[0],"");_=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${H}="${A}"`)}_=!0}catch{continue}}if(_){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${j}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var hz;var ZX=y(()=>{hz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function d1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||dz.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function uz($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=uz($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function YX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function W5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function F1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function V1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function lz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function pz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=F1(X.attrs,"v-for"),U=F1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U),_=`@foreach(${q})
9821
9855
  `,H=`${_}${j}
9822
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+_.length}return Z}function cz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=a0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=d1(Z,W+L);if(!F){U=!1;break}let O=W5(F.attrs,"v-else-if"),V=ZX(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),R=F1(F.attrs,"v-else-if"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),R=F1(F.attrs,"v-else"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
9856
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+_.length}return Z}function cz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=a0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=d1(Z,W+L);if(!F){U=!1;break}let O=W5(F.attrs,"v-else-if"),V=YX(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),R=F1(F.attrs,"v-else-if"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),R=F1(F.attrs,"v-else"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
9823
9857
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
9824
9858
  ${H.element}`);else z.push(`@else
9825
9859
  ${H.element}`);z.push("@endif");let B=z.join(`
9826
- `),j=J[0].outerStart,_=J[J.length-1].outerEnd;Z=Z.slice(0,j)+B+Z.slice(_),Y=j+B.length}return Z}function iz($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function nz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=a0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=V1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=W5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(mz.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length}}return Z}function oz($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function sz($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function rz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=a0(Z,X),G=F1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function az($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=a0(Z,X),G=F1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function tz($){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 ez($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;if(!ZX(X.attrs,"v-once")){Y=X.end;continue}let Q=F1(X.attrs,"v-once"),J=a0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
9860
+ `),j=J[0].outerStart,_=J[J.length-1].outerEnd;Z=Z.slice(0,j)+B+Z.slice(_),Y=j+B.length}return Z}function iz($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function nz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=a0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=V1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=W5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(mz.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=a0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),j=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length}}return Z}function oz($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function sz($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function rz($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=a0(Z,X),G=F1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function az($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;let Q=W5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=a0(Z,X),G=F1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function tz($){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 ez($){let Z=$,Y=0;while(Y<Z.length){let X=d1(Z,Y);if(!X)break;if(!YX(X.attrs,"v-once")){Y=X.end;continue}let Q=F1(X.attrs,"v-once"),J=a0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
9827
9861
  ${V1(G,{...X,start:0,end:X.end-X.start},Q)}
9828
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function $B($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ZB($){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 YX($){if(!lz($))return $;let Z=$;return Z=pz(Z),Z=cz(Z),Z=ez(Z),Z=oz(Z),Z=sz(Z),Z=nz(Z),Z=iz(Z),Z=ZB(Z),Z=rz(Z),Z=az(Z),Z=tz(Z),Z=$B(Z),Z}var dz,mz;var XX=y(()=>{dz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mz=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 n4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function JX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${n4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=_.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{j[O]=Y0(V,Z)}catch{j[O]=V}else j[O]=V}let L=X.componentsDir||"components",F=await S1(z,j,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${n4(B)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await YB(J,Z,Y,X,Q),J}async function YB($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let _=`<!-- dynamic component: could not resolve "${n4(U.expr)}" -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await S1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${n4(B)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var QX=y(()=>{O0();F0()});function GX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
9862
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function $B($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ZB($){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 XX($){if(!lz($))return $;let Z=$;return Z=pz(Z),Z=cz(Z),Z=ez(Z),Z=oz(Z),Z=sz(Z),Z=nz(Z),Z=iz(Z),Z=ZB(Z),Z=rz(Z),Z=az(Z),Z=tz(Z),Z=$B(Z),Z}var dz,mz;var JX=y(()=>{dz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mz=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 n4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function QX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${n4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=_.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{j[O]=Y0(V,Z)}catch{j[O]=V}else j[O]=V}let L=X.componentsDir||"components",F=await S1(z,j,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${n4(B)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await YB(J,Z,Y,X,Q),J}async function YB($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let _=`<!-- dynamic component: could not resolve "${n4(U.expr)}" -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await S1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${n4(B)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var GX=y(()=>{O0();F0()});function KX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
9829
9863
  ${$.slice(Z)}`}function XB($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,_=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
9830
9864
  `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
9831
9865
  `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([N])=>N!=="content").map(([N,T])=>`${N}="${T}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
@@ -9839,25 +9873,25 @@ ${V.join(`
9839
9873
  ${w.join(`
9840
9874
  `)}
9841
9875
  </body>
9842
- </html>`}function y6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function KX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
9876
+ </html>`}function y6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function qX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
9843
9877
  `)}
9844
- ${$.slice(Y)}`}function qX($,Z={},Y={}){if(y6($))return $;return XB($,Z,Y)}import U5 from"path";function WX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function UX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=U5.join(Q,$);if(await Bun.file(G).exists())return G;Q=U5.dirname(Q)}X=U5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=U5.resolve(Z,$);else X=U5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function zX($,Z,Y){let X=$,Q=U5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(WX(z))continue;let j=await UX(z,Q,Z);if(j)try{let _=await Bun.file(j).text();if(Y.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:f0()});if(L.outputs.length>0)_=await L.outputs[0].text()}let H=`<script>
9878
+ ${$.slice(Y)}`}function WX($,Z={},Y={}){if(y6($))return $;return XB($,Z,Y)}import U5 from"path";function UX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function zX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=U5.join(Q,$);if(await Bun.file(G).exists())return G;Q=U5.dirname(Q)}X=U5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=U5.resolve(Z,$);else X=U5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function BX($,Z,Y){let X=$,Q=U5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(UX(z))continue;let j=await zX(z,Q,Z);if(j)try{let _=await Bun.file(j).text();if(Y.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:f0()});if(L.outputs.length>0)_=await L.outputs[0].text()}let H=`<script>
9845
9879
  // Source: ${z}
9846
9880
  ${_}
9847
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(_){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,j=U+B;if(WX(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let H=await UX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9881
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(_){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,j=U+B;if(UX(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let H=await zX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9848
9882
  /* Source: ${z} */
9849
9883
  ${L}
9850
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var BX=y(()=>{A1()});function o4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),j=-1,_=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")_++;else if(w===")"||w==="]"||w==="}")_--;if(w===","&&_===0){j=V;break}}let F=j>=0?z.substring(0,j).trim():z,O=j>=0?z.substring(j+1).trim():void 0;try{let V=F.trim(),w;if(J0(V))w=Q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){c0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function s4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let j=z.slice(0,B),_=U+B+8,H=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=j.slice(L),O=j.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,k=`<${T}${M} data-stx-memo="${W}"${I}>`;A=j.slice(0,L)+k+w.slice(N.length)+j.slice(L+w.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${j.slice(L+w.length)}`;Q.push({start:J,end:_,replacement:A}),Y.lastIndex=_}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function P6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function _X($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),_=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function HX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let _=`</${G}>`,H=$.toLowerCase().indexOf(_,J);if(H!==-1)Z.lastIndex=H+_.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!JB.test(z))continue;let B=$[U-1]==="/",j=B?U-1:U;Y+=`${$.slice(X,j)} x-cloak${B?" ":""}`,X=j}return Y+=$.slice(X),Y}var JB;var C6=y(()=>{J1();F0();JB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function r4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of QB){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9884
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var jX=y(()=>{A1()});function o4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),j=-1,_=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")_++;else if(w===")"||w==="]"||w==="}")_--;if(w===","&&_===0){j=V;break}}let F=j>=0?z.substring(0,j).trim():z,O=j>=0?z.substring(j+1).trim():void 0;try{let V=F.trim(),w;if(J0(V))w=Q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){p0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function s4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function _X($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let j=z.slice(0,B),_=U+B+8,H=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=j.slice(L),O=j.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,k=`<${T}${M} data-stx-memo="${W}"${I}>`;A=j.slice(0,L)+k+w.slice(N.length)+j.slice(L+w.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${j.slice(L+w.length)}`;Q.push({start:J,end:_,replacement:A}),Y.lastIndex=_}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function P6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function HX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),_=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function OX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let _=`</${G}>`,H=$.toLowerCase().indexOf(_,J);if(H!==-1)Z.lastIndex=H+_.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!JB.test(z))continue;let B=$[U-1]==="/",j=B?U-1:U;Y+=`${$.slice(X,j)} x-cloak${B?" ":""}`,X=j}return Y+=$.slice(X),Y}var JB;var C6=y(()=>{Q1();F0();JB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function r4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of QB){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9851
9885
  `),z=[];U.forEach((j,_)=>{if(G.lastIndex=0,G.test(j))z.push(_+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
9852
9886
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9853
9887
  ${J.join(`
9854
9888
  `)}
9855
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var QB;var v6=y(()=>{QB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var OX={};o(OX,{getStoreScript:()=>GB,clearStoreCache:()=>KB});import a4 from"path";async function GB($){let Z;if($)Z=a4.resolve($);else{let U=await X5();Z=a4.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=z5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=a4.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return z5.set(Z,""),null}if(Q.length===0)return z5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()});for(let U of G)try{let z=await Bun.file(U).text(),B=a4.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9889
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var QB;var v6=y(()=>{QB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var LX={};o(LX,{getStoreScript:()=>GB,clearStoreCache:()=>KB});import a4 from"path";async function GB($){let Z;if($)Z=a4.resolve($);else{let U=await X5();Z=a4.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=z5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=a4.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return z5.set(Z,""),null}if(Q.length===0)return z5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()});for(let U of G)try{let z=await Bun.file(U).text(),B=a4.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9856
9890
  ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return z5.set(Z,""),null;let W=`;(function(){
9857
9891
  ${K.join(`
9858
9892
 
9859
9893
  `)}
9860
- })();`;return z5.set(Z,W),W}function KB(){z5.clear()}var z5;var LX=y(()=>{J5();A1();z5=new Map});var VX={};o(VX,{getComposableScript:()=>zB,clearComposableCache:()=>BB});import Q$ from"path";function FX($){let Z=Q$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function WB($){if($)return Q$.resolve($);let Z=`<default>:${process.cwd()}`,Y=x6.get(Z);if(Y!==void 0)return Y;let X=await UB();return x6.set(Z,X),X}async function UB(){let $=await X5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return Q$.resolve(Z,Y);for(let X of qB){let Q=Q$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!FX(G))return Q}catch{}}return null}async function zB($){let Z=await WB($);if(!Z)return null;let Y=B5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:Z,absolute:!0})){if(FX(_))continue;X.push(_)}}catch{return B5.set(Z,""),null}if(X.length===0)return B5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}),J=[],G=new Set,K=new Set;for(let j of X)try{let _=await Bun.file(j).text(),H=Q$.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(_).exports)if(L!=="default")G.add(L)}catch{}_=u0(_),_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),J.push(`// Composable: ${H}
9894
+ })();`;return z5.set(Z,W),W}function KB(){z5.clear()}var z5;var FX=y(()=>{J5();A1();z5=new Map});var wX={};o(wX,{getComposableScript:()=>zB,clearComposableCache:()=>BB});import Q$ from"path";function VX($){let Z=Q$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function WB($){if($)return Q$.resolve($);let Z=`<default>:${process.cwd()}`,Y=x6.get(Z);if(Y!==void 0)return Y;let X=await UB();return x6.set(Z,X),X}async function UB(){let $=await X5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return Q$.resolve(Z,Y);for(let X of qB){let Q=Q$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!VX(G))return Q}catch{}}return null}async function zB($){let Z=await WB($);if(!Z)return null;let Y=B5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:Z,absolute:!0})){if(VX(_))continue;X.push(_)}}catch{return B5.set(Z,""),null}if(X.length===0)return B5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}),J=[],G=new Set,K=new Set;for(let j of X)try{let _=await Bun.file(j).text(),H=Q$.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(_).exports)if(L!=="default")G.add(L)}catch{}_=m0(_),_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),J.push(`// Composable: ${H}
9861
9895
  ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(J.length===0||G.size===0)return B5.set(Z,""),null;let q=[...G].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
9862
9896
  `),W=JSON.stringify([...G]),U=J.join(`
9863
9897
 
@@ -9882,7 +9916,7 @@ ${q}
9882
9916
  }
9883
9917
  window[__n] = __c[__n];
9884
9918
  }
9885
- })();`;return B5.set(Z,B),B}function BB(){B5.clear(),x6.clear()}var B5,x6,qB;var wX=y(()=>{J5();A1();x5();B5=new Map,x6=new Map,qB=["composables","functions"]});var AX={};o(AX,{processDeferDirectives:()=>LB});function jB(){return`stx-defer-${++RX}`}function _B($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function HB($,Z,Y){let{trigger:X,value:Q}=_B(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function OB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9919
+ })();`;return B5.set(Z,B),B}function BB(){B5.clear(),x6.clear()}var B5,x6,qB;var RX=y(()=>{J5();A1();x5();B5=new Map,x6=new Map,qB=["composables","functions"]});var NX={};o(NX,{processDeferDirectives:()=>LB});function jB(){return`stx-defer-${++AX}`}function _B($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function HB($,Z,Y){let{trigger:X,value:Q}=_B(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function OB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9886
9920
  const observer = new IntersectionObserver((entries) => {
9887
9921
  if (entries[0].isIntersecting) {
9888
9922
  observer.disconnect();
@@ -9955,7 +9989,7 @@ else {
9955
9989
  ${Q}
9956
9990
  })();
9957
9991
  </script>
9958
- `}function LB($,Z,Y){RX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=jB(),q=HB(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,j=OB(K,q);return`
9992
+ `}function LB($,Z,Y){AX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=jB(),q=HB(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,j=OB(K,q);return`
9959
9993
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
9960
9994
  ${W}
9961
9995
  ${U}
@@ -9963,7 +9997,7 @@ else {
9963
9997
  ${z}
9964
9998
  </div>
9965
9999
  ${j}
9966
- `})}var RX=0;var TX={};o(TX,{processTeleportDirectives:()=>RB,ensureTeleportTargets:()=>AB});function FB(){return`stx-teleport-${++NX}`}function VB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function wB($,Z){return`
10000
+ `})}var AX=0;var MX={};o(MX,{processTeleportDirectives:()=>RB,ensureTeleportTargets:()=>AB});function FB(){return`stx-teleport-${++TX}`}function VB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function wB($,Z){return`
9967
10001
  <script>
9968
10002
  (function() {
9969
10003
  const source = document.getElementById('${$}');
@@ -10009,7 +10043,7 @@ else {
10009
10043
  });
10010
10044
  })();
10011
10045
  </script>
10012
- `}function RB($,Z,Y){NX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=FB(),{target:q,disabled:W}=VB(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=wB(K,q);return`
10046
+ `}function RB($,Z,Y){TX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=FB(),{target:q,disabled:W}=VB(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=wB(K,q);return`
10013
10047
  <div id="${K}" class="stx-teleport-source" style="display: none;">
10014
10048
  <template>${U}</template>
10015
10049
  </div>
@@ -10031,7 +10065,7 @@ else {
10031
10065
  });
10032
10066
  })();
10033
10067
  </script>
10034
- `}var NX=0;var DX={};o(DX,{processTransitionDirectives:()=>IB,processTransitionAttributes:()=>bB,performLeave:()=>MB,performEnter:()=>TB,generateTransitionRuntime:()=>kB,generateTransitionCSS:()=>DB});function MX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function NB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function IX($,Z){return new Promise((Y)=>{let X=Z??NB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function EX($){$.offsetHeight}async function TB($,Z={}){let Y=Z.name||"stx",X=MX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),EX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await IX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function MB($,Z={}){let Y=Z.name||"stx",X=MX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),EX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await IX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function IB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=EB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10068
+ `}var TX=0;var kX={};o(kX,{processTransitionDirectives:()=>IB,processTransitionAttributes:()=>bB,performLeave:()=>MB,performEnter:()=>TB,generateTransitionRuntime:()=>kB,generateTransitionCSS:()=>DB});function IX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function NB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function EX($,Z){return new Promise((Y)=>{let X=Z??NB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function DX($){$.offsetHeight}async function TB($,Z={}){let Y=Z.name||"stx",X=IX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),DX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await EX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function MB($,Z={}){let Y=Z.name||"stx",X=IX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),DX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await EX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function IB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=EB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10035
10069
  <div
10036
10070
  class="stx-transition-wrapper"
10037
10071
  data-transition="${q}"
@@ -10349,7 +10383,7 @@ else {
10349
10383
 
10350
10384
  console.log('[stx] Transition runtime initialized');
10351
10385
  })();
10352
- `}function bB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var bX={};o(bX,{withErrorBoundary:()=>kX,processErrorBoundaryDirectives:()=>PB,generateErrorBoundaryRuntime:()=>gB,generateErrorBoundaryCSS:()=>fB,createErrorBoundary:()=>xB});function yB(){return`eb-${++SB}-${Date.now().toString(36)}`}function PB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=yB(),W=CB(J||"");return vB(q,G.trim(),K.trim(),W)})}function CB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function vB($,Z,Y,X){let Q=X.logErrors!==!1;return`
10386
+ `}function bB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var SX={};o(SX,{withErrorBoundary:()=>bX,processErrorBoundaryDirectives:()=>PB,generateErrorBoundaryRuntime:()=>gB,generateErrorBoundaryCSS:()=>fB,createErrorBoundary:()=>xB});function yB(){return`eb-${++SB}-${Date.now().toString(36)}`}function PB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=yB(),W=CB(J||"");return vB(q,G.trim(),K.trim(),W)})}function CB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function vB($,Z,Y,X){let Q=X.logErrors!==!1;return`
10353
10387
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
10354
10388
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
10355
10389
  ${Z}
@@ -10469,7 +10503,7 @@ else {
10469
10503
  };
10470
10504
  })();
10471
10505
  </script>
10472
- `}async function kX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function xB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>kX(X,$,Y)}function fB(){return`
10506
+ `}async function bX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function xB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>bX(X,$,Y)}function fB(){return`
10473
10507
  /* STX Error Boundary Styles */
10474
10508
  .stx-error-boundary {
10475
10509
  position: relative;
@@ -10578,7 +10612,7 @@ else {
10578
10612
 
10579
10613
  console.log('[stx] Error boundary runtime initialized');
10580
10614
  })();
10581
- `}var SB=0;var SX={};o(SX,{renderSSRSuspense:()=>cB,processSuspenseDirectives:()=>mB,generateSuspenseRuntime:()=>nB,generateSuspenseCSS:()=>iB,createSSRSuspense:()=>pB});function dB(){return`suspense-${++hB}-${Date.now().toString(36)}`}function mB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=dB(),W=uB(J||"");return lB(q,G.trim(),K.trim(),W)})}function uB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function lB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10615
+ `}var SB=0;var yX={};o(yX,{renderSSRSuspense:()=>cB,processSuspenseDirectives:()=>mB,generateSuspenseRuntime:()=>nB,generateSuspenseCSS:()=>iB,createSSRSuspense:()=>pB});function dB(){return`suspense-${++hB}-${Date.now().toString(36)}`}function mB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=dB(),W=uB(J||"");return lB(q,G.trim(),K.trim(),W)})}function uB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function lB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10582
10616
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
10583
10617
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10584
10618
  ${Y}
@@ -10916,7 +10950,7 @@ else {
10916
10950
 
10917
10951
  console.log('[stx] Suspense runtime initialized');
10918
10952
  })();
10919
- `}var hB=0;var vX={};o(vX,{processAsyncDirectives:()=>sB,isAsyncComponent:()=>aB,generateAsyncComponentRuntime:()=>eB,generateAsyncComponentCSS:()=>tB,defineAsyncComponent:()=>rB});function yX(){return`async-${++oB}-${Date.now().toString(36)}`}function sB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=yX(),z=PX(K);return CX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=yX(),U=PX(K);return CX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function PX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function CX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10953
+ `}var hB=0;var xX={};o(xX,{processAsyncDirectives:()=>sB,isAsyncComponent:()=>aB,generateAsyncComponentRuntime:()=>eB,generateAsyncComponentCSS:()=>tB,defineAsyncComponent:()=>rB});function PX(){return`async-${++oB}-${Date.now().toString(36)}`}function sB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=PX(),z=CX(K);return vX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=PX(),U=CX(K);return vX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function CX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function vX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10920
10954
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
10921
10955
  <div class="stx-async-loading" data-async-loading="${$}">
10922
10956
  ${Y}
@@ -11271,7 +11305,7 @@ catch (error) {
11271
11305
 
11272
11306
  console.log('[stx] Async component runtime initialized');
11273
11307
  })();
11274
- `}var oB=0;var fX={};o(fX,{shouldCacheComponent:()=>Qj,processKeepAliveDirectives:()=>Zj,onDeactivated:()=>Wj,onActivated:()=>qj,generateKeepAliveRuntime:()=>Kj,generateKeepAliveCSS:()=>Gj,createKeepAliveCache:()=>Jj});function xX(){return`keep-alive-${++$j}-${Date.now().toString(36)}`}function Zj($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=xX(),q=Yj(J||"");return Xj(K,G.trim(),q)})}function Yj($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function Xj($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
11308
+ `}var oB=0;var gX={};o(gX,{shouldCacheComponent:()=>Qj,processKeepAliveDirectives:()=>Zj,onDeactivated:()=>Wj,onActivated:()=>qj,generateKeepAliveRuntime:()=>Kj,generateKeepAliveCSS:()=>Gj,createKeepAliveCache:()=>Jj});function fX(){return`keep-alive-${++$j}-${Date.now().toString(36)}`}function Zj($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=fX(),q=Yj(J||"");return Xj(K,G.trim(),q)})}function Yj($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function Xj($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
11275
11309
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
11276
11310
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
11277
11311
  ${Z}
@@ -11558,7 +11592,7 @@ else {
11558
11592
  });
11559
11593
  })();
11560
11594
  </script>
11561
- `}function Jj($={}){return{id:$.id||xX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function Qj($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Gj(){return`
11595
+ `}function Jj($={}){return{id:$.id||fX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function Qj($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Gj(){return`
11562
11596
  /* STX Keep-Alive Styles */
11563
11597
  .stx-keep-alive {
11564
11598
  position: relative;
@@ -11619,7 +11653,7 @@ else {
11619
11653
 
11620
11654
  console.log('[stx] Keep-alive runtime initialized');
11621
11655
  })();
11622
- `}function qj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Wj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var $j=0;var uX={};o(uX,{useVirtualList:()=>hX,processVirtualListDirectives:()=>g6,processVirtualGridDirectives:()=>mX,processInfiniteListDirectives:()=>dX,generateVirtualListCSS:()=>gX,default:()=>Uj,createVirtualList:()=>f6});function f6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+I>U){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+=I,A>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function _(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=z.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=z.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:U,totalHeight:_(),visibleItems:W.slice(A,N+1),itemHeights:new Map(z)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){U=Math.max(0,Math.min(A,_()-X))}function V(){B()}function w(A){W=[...A],z.clear(),V()}function R(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:R}}function g6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,_=0,H=Math.min(W.length-1,B+j),L="";for(let O=_;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11656
+ `}function qj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Wj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var $j=0;var lX={};o(lX,{useVirtualList:()=>dX,processVirtualListDirectives:()=>g6,processVirtualGridDirectives:()=>uX,processInfiniteListDirectives:()=>mX,generateVirtualListCSS:()=>hX,default:()=>Uj,createVirtualList:()=>f6});function f6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+I>U){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+=I,A>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function _(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=z.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=z.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:U,totalHeight:_(),visibleItems:W.slice(A,N+1),itemHeights:new Map(z)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){U=Math.max(0,Math.min(A,_()-X))}function V(){B()}function w(A){W=[...A],z.clear(),V()}function R(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:R}}function g6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,_=0,H=Math.min(W.length-1,B+j),L="";for(let O=_;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11623
11657
  <div class="virtual-item ${U.itemClass||""}"
11624
11658
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11625
11659
  data-index="${O}">
@@ -11696,7 +11730,7 @@ else {
11696
11730
  };
11697
11731
  })();
11698
11732
  </script>
11699
- `})}function gX(){return`
11733
+ `})}function hX(){return`
11700
11734
  .virtual-list-container {
11701
11735
  position: relative;
11702
11736
  overflow-y: auto;
@@ -11744,7 +11778,7 @@ else {
11744
11778
  0% { background-position: 200% 0; }
11745
11779
  100% { background-position: -200% 0; }
11746
11780
  }
11747
- `}function hX($,Z){let Y=null,X=()=>{if(!Y)Y=f6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function dX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let _=Function(`return ${G.trim()}`)();z={...z,..._}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,j=g6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
11781
+ `}function dX($,Z){let Y=null,X=()=>{if(!Y)Y=f6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function mX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let _=Function(`return ${G.trim()}`)();z={...z,..._}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,j=g6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
11748
11782
  // Infinite scroll detection
11749
11783
  container.addEventListener('scroll', function() {
11750
11784
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11762,7 +11796,7 @@ else {
11762
11796
  ${q}
11763
11797
  </div>
11764
11798
  </div>
11765
- `})}function mX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),_=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,_+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=W.length)break;let A=W[R],N=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,k)=>{if(typeof A==="object"&&A!==null)return String(A[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
11799
+ `})}function uX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),_=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,_+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=W.length)break;let A=W[R],N=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,k)=>{if(typeof A==="object"&&A!==null)return String(A[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
11766
11800
  <div class="virtual-grid-item"
11767
11801
  style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
11768
11802
  data-index="${R}">
@@ -11832,7 +11866,7 @@ else {
11832
11866
  });
11833
11867
  })();
11834
11868
  </script>
11835
- `})}var Uj;var lX=y(()=>{Uj={createVirtualList:f6,processVirtualListDirectives:g6,processInfiniteListDirectives:dX,processVirtualGridDirectives:mX,generateVirtualListCSS:gX,useVirtualList:hX}});function pX(){return`<script data-stx-hydration-runtime>
11869
+ `})}var Uj;var pX=y(()=>{Uj={createVirtualList:f6,processVirtualListDirectives:g6,processInfiniteListDirectives:mX,processVirtualGridDirectives:uX,generateVirtualListCSS:hX,useVirtualList:dX}});function cX(){return`<script data-stx-hydration-runtime>
11836
11870
  (function() {
11837
11871
  'use strict';
11838
11872
 
@@ -11992,7 +12026,7 @@ else {
11992
12026
  stxIslands.initIslands();
11993
12027
  }
11994
12028
  })();
11995
- </script>`}function cX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function iX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var XJ={};o(XJ,{processStaticDirectives:()=>ZJ,processPartialHydrationDirectives:()=>oX,onHydrated:()=>$J,isHydrated:()=>eX,hydrateIsland:()=>rX,hydrateByStrategy:()=>aX,hydrateAll:()=>tX,generatePartialHydrationCSS:()=>sX,generateIslandManifest:()=>YJ,default:()=>Fj,createIslandRegistry:()=>nX});function nX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function zj($){return`
12029
+ </script>`}function iX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function nX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var JJ={};o(JJ,{processStaticDirectives:()=>YJ,processPartialHydrationDirectives:()=>sX,onHydrated:()=>ZJ,isHydrated:()=>$J,hydrateIsland:()=>aX,hydrateByStrategy:()=>tX,hydrateAll:()=>eX,generatePartialHydrationCSS:()=>rX,generateIslandManifest:()=>XJ,default:()=>Fj,createIslandRegistry:()=>oX});function oX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function zj($){return`
11996
12030
  <script data-hydrate="${$}">
11997
12031
  (function() {
11998
12032
  const island = document.querySelector('[data-island="${$}"]');
@@ -12144,8 +12178,8 @@ else {
12144
12178
  });
12145
12179
  })();
12146
12180
  </script>
12147
- `}function oX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=j5(X,"load",Z),X=j5(X,"idle",Z),X=j5(X,"visible",Z),X=j5(X,"media",Z),X=Lj(X),X=j5(X,"hover",Z),X=j5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12148
- `+pX();return X}function j5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=cX(G.trim()),U=iX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let j=Object.keys(U).length>0?`
12181
+ `}function sX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=j5(X,"load",Z),X=j5(X,"idle",Z),X=j5(X,"visible",Z),X=j5(X,"media",Z),X=Lj(X),X=j5(X,"hover",Z),X=j5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12182
+ `+cX();return X}function j5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=iX(G.trim()),U=nX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let j=Object.keys(U).length>0?`
12149
12183
  <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",_="";switch(Z){case"load":_=zj(q);break;case"idle":_=Bj(q,K);break;case"visible":_=jj(q,K);break;case"media":_=_j(q,K);break;case"hover":_=Hj(q);break;case"event":_=Oj(q,K);break}return`
12150
12184
  <div data-island="${q}"
12151
12185
  data-strategy="${Z}"
@@ -12175,7 +12209,7 @@ else {
12175
12209
  }
12176
12210
  })();
12177
12211
  </script>
12178
- `})}function sX(){return`
12212
+ `})}function rX(){return`
12179
12213
  /* Island base styles */
12180
12214
  .stx-island {
12181
12215
  display: contents;
@@ -12216,11 +12250,11 @@ else {
12216
12250
  .stx-island.hydrated {
12217
12251
  opacity: 1;
12218
12252
  }
12219
- `}function rX($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function aX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function tX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function eX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function $J($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function ZJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function YJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12253
+ `}function aX($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function tX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function eX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function $J($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function ZJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function YJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function XJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12220
12254
  <script type="application/json" id="stx-island-manifest">
12221
12255
  ${JSON.stringify(Z)}
12222
12256
  </script>
12223
- `}var Fj;var JJ=y(()=>{Fj={processPartialHydrationDirectives:oX,processStaticDirectives:ZJ,generatePartialHydrationCSS:sX,generateIslandManifest:YJ,createIslandRegistry:nX,hydrateIsland:rX,hydrateByStrategy:aX,hydrateAll:tX,isHydrated:eX,onHydrated:$J}});var HJ={};o(HJ,{watchMultiple:()=>WJ,watchEffect:()=>UJ,watch:()=>qJ,unref:()=>QJ,toRefs:()=>GJ,throttledComputed:()=>_J,stxWatchMultiple:()=>WJ,stxWatchEffect:()=>UJ,stxWatch:()=>qJ,stxUnref:()=>QJ,stxToRefs:()=>GJ,stxThrottledComputed:()=>_J,stxShallowRef:()=>KJ,stxRef:()=>_5,stxIsRef:()=>w1,stxDebouncedComputed:()=>jJ,stxComputed:()=>K$,shallowRef:()=>KJ,ref:()=>_5,processWatchDirectives:()=>BJ,processComputedDirectives:()=>zJ,isRef:()=>w1,default:()=>Vj,debouncedComputed:()=>jJ,computed:()=>K$});function _5($){let Z=$,Y=new Set,X={get value(){if(t0){let Q=G$.get(X);if(!Q)Q=new Set,G$.set(X,Q);Q.add(t0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=G$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function w1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function QJ($){return w1($)?$.value:$}function GJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=_5($[Y]);return Z}function KJ($){return _5($)}function K$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=t0;t0=W,t4.push(W);try{return Y()}finally{t4.pop(),t0=B}}let z={get value(){if(t0){let B=G$.get(z);if(!B)B=new Set,G$.set(z,B);B.add(t0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function qJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(w1($))return Q?m1($.value):$.value;return $()},z=()=>{if(!q||W)return;let _=U();if(K!==void 0&&Object.is(K,_)&&!Q)return;let H=()=>{if(Z(_,K),K=Q?m1(_):_,G)j()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(w1($))B=$.subscribe(()=>z());else B=K$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{W=!0},j.resume=()=>{W=!1},j}function WJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>w1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>w1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(w1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function UJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=t0;t0=G,t4.push(G);try{X=$()}finally{t4.pop(),t0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function zJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function BJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
12257
+ `}var Fj;var QJ=y(()=>{Fj={processPartialHydrationDirectives:sX,processStaticDirectives:YJ,generatePartialHydrationCSS:rX,generateIslandManifest:XJ,createIslandRegistry:oX,hydrateIsland:aX,hydrateByStrategy:tX,hydrateAll:eX,isHydrated:$J,onHydrated:ZJ}});var OJ={};o(OJ,{watchMultiple:()=>UJ,watchEffect:()=>zJ,watch:()=>WJ,unref:()=>GJ,toRefs:()=>KJ,throttledComputed:()=>HJ,stxWatchMultiple:()=>UJ,stxWatchEffect:()=>zJ,stxWatch:()=>WJ,stxUnref:()=>GJ,stxToRefs:()=>KJ,stxThrottledComputed:()=>HJ,stxShallowRef:()=>qJ,stxRef:()=>_5,stxIsRef:()=>w1,stxDebouncedComputed:()=>_J,stxComputed:()=>K$,shallowRef:()=>qJ,ref:()=>_5,processWatchDirectives:()=>jJ,processComputedDirectives:()=>BJ,isRef:()=>w1,default:()=>Vj,debouncedComputed:()=>_J,computed:()=>K$});function _5($){let Z=$,Y=new Set,X={get value(){if(t0){let Q=G$.get(X);if(!Q)Q=new Set,G$.set(X,Q);Q.add(t0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=G$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function w1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function GJ($){return w1($)?$.value:$}function KJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=_5($[Y]);return Z}function qJ($){return _5($)}function K$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=t0;t0=W,t4.push(W);try{return Y()}finally{t4.pop(),t0=B}}let z={get value(){if(t0){let B=G$.get(z);if(!B)B=new Set,G$.set(z,B);B.add(t0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function WJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(w1($))return Q?m1($.value):$.value;return $()},z=()=>{if(!q||W)return;let _=U();if(K!==void 0&&Object.is(K,_)&&!Q)return;let H=()=>{if(Z(_,K),K=Q?m1(_):_,G)j()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(w1($))B=$.subscribe(()=>z());else B=K$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{W=!0},j.resume=()=>{W=!1},j}function UJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>w1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>w1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(w1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function zJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=t0;t0=G,t4.push(G);try{X=$()}finally{t4.pop(),t0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function BJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function jJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
12224
12258
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
12225
12259
  (function() {
12226
12260
  // Watch implementation for ${J}
@@ -12232,9 +12266,9 @@ else {
12232
12266
  }
12233
12267
  })();
12234
12268
  </script>
12235
- `})}function m1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>m1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(m1(Q),m1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(m1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m1($[Y]);return Z}function jJ($,Z=100){let Y=_5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return K$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function _J($,Z=100){let Y=_5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return K$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var t0=null,t4,G$,Vj;var OJ=y(()=>{t4=[],G$=new WeakMap;Vj={ref:_5,computed:K$,watch:qJ,watchMultiple:WJ,watchEffect:UJ,isRef:w1,unref:QJ,toRefs:GJ,shallowRef:KJ,debouncedComputed:jJ,throttledComputed:_J,processComputedDirectives:zJ,processWatchDirectives:BJ}});var wJ={};o(wJ,{v:()=>wj,processHasErrorsDirective:()=>VJ,processFormValidationDirectives:()=>Aj,processErrorsDirective:()=>FJ,processErrorDirective:()=>LJ,defineForm:()=>Rj,Validator:()=>H5});class H5{rules=[];defaultValue="";addRule($){let Z=new H5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new H5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new H5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function Rj($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function j(O,V){X[O]=V,G[O]=!0}function _(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:j,setFieldTouched:_,getFieldState:H,handleSubmit:L}}function LJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12236
- `)}catch{return""}})}function FJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
12237
- `)}catch{return""}})}function VJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function Aj($,Z,Y){let X=$;return X=LJ(X,Z,Y),X=FJ(X,Z,Y),X=VJ(X,Z,Y),X}var wj;var RJ=y(()=>{wj=new H5});var TJ={};o(TJ,{processXElementDirectives:()=>Nj,hasXElementDirectives:()=>NJ,generateXElementRuntime:()=>AJ});function AJ(){return`<script data-stx-scoped>
12269
+ `})}function m1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>m1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(m1(Q),m1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(m1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m1($[Y]);return Z}function _J($,Z=100){let Y=_5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return K$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function HJ($,Z=100){let Y=_5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return K$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var t0=null,t4,G$,Vj;var LJ=y(()=>{t4=[],G$=new WeakMap;Vj={ref:_5,computed:K$,watch:WJ,watchMultiple:UJ,watchEffect:zJ,isRef:w1,unref:GJ,toRefs:KJ,shallowRef:qJ,debouncedComputed:_J,throttledComputed:HJ,processComputedDirectives:BJ,processWatchDirectives:jJ}});var RJ={};o(RJ,{v:()=>wj,processHasErrorsDirective:()=>wJ,processFormValidationDirectives:()=>Aj,processErrorsDirective:()=>VJ,processErrorDirective:()=>FJ,defineForm:()=>Rj,Validator:()=>H5});class H5{rules=[];defaultValue="";addRule($){let Z=new H5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new H5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new H5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function Rj($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function j(O,V){X[O]=V,G[O]=!0}function _(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:j,setFieldTouched:_,getFieldState:H,handleSubmit:L}}function FJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12270
+ `)}catch{return""}})}function VJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
12271
+ `)}catch{return""}})}function wJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function Aj($,Z,Y){let X=$;return X=FJ(X,Z,Y),X=VJ(X,Z,Y),X=wJ(X,Z,Y),X}var wj;var AJ=y(()=>{wj=new H5});var MJ={};o(MJ,{processXElementDirectives:()=>Nj,hasXElementDirectives:()=>TJ,generateXElementRuntime:()=>NJ});function NJ(){return`<script data-stx-scoped>
12238
12272
  (function() {
12239
12273
  'use strict';
12240
12274
 
@@ -12518,27 +12552,27 @@ else {
12518
12552
  // Expose for manual initialization
12519
12553
  window.XElement = XElement;
12520
12554
  })();
12521
- </script>`}function NJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function Nj($){if(!NJ($))return $;let Z=AJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
12555
+ </script>`}function TJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function Nj($){if(!TJ($))return $;let Z=NJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
12522
12556
  `+$.slice(Y);return $+`
12523
- `+Z}var MJ={};o(MJ,{rewriteImagesWithSiblings:()=>Ij});import Q1 from"path";async function Ij($,Z){let Y=Z.formats??Mj;if(!Z.publicDir)return $;let X=kj($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(bj(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await Ej(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let _=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${Sj(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:_})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function Ej($,Z,Y){if(!Dj($))return[];let X=Q1.extname($).toLowerCase();if(!Tj.has(X))return[];if(!$.startsWith("/"))return[];let Q=Q1.join(Z,$.slice(1)),J=Q1.dirname(Q),G=Q1.basename(Q,X),K=Q1.resolve(J),q=Q1.resolve(Z);if(!K.startsWith(q))return[];let W=Q1.posix.dirname($),U=Y.map(async(B)=>{let j=Q1.join(J,`${G}${B.ext}`);if(!await Bun.file(j).exists())return null;return{url:Q1.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function Dj($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function kj($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function bj($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function Sj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var Tj,Mj;var IJ=y(()=>{Tj=new Set([".jpg",".jpeg",".png",".gif"]),Mj=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var bJ={};o(bJ,{validateClientScript:()=>r4,processOnceDirective:()=>s4,processJsonDirective:()=>o4,processDirectives:()=>V0,injectRouterScript:()=>N8});import b0 from"path";import{deriveLayoutGroup as yj}from"stx-router/layout-metadata";function EJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pj($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
12557
+ `+Z}var IJ={};o(IJ,{rewriteImagesWithSiblings:()=>Ij});import G1 from"path";async function Ij($,Z){let Y=Z.formats??Mj;if(!Z.publicDir)return $;let X=kj($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(bj(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await Ej(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let _=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${Sj(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:_})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function Ej($,Z,Y){if(!Dj($))return[];let X=G1.extname($).toLowerCase();if(!Tj.has(X))return[];if(!$.startsWith("/"))return[];let Q=G1.join(Z,$.slice(1)),J=G1.dirname(Q),G=G1.basename(Q,X),K=G1.resolve(J),q=G1.resolve(Z);if(!K.startsWith(q))return[];let W=G1.posix.dirname($),U=Y.map(async(B)=>{let j=G1.join(J,`${G}${B.ext}`);if(!await Bun.file(j).exists())return null;return{url:G1.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function Dj($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function kj($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function bj($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function Sj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var Tj,Mj;var EJ=y(()=>{Tj=new Set([".jpg",".jpeg",".png",".gif"]),Mj=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var SJ={};o(SJ,{validateClientScript:()=>r4,processOnceDirective:()=>s4,processJsonDirective:()=>o4,processDirectives:()=>V0,injectRouterScript:()=>N8});import b0 from"path";import{deriveLayoutGroup as yj}from"stx-router/layout-metadata";function DJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pj($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
12524
12558
  `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
12525
12559
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
12526
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function e4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function DJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function Cj($){let Z=e4($,"data-stx-runtime");if(!Z)return $;let Y=DJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=DJ(Q);if(J===-1)return X+`
12560
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function e4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function kJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function Cj($){let Z=e4($,"data-stx-runtime");if(!Z)return $;let Y=kJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=kJ(Q);if(J===-1)return X+`
12527
12561
  `+Q;return Q.slice(0,J)+X+`
12528
12562
  `+Q.slice(J)}async function V0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!s5()&&!R4())&&Y&&Y.endsWith(".stx"))s3($,Y);try{return await i9.timeAsync("template-processing",async()=>{let G=await vj($,Z,Y,X,Q);if(J)G=P6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??h5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let j=Z.__sections?.title,_=W.title||z||j,H={...K,..._&&{title:_},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
12529
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=y6(G);if(G=qX(G,H),L)G=KX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=yj(V);G=G.replace("<head>",`<head>
12530
- <meta name="stx-layout" content="${EJ(V)}">
12531
- <meta name="stx-layout-group" content="${EJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=GX(G),G=Cj(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (LX(),OX)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=e4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12532
- `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (wX(),VX)),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=e4(G,"data-stx-stores")||e4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12533
- `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await J2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof M4)throw G;let K=G instanceof Error?G.message:String(G),q=new C1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(c0.log(q,{filePath:Y,context:Z}),N3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function vj($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!b0.isAbsolute(X.partialsDir)?b0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!b0.isAbsolute(X.componentsDir)?b0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!b0.isAbsolute(X.layoutsDir)?b0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await gj(Y,Z),fj(Z,K),q=await Z5(()=>cY(q,Z,Y,K),q,(O)=>{c0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=q1(q,N$,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=YX(q),q=await zX(q,Y,Q);let j={};q=k6(q,j);let _={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=b0.dirname(Y),A=K.layoutsDir?b0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=b0.join(R,"_layout.stx");if(await c(T)){w=T;break}let M=b0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=b0.isAbsolute(K.layoutsDir)?K.layoutsDir:b0.resolve(process.cwd(),K.layoutsDir),T=b0.join(N,`${K.defaultLayout}.stx`);if(await c(T))H=T}if(H&&!V)q=`@section('content')
12563
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=y6(G);if(G=WX(G,H),L)G=qX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=yj(V);G=G.replace("<head>",`<head>
12564
+ <meta name="stx-layout" content="${DJ(V)}">
12565
+ <meta name="stx-layout-group" content="${DJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=KX(G),G=Cj(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (FX(),LX)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=e4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12566
+ `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (RX(),wX)),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=e4(G,"data-stx-stores")||e4(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12567
+ `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await J2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof M4)throw G;let K=G instanceof Error?G.message:String(G),q=new C1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(p0.log(q,{filePath:Y,context:Z}),N3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return R3.createFallbackContent("Template Processing",q)}}async function vj($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!b0.isAbsolute(X.partialsDir)?b0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!b0.isAbsolute(X.componentsDir)?b0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!b0.isAbsolute(X.layoutsDir)?b0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await gj(Y,Z),fj(Z,K),q=await Z5(()=>iY(q,Z,Y,K),q,(O)=>{p0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=q1(q,N$,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=XX(q),q=await BX(q,Y,Q);let j={};q=k6(q,j);let _={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=b0.dirname(Y),A=K.layoutsDir?b0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=b0.join(R,"_layout.stx");if(await i(T)){w=T;break}let M=b0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=b0.isAbsolute(K.layoutsDir)?K.layoutsDir:b0.resolve(process.cwd(),K.layoutsDir),T=b0.join(N,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
12534
12568
  ${q.trim()}
12535
12569
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return _[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let R=Y0(w.trim(),Z);if(R===void 0)return O;return _[V]=String(R??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))_[V]=w.replace("@parent",u1);else _[V]=w.trim();return""}),Z.__sections=_,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return _[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(q=b6(q,j),H){let O=[],V=y5(q),w=q1(V.output,A$,(R,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,A,N)=>{let T=A==="SCRIPT"?V.scripts[Number(N)]:w.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let R=O.join(`
12536
12570
  `);_.content=_.content?`${_.content}
12537
- ${R}`:R,Z.__sections=_}}if(H)try{let O;if(b0.isAbsolute(H))O=H,Q.add(H);else O=await Z5(()=>g7(H,Y,G,Q),null,()=>{throw new C1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(c0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new C1(T,Y);return q}let V=await Z5(()=>Bun.file(O).text(),"",()=>{throw new C1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,D)=>{return T[C]=D.trim(),""});for(let[E,C]of Object.entries(T))if(_[E]&&_[E].includes(u1)){let D=_[E].indexOf(u1);_[E]=_[E].slice(0,D)+C+_[E].slice(D+u1.length)}else if(!_[E])_[E]=C;let I={...Z,__sections:_},k=`@layout('${w[1]}')${M}`;return await V0(k,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=k6(R,j),N={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(_[M]){let k=_[M];if(k.includes(u1)){let E=N[M]||"",C=k.indexOf(u1);k=k.slice(0,C)+E+k.slice(C+u1.length)}return k}return I||""}),A=xj(A,_),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),A=b6(A,j),Z.__originalFilePath=Y,q=await kJ(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
12538
- ${q}`,z(q)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await kJ(q,Z,Y,G,Q))}function xj($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function fj($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function gj($,Z){await Z5(()=>rY($,Z),void 0,(Y)=>{c0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function hj($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (u5(),b$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));c0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function dj($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (r0(),u9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return c0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function kJ($,Z,Y,X,Q){let J=$,G=X;if(await hj(J,Z,Y),J=await dj(J,Z,Y),J=await hY(J,Z,Y),J=await dY(J,Z,Y),J=await h2(J,Z,Y,G),i1(J))J=P7(J,Z),J=v7(J,Z);J=C7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (o3(),n3));J=K(J,Z),J=M6(J,Z,Y,G),J=await l4(J,Z,Y,G,Q),J=await JX(J,Z,Y,G,Q),J=O9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => AX);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => TX);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => DX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => bX);J=B(J,Z,Y);let{processSuspenseDirectives:j}=await Promise.resolve().then(() => SX);J=j(J,Z,Y);let{processAsyncDirectives:_}=await Promise.resolve().then(() => vX);J=_(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => fX);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (lX(),uX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (JJ(),XJ));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await Promise.resolve().then(() => (OJ(),HJ));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (RJ(),wJ));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:k}=await Promise.resolve().then(() => (d5(),V7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
12539
- `;if(J=M(J,Z),J=I(J,Z),J=oY(J),J=C3(J,Z),J=f2(J),J=lY(J),J=await D6(J,Z,Y,G,Q),J=await l4(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=P6(J),J=g1(J,Z,Y),J=v3(J,Z),J=x3(J,Z),J=v4(J,Z),J=p2(J,Z),J=c2(J,Z),J=await I2(J,Z,Y,G),J=await g8(J,Z,Y),J=await r2(J,Z,Y,G),J=W9(J,Z,Y,G),J=pZ(J,Z,Y,G),J=cZ(J,Z,Y),J=iZ(J,Z,Y,G),J=C2(J,Z,Y,G),J=o4(J,Z),J=s4(J),J=jX(J),!G.skipEventDirectives)J=V2(J,Z,Y);if(J=T2(J,Z,Y),G.debug){let s=/\bx-data\s*=/.test(J),t=i$($);if(s&&t)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12571
+ ${R}`:R,Z.__sections=_}}if(H)try{let O;if(b0.isAbsolute(H))O=H,Q.add(H);else O=await Z5(()=>g7(H,Y,G,Q),null,()=>{throw new C1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(p0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new C1(T,Y);return q}let V=await Z5(()=>Bun.file(O).text(),"",()=>{throw new C1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,D)=>{return T[C]=D.trim(),""});for(let[E,C]of Object.entries(T))if(_[E]&&_[E].includes(u1)){let D=_[E].indexOf(u1);_[E]=_[E].slice(0,D)+C+_[E].slice(D+u1.length)}else if(!_[E])_[E]=C;let I={...Z,__sections:_},k=`@layout('${w[1]}')${M}`;return await V0(k,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=k6(R,j),N={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(_[M]){let k=_[M];if(k.includes(u1)){let E=N[M]||"",C=k.indexOf(u1);k=k.slice(0,C)+E+k.slice(C+u1.length)}return k}return I||""}),A=xj(A,_),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),A=b6(A,j),Z.__originalFilePath=Y,q=await bJ(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
12572
+ ${q}`,z(q)}catch(O){return p0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await bJ(q,Z,Y,G,Q))}function xj($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function fj($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function gj($,Z){await Z5(()=>aY($,Z),void 0,(Y)=>{p0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function hj($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (u5(),b$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));p0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function dj($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (r0(),u9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return p0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function bJ($,Z,Y,X,Q){let J=$,G=X;if(await hj(J,Z,Y),J=await dj(J,Z,Y),J=await dY(J,Z,Y),J=await mY(J,Z,Y),J=await h2(J,Z,Y,G),i1(J))J=P7(J,Z),J=v7(J,Z);J=C7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (o3(),n3));J=K(J,Z),J=M6(J,Z,Y,G),J=await l4(J,Z,Y,G,Q),J=await QX(J,Z,Y,G,Q),J=O9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => NX);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => MX);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => kX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => SX);J=B(J,Z,Y);let{processSuspenseDirectives:j}=await Promise.resolve().then(() => yX);J=j(J,Z,Y);let{processAsyncDirectives:_}=await Promise.resolve().then(() => xX);J=_(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => gX);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (pX(),lX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (QJ(),JJ));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await Promise.resolve().then(() => (LJ(),OJ));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (AJ(),RJ));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:k}=await Promise.resolve().then(() => (d5(),V7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
12573
+ `;if(J=M(J,Z),J=I(J,Z),J=sY(J),J=C3(J,Z),J=f2(J),J=pY(J),J=await D6(J,Z,Y,G,Q),J=await l4(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=P6(J),J=g1(J,Z,Y),J=v3(J,Z),J=x3(J,Z),J=v4(J,Z),J=p2(J,Z),J=c2(J,Z),J=await I2(J,Z,Y,G),J=await g8(J,Z,Y),J=await r2(J,Z,Y,G),J=W9(J,Z,Y,G),J=pZ(J,Z,Y,G),J=cZ(J,Z,Y),J=iZ(J,Z,Y,G),J=C2(J,Z,Y,G),J=o4(J,Z),J=s4(J),J=_X(J),!G.skipEventDirectives)J=V2(J,Z,Y);if(J=T2(J,Z,Y),G.debug){let s=/\bx-data\s*=/.test(J),t=i$($);if(s&&t)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12540
12574
  Both work on the same page, but they manage separate scopes.
12541
- Prefer signals (state/derived/effect) for new components.`)}J=eY(J,Z),J=await W1(J,Z,Y),J=_X(J),J=HX(J),J=U2(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => TJ);J=C(J);let D=Z.__originalFilePath||Y,b=k5(Z);if(J=await x7(J,G,D,b),J=await iY(J,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:t}=await Promise.resolve().then(() => (IJ(),MJ));J=await t(J,{publicDir:s})}if(G.seo?.enabled)J=nZ(J,Z,G);let P=(s,t)=>{if(!t)return s;if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${t}
12575
+ Prefer signals (state/derived/effect) for new components.`)}J=$X(J,Z),J=await W1(J,Z,Y),J=HX(J),J=OX(J),J=U2(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => MJ);J=C(J);let D=Z.__originalFilePath||Y,b=k5(Z);if(J=await x7(J,G,D,b),J=await nY(J,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:t}=await Promise.resolve().then(() => (EJ(),IJ));J=await t(J,{publicDir:s})}if(G.seo?.enabled)J=nZ(J,Z,G);let P=(s,t)=>{if(!t)return s;if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${t}
12542
12576
  </head>`);if(/<head\b[^>]*>/i.test(s))return s.replace(/(<head\b[^>]*>)/i,`$1
12543
12577
  ${t}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
12544
12578
  <head>
@@ -12549,8 +12583,8 @@ ${G2()}
12549
12583
  `+u}else J=J.replace("</head>",`${t}
12550
12584
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
12551
12585
  ${t}`);else J=t+`
12552
- `+J}{let{scanScriptTags:s}=await Promise.resolve().then(() => (i5(),n$)),t=[];for(let d of s(J)){if(!/\bserver\b/i.test(d.attrs))continue;let S=d.start+d.fullMatch.indexOf(">")+1,v=Pj(J,S);if(v===-1)continue;let x=v+9;while(x<J.length&&/\s/.test(J[x]))x++;t.push({start:d.start,end:x})}for(let d=t.length-1;d>=0;d--){let{start:S,end:v}=t[d];J=J.substring(0,S)+J.substring(v)}}let N0=I$(J,Y);if(N0.hasScoped)J=N0.html;let Z0=Z.__stx_event_bindings||[],R0=!1,d0=[],$1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:n0}=await Promise.resolve().then(() => (i5(),n$));for(let s of n0(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))d0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:t,content:d}of d0){R0=!0;let S=d;r4(d,Y,X.strict);let v=await b5(d,{eventBindings:Z0,attrs:t,hasColonDirectives:$1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(s,()=>v)}if(R0)Z.__stx_event_bindings=[];return J}var u1="<!--PARENT_CONTENT_PLACEHOLDER-->";var r$=y(()=>{Q2();P5();K7();K2();z2();j2();U7();q7();w2();S5();M2();E2();y4();v2();g2();m2();J1();d5();r0();i2();a2();gY();uY();I6();h7();nY();r1();sY();T3();O0();aY();$X();XX();QX();L7();i5();T6();BX();C6();v6();F0();r3();C6();v6()});import cj from"fs";import h6 from"path";import dJ from"fs";import Y1 from"path";var l6=[72,96,128,144,152,192,384,512],p6=[120,152,167,180],c6=[16,32];async function i6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=Y1.isAbsolute(X.src)?X.src:Y1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=Y1.resolve(Z,X.outputDir||"pwa-icons");try{dJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||l6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
12553
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=Y1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=Y1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of p6){let O=Y1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=Y1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of c6){let F=Y1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,j=Y1.join(J,`icon-maskable-${B}x${B}.png`),_=Math.floor(B*0.1),H=B-_*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:_,bottom:_,left:_,right:_,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(j),Y.generatedFiles.push(j)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function sj($){let Z=$.sizes||l6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of p6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of c6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function n6(){try{return await import("sharp"),!0}catch{return!1}}j$();function KQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function qQ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function WQ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function UQ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function zQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function BQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:KQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=qQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=WQ($);if(W)q.share_target=W;let U=UQ($);if(U)q.file_handlers=U;let z=zQ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function Q9($){let Z=BQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function Q_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function G_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import SJ from"path";async function yJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=SJ.isAbsolute(Z.page)?Z.page:SJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (r$(),bJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return mj($)}function mj($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
12586
+ `+J}{let{scanScriptTags:s}=await Promise.resolve().then(() => (i5(),n$)),t=[];for(let d of s(J)){if(!/\bserver\b/i.test(d.attrs))continue;let S=d.start+d.fullMatch.indexOf(">")+1,v=Pj(J,S);if(v===-1)continue;let x=v+9;while(x<J.length&&/\s/.test(J[x]))x++;t.push({start:d.start,end:x})}for(let d=t.length-1;d>=0;d--){let{start:S,end:v}=t[d];J=J.substring(0,S)+J.substring(v)}}let N0=I$(J,Y);if(N0.hasScoped)J=N0.html;let Z0=Z.__stx_event_bindings||[],R0=!1,d0=[],$1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:i0}=await Promise.resolve().then(() => (i5(),n$));for(let s of i0(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))d0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:t,content:d}of d0){R0=!0;let S=d;r4(d,Y,X.strict);let v=await b5(d,{eventBindings:Z0,attrs:t,hasColonDirectives:$1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(s,()=>v)}if(R0)Z.__stx_event_bindings=[];return J}var u1="<!--PARENT_CONTENT_PLACEHOLDER-->";var r$=y(()=>{Q2();P5();K7();K2();z2();j2();U7();q7();w2();S5();M2();E2();y4();v2();g2();m2();Q1();d5();r0();i2();a2();hY();lY();I6();h7();oY();r1();rY();T3();O0();tY();ZX();JX();GX();L7();i5();T6();jX();C6();v6();F0();r3();C6();v6()});import cj from"fs";import h6 from"path";import mJ from"fs";import X1 from"path";var l6=[72,96,128,144,152,192,384,512],p6=[120,152,167,180],c6=[16,32];async function i6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=X1.isAbsolute(X.src)?X.src:X1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=X1.resolve(Z,X.outputDir||"pwa-icons");try{mJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||l6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
12587
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=X1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=X1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of p6){let O=X1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=X1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of c6){let F=X1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,j=X1.join(J,`icon-maskable-${B}x${B}.png`),_=Math.floor(B*0.1),H=B-_*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:_,bottom:_,left:_,right:_,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(j),Y.generatedFiles.push(j)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function sj($){let Z=$.sizes||l6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of p6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of c6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function n6(){try{return await import("sharp"),!0}catch{return!1}}j$();function qQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function WQ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function UQ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function zQ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function BQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function jQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:qQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=WQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=UQ($);if(W)q.share_target=W;let U=zQ($);if(U)q.file_handlers=U;let z=BQ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function Q9($){let Z=jQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function Q_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function G_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import yJ from"path";async function PJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=yJ.isAbsolute(Z.page)?Z.page:yJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (r$(),SJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return mj($)}function mj($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
12554
12588
  <html lang="en">
12555
12589
  <head>
12556
12590
  <meta charset="UTF-8">
@@ -12788,4 +12822,4 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
12788
12822
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
12789
12823
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
12790
12824
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
12791
- `)}F3();j$();V5();w5();async function bA($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{cj.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=Q9($);if(J){let G=h6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await n6()){let G=await i6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await yJ($);if(J){let G=h6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=R1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=z$($,Z);if(J){let G=p1($),K=h6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function SA($,Z){return G7($,Z)}function yA($){return $.pwa?.enabled===!0}export{G_ as validateManifest,VA as runPwaAudit,QL as registerPwaDirectives,sq as pwaUpdateDirective,aq as pwaPushDirective,rq as pwaOfflineDirective,oq as pwaInstallDirective,L3 as pwaDirectives,SA as processPwaHtml,Q_ as mergeManifestConfig,X9 as isWorkboxEnabled,n6 as isSharpAvailable,yA as isPwaEnabled,G7 as injectPwaTags,p1 as getServiceWorkerFileName,sj as getExpectedIconPaths,GQ as generateThemeColorMeta,JQ as generateSwRegistrationScript,XQ as generateServiceWorkerAuto,z$ as generateServiceWorker,B$ as generatePwaTags,i6 as generatePwaIcons,U$ as generatePrecacheManifestJs,R1 as generatePrecacheManifest,yJ as generateOfflinePage,QQ as generateManifestLink,Q9 as generateManifestJson,BQ as generateManifest,s6 as formatSize,wA as formatAuditResult,pj as calculateAuditResult,bA as buildPwaAssets,uj as auditConfig,lj as auditBuildOutput,c6 as FAVICON_SIZES,l6 as DEFAULT_ICON_SIZES,p6 as APPLE_TOUCH_ICON_SIZES};
12825
+ `)}F3();j$();V5();w5();async function bA($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{cj.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=Q9($);if(J){let G=h6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await n6()){let G=await i6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await PJ($);if(J){let G=h6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=R1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=z$($,Z);if(J){let G=p1($),K=h6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function SA($,Z){return G7($,Z)}function yA($){return $.pwa?.enabled===!0}export{G_ as validateManifest,VA as runPwaAudit,QL as registerPwaDirectives,rq as pwaUpdateDirective,tq as pwaPushDirective,aq as pwaOfflineDirective,sq as pwaInstallDirective,L3 as pwaDirectives,SA as processPwaHtml,Q_ as mergeManifestConfig,X9 as isWorkboxEnabled,n6 as isSharpAvailable,yA as isPwaEnabled,G7 as injectPwaTags,p1 as getServiceWorkerFileName,sj as getExpectedIconPaths,KQ as generateThemeColorMeta,QQ as generateSwRegistrationScript,JQ as generateServiceWorkerAuto,z$ as generateServiceWorker,B$ as generatePwaTags,i6 as generatePwaIcons,U$ as generatePrecacheManifestJs,R1 as generatePrecacheManifest,PJ as generateOfflinePage,GQ as generateManifestLink,Q9 as generateManifestJson,jQ as generateManifest,s6 as formatSize,wA as formatAuditResult,pj as calculateAuditResult,bA as buildPwaAssets,uj as auditConfig,lj as auditBuildOutput,c6 as FAVICON_SIZES,l6 as DEFAULT_ICON_SIZES,p6 as APPLE_TOUCH_ICON_SIZES};