@stacksjs/stx 0.2.152 → 0.2.153

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:V7,getOwnPropertyNames:CQ,getOwnPropertyDescriptor:vQ}=Object,xQ=Object.prototype.hasOwnProperty;function fQ($){return this[$]}var U9=($)=>{var Z=(W9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=V7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of CQ($))if(!xQ.call(Z,X))V7(Z,X,{get:fQ.bind($,X),enumerable:!(Y=vQ($,X))||Y.enumerable})}return W9.set($,Z),Z},W9;var gQ=($)=>$;function hQ($,Z){this[$]=gQ.bind(null,Z)}var s=($,Z)=>{for(var Y in Z)V7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:hQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;import N$ from"fs";import T$ from"path";function uQ($){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 lQ($,Z){let Y=T$.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 pQ($,Z,Y){let X=T$.extname($).toLowerCase(),Q=mQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&lQ($,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 O9($,Z,Y,X){let Q=N$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=T$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;O9(G,Z,Y,X)}else if(J.isFile()){let K=N$.statSync(G),q=T$.relative(Z,G);if(pQ(q,K.size,Y)){let W=N$.readFileSync(G),U=uQ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function I1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!N$.existsSync($))return{entries:[],totalSize:0,fileCount:0};O9($,$,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 M$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:A7,getOwnPropertyNames:uQ,getOwnPropertyDescriptor:lQ}=Object,pQ=Object.prototype.hasOwnProperty;function cQ($){return this[$]}var _9=($)=>{var Z=(B9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=A7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of uQ($))if(!pQ.call(Z,X))A7(Z,X,{get:cQ.bind($,X),enumerable:!(Y=lQ($,X))||Y.enumerable})}return B9.set($,Z),Z},B9;var iQ=($)=>$;function nQ($,Z){this[$]=iQ.bind(null,Z)}var s=($,Z)=>{for(var Y in Z)A7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:nQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;import M$ from"fs";import T$ from"path";function rQ($){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 aQ($,Z){let Y=T$.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 tQ($,Z,Y){let X=T$.extname($).toLowerCase(),Q=sQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&aQ($,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 w9($,Z,Y,X){let Q=M$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=T$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;w9(G,Z,Y,X)}else if(J.isFile()){let K=M$.statSync(G),q=T$.relative(Z,G);if(tQ(q,K.size,Y)){let W=M$.readFileSync(G),U=rQ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function I1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!M$.existsSync($))return{entries:[],totalSize:0,fileCount:0};w9($,$,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 I$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function L9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var mQ;var y5=k(()=>{mQ={".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 cQ($){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 w7($){return cQ($).className}function F9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=w7(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 R9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var sQ;var P5=k(()=>{sQ={".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 eQ($){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 N7($){return eQ($).className}function A9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=N7(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=iQ(J.pattern);Q.push(`
11
+ })`);let q=$G(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||oQ(J.pattern)}',
16
+ cacheName: '${J.cacheName||YG(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 iQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${nQ(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('${sQ($).replace(/\\\*/g,".*")}')`}function nQ($){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 oQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function sQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var R9={};s(R9,{isWorkboxEnabled:()=>A9,getServiceWorkerGenerator:()=>$G,generateWorkboxServiceWorker:()=>w9,generateWorkboxConfig:()=>V9});function V9($,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(w7(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?I1(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 w9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=V9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?I1(Z,$):null,q=K?M$(K):"[]",W=rQ(X.modules),U=F9($);return`/**
23
+ `)}function $G($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${ZG(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('${XG($).replace(/\\\*/g,".*")}')`}function ZG($){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 YG($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function XG($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var I9={};s(I9,{isWorkboxEnabled:()=>T9,getServiceWorkerGenerator:()=>qG,generateWorkboxServiceWorker:()=>M9,generateWorkboxConfig:()=>N9});function N9($,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(N7(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?I1(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 M9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=N9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?I1(Z,$):null,q=K?I$(K):"[]",W=JG(X.modules),U=A9($);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?tQ(J):"// Push notifications disabled"}
172
+ ${J?.enabled?GG(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?eQ(G):"// Background sync disabled"}
174
+ ${G?.enabled?KG(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function rQ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${aQ(X)};`)}return Z.join(`
178
- `)}function aQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function tQ($){return`
177
+ `}function JG($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${QG(X)};`)}return Z.join(`
178
+ `)}function QG($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function GG($){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 eQ($){return`
247
+ `}function KG($){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 A9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function $G($){if(A9($))return w9;let{generateServiceWorker:Z}=(P5(),U9(T9));return Z}var N9=k(()=>{y5()});var T9={};s(T9,{isWorkboxEnabled:()=>M9,getServiceWorkerFileName:()=>$5,generateServiceWorkerAuto:()=>XG,generateServiceWorker:()=>I$});function I$($,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?I1(Z,$):null,j=z?M$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function T9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function qG($){if(T9($))return M9;let{generateServiceWorker:Z}=(C5(),_9(E9));return Z}var D9=k(()=>{P5()});var E9={};s(E9,{isWorkboxEnabled:()=>k9,getServiceWorkerFileName:()=>$5,generateServiceWorkerAuto:()=>zG,generateServiceWorker:()=>D$});function D$($,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?I1(Z,$):null,j=z?I$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
320
320
  * Additional features:
321
321
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
322
322
  * - Background sync: ${W?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${U?.maxSize?`${L9(U.maxSize*1024*1024)}`:"unlimited"}
323
+ * - Cache limits: ${U?.maxSize?`${R9(U.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${J}';
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?ZG():"// Push notifications disabled"}
504
+ ${q?.enabled?WG():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?YG():"// Background sync disabled"}
506
+ ${W?.enabled?UG():"// 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 ZG(){return`
871
+ `}function WG(){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 YG(){return`
953
+ `}function UG(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,14 +1132,14 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function $5($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function M9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function XG($,Z){if(!$.pwa?.enabled)return"";if(M9($)){let{generateWorkboxServiceWorker:Y}=(N9(),U9(R9));return Y($,Z)}return I$($,Z)}var P5=k(()=>{y5()});var I9={};s(I9,{injectPwaTags:()=>R7,generateThemeColorMeta:()=>GG,generateSwRegistrationScript:()=>JG,generatePwaTags:()=>D$,generateManifestLink:()=>QG});function D$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=$5($),J=`
1135
+ `}function $5($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function k9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function zG($,Z){if(!$.pwa?.enabled)return"";if(k9($)){let{generateWorkboxServiceWorker:Y}=(D9(),_9(I9));return Y($,Z)}return D$($,Z)}var C5=k(()=>{P5()});var b9={};s(b9,{injectPwaTags:()=>T7,generateThemeColorMeta:()=>_G,generateSwRegistrationScript:()=>jG,generatePwaTags:()=>E$,generateManifestLink:()=>BG});function E$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=$5($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
- <meta name="theme-color" content="${A7(Y?.themeColor||"#000000")}">
1138
+ <meta name="theme-color" content="${M7(Y?.themeColor||"#000000")}">
1139
1139
  <meta name="mobile-web-app-capable" content="yes">
1140
1140
  <meta name="apple-mobile-web-app-capable" content="yes">
1141
1141
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
1142
- <meta name="apple-mobile-web-app-title" content="${A7(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1142
+ <meta name="apple-mobile-web-app-title" content="${M7(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1143
1143
  <link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
1144
1144
  <link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
1145
1145
  <link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
@@ -1176,9 +1176,9 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,J}function R7($,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=D$(Z);return $.slice(0,Q)+J+`
1180
- `+$.slice(Q)}return $+D$(Z)}let X=D$(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function JG($){if(!$.pwa?.enabled)return"";return`<script>
1179
+ <!-- End stx PWA -->`,J}function T7($,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=E$(Z);return $.slice(0,Q)+J+`
1180
+ `+$.slice(Q)}return $+E$(Z)}let X=E$(Z);return $.replace("</head>",`${X}
1181
+ </head>`)}function jG($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
1184
  navigator.serviceWorker.register('/${$5($)}')
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function QG(){return'<link rel="manifest" href="/manifest.json">'}function GG($){return`<meta name="theme-color" content="${A7($)}">`}function A7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var E$=k(()=>{P5()});import C5 from"path";function k9($){E9=$?.trim()||null}function v5(){return process.env[BG]?.trim()||E9||Z5}function x5($=process.cwd(),...Z){let Y=v5();return C5.isAbsolute(Y)?C5.join(Y,...Z):C5.join($,Y,...Z)}function f5($){if(!$||C5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Z5&&!Z.startsWith(`${Z5}/`))return $;let Y=Z.slice(Z5.length+1);return Y?C5.join(v5(),Y):v5()}var Z5=".stx",BG="STX_DIR",E9=null;var k$=()=>{};var L0;var b9=k(()=>{L0={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 S9($,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 y9,P9;var N7=k(()=>{y9={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},P9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function _G($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...Q1,...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 BG(){return'<link rel="manifest" href="/manifest.json">'}function _G($){return`<meta name="theme-color" content="${M7($)}">`}function M7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var k$=k(()=>{C5()});import v5 from"path";function P9($){y9=$?.trim()||null}function x5(){return process.env[RG]?.trim()||y9||Z5}function f5($=process.cwd(),...Z){let Y=x5();return v5.isAbsolute(Y)?v5.join(Y,...Z):v5.join($,Y,...Z)}function g5($){if(!$||v5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Z5&&!Z.startsWith(`${Z5}/`))return $;let Y=Z.slice(Z5.length+1);return Y?v5.join(x5(),Y):x5()}var Z5=".stx",RG="STX_DIR",y9=null;var b$=()=>{};var F0;var C9=k(()=>{F0={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 v9($,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 x9,f9;var I7=k(()=>{x9={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},f9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function AG($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...Q1,...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 HG(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function NG(){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 OG($){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 LG($=0.1,Z="0px"){return`
1231
+ `}function MG($){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 TG($=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 FG(){return`
1274
+ `}function IG(){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 VG($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function DG($,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 g9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!OG(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=FG();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=LG(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var Q1,C9,v9,x9,f9;var T7=k(()=>{Q1={duration:300,delay:0,ease:"ease",direction:"both"};C9={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)||Q1.duration:Q1.duration,G=Z.length>2?Z[2]||Q1.ease:Q1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||Q1.delay:Q1.delay,q=Z.length>4?Z[4]||Q1.direction:Q1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=_G(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",j="";if(Q==="fade")j="stx-fade";else if(Q==="slide")j="stx-slide";else if(Q==="scale")j="stx-scale";else if(Q==="flip")j="stx-flip";else if(Q==="rotate")j="stx-rotate";return`<div id="${W}" class="${z} ${j} ${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"},v9={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"},x9={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=VG(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},f9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=HG();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as h9}from"stx-router";var d9=k(()=>{M7()});async function wG($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=h9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var m9;var M7=k(()=>{d9();m9={name:"stxRouter",handler:wG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function u9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...AG,...Z};return`
1426
+ `}function u9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!MG(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=IG();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=TG(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
+ `+Q.slice(W)}}return Q}var Q1,g9,h9,d9,m9;var D7=k(()=>{Q1={duration:300,delay:0,ease:"ease",direction:"both"};g9={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)||Q1.duration:Q1.duration,G=Z.length>2?Z[2]||Q1.ease:Q1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||Q1.delay:Q1.delay,q=Z.length>4?Z[4]||Q1.direction:Q1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=AG(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",j="";if(Q==="fade")j="stx-fade";else if(Q==="slide")j="stx-slide";else if(Q==="scale")j="stx-scale";else if(Q==="flip")j="stx-flip";else if(Q==="rotate")j="stx-rotate";return`<div id="${W}" class="${z} ${j} ${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"},h9={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"},d9={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=DG(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},m9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=NG();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 p9=k(()=>{E7()});async function EG($,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 c9;var E7=k(()=>{p9();c9={name:"stxRouter",handler:EG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function i9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...kG,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,10 +1810,10 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function l9($,Z){let Y=u9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function RG($){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 AG,p9;var I7=k(()=>{AG={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};p9={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=RG(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return u9(Q)}}});function z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function c9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function i9($){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
- `)){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 g5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,j)=>{let _=J.length,B=z?` class="language-${z1(z)}"`:"";return J.push(`<pre><code${B}>${z1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${z1(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,j)=>{return`<img src="${c9(j)?z1(j):""}" alt="${z1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,j)=>{return`<a href="${c9(j)?z1(j):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
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,j)=>{let B=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${z1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
1816
- `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${z1(O)}</td>`).join("")}</tr>`}).join(`
1813
+ `}function n9($,Z){let Y=i9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function bG($){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 kG,o9;var k7=k(()=>{kG={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};o9={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=bG(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return i9(Q)}}});function z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function s9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function r9($){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
+ `)){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 h5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,j)=>{let _=J.length,B=z?` class="language-${z1(z)}"`:"";return J.push(`<pre><code${B}>${z1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${z1(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,j)=>{return`<img src="${s9(j)?z1(j):""}" alt="${z1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,j)=>{return`<a href="${s9(j)?z1(j):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
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,j)=>{let B=`<tr>${z.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${z1(F)}</th>`).join("")}</tr>`,H=j.trim().split(`
1816
+ `).map((F)=>{return`<tr>${F.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${z1(O)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
1818
1818
  <thead>
1819
1819
  ${B}
@@ -1830,35 +1830,35 @@ ${H}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
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 o0($){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
- `}),$}function NG(){let $=globalThis;return $[n9]??=new Map,$[n9]}function a($,Z){let Y=NG(),X=`${import.meta.url}\x00${$}`,Q=Y.get(X);if(Q)return Q;let J=Z();return Y.set(X,J),J.catch(()=>{if(Y.get(X)===J)Y.delete(X)}),J}var n9;var h5=k(()=>{n9=Symbol.for("stx.lazy-module-promises")});import TG from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(TG.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 D1=()=>{};var d5={};s(d5,{shouldLogBundlerDiagnostics:()=>a9,queueClientBundleBuild:()=>t9,hasUserImports:()=>IG,bundleClientScript:()=>EG});import B0 from"path";import P0 from"fs";function a9($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function E1(...$){if(a9())console.log("[stx:bundler]",...$)}function IG($){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(!o9.some((G)=>G.test(Q)))return E1("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(!o9.some((G)=>G.test(Q)))return E1("detected side-effect import:",Q),!0}return!1}function DG($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:B0.dirname(J),q=B0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,B0.join(q,"index.ts"),B0.join(q,"index.tsx"),B0.join(q,"index.js"),B0.join(q,"index.mjs")];for(let U of W)try{if(P0.existsSync(U)&&P0.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(P0.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=B0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,B0.join(K,"index.ts"),B0.join(K,"index.tsx"),B0.join(K,"index.js"),B0.join(K,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return E1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=B0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:P0.readFileSync(G.path,"utf8"),loader:q}})}}}function t9($){let Z=globalThis,X=(Z[s9]??Promise.resolve()).then($,$);return Z[s9]=X.then(()=>{return},()=>{return}),X}async function EG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||x5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${MG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=B0.join(J,`${K}.js`),W=B0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==r9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(P0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return E1("cache hit:",K),await U.text();E1("cache invalidated by dep change:",K)}let z=D7.get(K);if(z)return await z;let j=t9(()=>kG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));D7.set(K,j);try{return await j}finally{D7.delete(K)}}async function kG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=x5(X,"bundle-tmp"),U=B0.join(W,`${G}.ts`),z=B0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(z,{recursive:!0});let j=B0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
- export { ${_.join(", ")} }`:"";await Bun.write(U,$+F),E1("bundling:",G,"from:",B0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[DG(X,j,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!V.success){let D=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let R=`__stxBundle_${G}`,T=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
1835
- `),I=A.map(([D])=>`${D} = ${R}[${JSON.stringify(D)}];`).join(`
1836
- `);if(w=`${N.join(`
1833
+ `}),$}function SG(){let $=globalThis;return $[a9]??=new Map,$[a9]}function a($,Z){let Y=SG(),X=`${import.meta.url}\x00${$}`,Q=Y.get(X);if(Q)return Q;let J=Z();return Y.set(X,J),J.catch(()=>{if(Y.get(X)===J)Y.delete(X)}),J}var a9;var d5=k(()=>{a9=Symbol.for("stx.lazy-module-promises")});import yG from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(yG.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 D1=()=>{};var m5={};s(m5,{shouldLogBundlerDiagnostics:()=>Z8,queueClientBundleBuild:()=>Y8,hasUserImports:()=>CG,bundleClientScript:()=>xG});import B0 from"path";import P0 from"fs";function Z8($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function E1(...$){if(Z8())console.log("[stx:bundler]",...$)}function CG($){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(!t9.some((G)=>G.test(Q)))return E1("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(!t9.some((G)=>G.test(Q)))return E1("detected side-effect import:",Q),!0}return!1}function vG($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:B0.dirname(J),q=B0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,B0.join(q,"index.ts"),B0.join(q,"index.tsx"),B0.join(q,"index.js"),B0.join(q,"index.mjs")];for(let U of W)try{if(P0.existsSync(U)&&P0.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(P0.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=B0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,B0.join(K,"index.ts"),B0.join(K,"index.tsx"),B0.join(K,"index.js"),B0.join(K,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return E1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=B0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:P0.readFileSync(G.path,"utf8"),loader:q}})}}}function Y8($){let Z=globalThis,X=(Z[e9]??Promise.resolve()).then($,$);return Z[e9]=X.then(()=>{return},()=>{return}),X}async function xG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||f5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${PG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=B0.join(J,`${K}.js`),W=B0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==$8||!Array.isArray(H.files))B=!1;for(let F of Array.isArray(H.files)?H.files:[])try{if(P0.statSync(F.path).mtimeMs!==F.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return E1("cache hit:",K),await U.text();E1("cache invalidated by dep change:",K)}let z=b7.get(K);if(z)return await z;let j=Y8(()=>fG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));b7.set(K,j);try{return await j}finally{b7.delete(K)}}async function fG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=f5(X,"bundle-tmp"),U=B0.join(W,`${G}.ts`),z=B0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(z,{recursive:!0});let j=B0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=B.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(F[3])_.push(F[3])}while((F=H.exec($))!==null){if(F[1])continue;_.push(F[2])}let L=_.length>0?`
1834
+ export { ${_.join(", ")} }`:"";await Bun.write(U,$+L),E1("bundling:",G,"from:",B0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[vG(X,j,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!V.success){let D=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){R.push([S[2],S[1]]);continue}let b=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))R.push([b,b])}let A=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=R.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),M=R.map(([D])=>`var ${D} = undefined;`).join(`
1835
+ `),I=R.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
1836
+ `);if(w=`${A.join(`
1837
1837
  `)}
1838
1838
  ${M}
1839
- var ${R} = (function() {
1839
+ var ${N} = (function() {
1840
1840
  ${w}
1841
1841
  return { ${T} };
1842
1842
  })();
1843
- ${I}`.trim(),E1("bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${B0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;P0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:P0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:r9,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,N=Array.isArray(A)&&A.length>0?`
1844
- ${A.map((R)=>`- ${R?.message??R}`).join(`
1845
- `)}`:"";return console.warn(`[stx:bundler] error: ${w}${N}`),$}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var MG=5,r9=1,o9,D7,s9;var m5=k(()=>{D1();k$();o9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];D7=new Map,s9=Symbol.for("stx.client-bundle-build-queue")});var Q8={};s(Q8,{stripCommentsAndLiterals:()=>Y8,renderVendorStyleTags:()=>S$,processClientScript:()=>p5,injectBrowserCoreAutoImports:()=>Y5,generateServerDataBridge:()=>y$,generateBrowserAutoImportDestructuring:()=>hG,generateAutoImportDestructuring:()=>E7,extractBridgeData:()=>l5,extractAndStripCssImports:()=>b$});import k1 from"path";import u5 from"fs";function SG($){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 yG($,Z){let Y=Z;while(!0){let X=k1.join(Y,"node_modules",$,"package.json");if(u5.existsSync(X))return k1.dirname(X);let Q=k1.dirname(Y);if(Q===Y)return null;Y=Q}}function PG($,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 CG($,Z){let Y=SG($);if(!Y||!Y.subpath)return null;let X=yG(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(u5.readFileSync(k1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=PG(Q.exports,J);if(!G)return null;let K=k1.resolve(X,G);return u5.existsSync(K)?K:null}function b$($,Z){let Y=Z.filePath?k1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(bG,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:k1.resolve(Y,q),!u5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=CG(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=u5.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 vG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${vG(Z.source)}" data-stx-layer="vendor">
1843
+ ${I}`.trim(),E1("bundled:",G,"output:",w.length,"bytes"),_.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${B0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;P0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:P0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:$8,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),R=V?.errors,A=Array.isArray(R)&&R.length>0?`
1844
+ ${R.map((N)=>`- ${N?.message??N}`).join(`
1845
+ `)}`:"";return console.warn(`[stx:bundler] error: ${w}${A}`),$}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var PG=5,$8=1,t9,b7,e9;var u5=k(()=>{D1();b$();t9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];b7=new Map,e9=Symbol.for("stx.client-bundle-build-queue")});var W8={};s(W8,{stripCommentsAndLiterals:()=>G8,renderVendorStyleTags:()=>y$,processClientScript:()=>c5,injectBrowserCoreAutoImports:()=>Y5,generateServerDataBridge:()=>P$,generateBrowserAutoImportDestructuring:()=>nG,generateAutoImportDestructuring:()=>S7,extractBridgeData:()=>p5,extractAndStripCssImports:()=>S$});import k1 from"path";import l5 from"fs";function hG($){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 dG($,Z){let Y=Z;while(!0){let X=k1.join(Y,"node_modules",$,"package.json");if(l5.existsSync(X))return k1.dirname(X);let Q=k1.dirname(Y);if(Q===Y)return null;Y=Q}}function mG($,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 uG($,Z){let Y=hG($);if(!Y||!Y.subpath)return null;let X=dG(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(l5.readFileSync(k1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=mG(Q.exports,J);if(!G)return null;let K=k1.resolve(X,G);return l5.existsSync(K)?K:null}function S$($,Z){let Y=Z.filePath?k1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(gG,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:k1.resolve(Y,q),!l5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=uG(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=l5.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 lG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${lG(Z.source)}" data-stx-layer="vendor">
1846
1846
  @layer vendor {
1847
1847
  ${Z.contents}
1848
1848
  }
1849
1849
  </style>`}).join(`
1850
1850
  `)}
1851
- `}function Y5($){let Z=Y8($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of K[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Y.add(W)}let X=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of K[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)X.add(W)}let Q=Z8.filter((K)=>{if(Y.has(K)||X.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),J=X8(Z).filter((K)=>!Y.has(K)&&!X.has(K));if(Q.length===0&&J.length===0)return{code:$,imports:Q,models:J};return{code:`${[Q.length>0?`import { ${Q.join(", ")} } from '@stacksjs/browser'`:"",J.length>0?"import '@stacksjs/browser'":"",J.length>0?`const { ${J.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
1851
+ `}function Y5($){let Z=G8($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of K[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Y.add(W)}let X=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of K[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)X.add(W)}let Q=Q8.filter((K)=>{if(Y.has(K)||X.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),J=K8(Z).filter((K)=>!Y.has(K)&&!X.has(K));if(Q.length===0&&J.length===0)return{code:$,imports:Q,models:J};return{code:`${[Q.length>0?`import { ${Q.join(", ")} } from '@stacksjs/browser'`:"",J.length>0?"import '@stacksjs/browser'":"",J.length>0?`const { ${J.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
1852
1852
  `)}
1853
- ${$}`,imports:Q,models:J}}function Y8($){let Z="",Y=0;while(Y<$.length){let X=$.slice(Y,Y+2);if(X==="//"){while(Y<$.length&&$[Y]!==`
1853
+ ${$}`,imports:Q,models:J}}function G8($){let Z="",Y=0;while(Y<$.length){let X=$.slice(Y,Y+2);if(X==="//"){while(Y<$.length&&$[Y]!==`
1854
1854
  `)Z+=" ",Y++;continue}if(X==="/*"){while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Z+=$[Y]===`
1855
1855
  `?`
1856
1856
  `:" ",Y++;Z+=" ",Y+=2;continue}let Q=$[Y];if(Q==='"'||Q==="'"||Q==="`"){let J=Q;Z+=" ",Y++;while(Y<$.length&&$[Y]!==J){if($[Y]==="\\"){Z+=" ",Y+=2;continue}Z+=$[Y]===`
1857
1857
  `?`
1858
- `:" ",Y++}Z+=" ",Y++;continue}Z+=Q,Y++}return Z}function X8($){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(!fG.has(X[1]))Z.add(X[1]);return Array.from(Z)}function gG($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of Y[1].split(",")){let Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function J8($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let _ of W.split(",")){let B=_.trim();if(!B||B.startsWith("type "))continue;let H=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let L=H[1],F=H[2]||L;if(Q.add(L),Q.add(F),U==="stx"||U==="@stacksjs/stx")Z.add(L);else Y.add(L);if(F!==L)z.push(`${F} = ${L}`)}let j=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],j)}let K=gG(X);for(let W of xG){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of Z8){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=X8(X);for(let W of q)if(!Q.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function E7($,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
1858
+ `:" ",Y++}Z+=" ",Y++;continue}Z+=Q,Y++}return Z}function K8($){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(!cG.has(X[1]))Z.add(X[1]);return Array.from(Z)}function iG($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of Y[1].split(",")){let Q=X.trim().split(/[:=]/).pop()?.trim();if(Q&&/^[A-Za-z_$][\w$]*$/.test(Q))Z.add(Q)}return Z}function q8($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let W=G[1],U=G[2];if(G[0].includes("import type"))continue;let z=[];for(let _ of W.split(",")){let B=_.trim();if(!B||B.startsWith("type "))continue;let H=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let F=H[1],L=H[2]||F;if(Q.add(F),Q.add(L),U==="stx"||U==="@stacksjs/stx")Z.add(F);else Y.add(F);if(L!==F)z.push(`${L} = ${F}`)}let j=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],j)}let K=iG(X);for(let W of pG){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(X))Z.add(W)}for(let W of Q8){if(Q.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=K8(X);for(let W of q)if(!Q.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function S7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1859
1859
  ${Y.join(`
1860
1860
  `)}
1861
- ${dG($,Z)}`;return""}function hG($,Z=[]){let{browserImports:Y}=J8($),X=new Set(Z);return E7([],Y.filter((Q)=>!X.has(Q)))}function dG($,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
1861
+ ${oG($,Z)}`;return""}function nG($,Z=[]){let{browserImports:Y}=q8($),X=new Set(Z);return S7([],Y.filter((Q)=>!X.has(Q)))}function oG($,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
1862
1862
  [${Y.join(", ")}].forEach(function (e) {
1863
1863
  if (e[1] !== 'undefined') return;
1864
1864
  console.error(
@@ -1867,10 +1867,10 @@ ${dG($,Z)}`;return""}function hG($,Z=[]){let{browserImports:Y}=J8($),X=new Set(Z
1867
1867
  + 'or it should be imported from a relative path so the bundler includes it.'
1868
1868
  );
1869
1869
  });
1870
- `}function l5($){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 e9($,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 mG($,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(e9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(e9(Y[1],!1).has(Z))return!0;return!1}function y$($,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(mG($,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)
1870
+ `}function p5($){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 X8($,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 sG($,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(X8(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(X8(Y[1],!1).has(Z))return!0;return!1}function P$($,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(sG($,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)
1871
1871
  ${Y.join(`
1872
1872
  `)}
1873
- `}function lG($){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=uG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function pG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=lG(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) {
1873
+ `}function aG($){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=rG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function tG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=aG(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) {
1874
1874
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
1875
1875
  };`;function j(_){if(/\$emit\s*\(/.test(_))return`${z}
1876
1876
  ${_}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -1913,33 +1913,34 @@ else {
1913
1913
  else {
1914
1914
  ${Q}
1915
1915
  }
1916
- }${q})`}function cG($){if($.length===0)return"";return`
1916
+ }${q})`}function eG($){if($.length===0)return"";return`
1917
1917
  // STX: auto-generated event bindings
1918
- ${$.map((Y,X)=>pG(Y,X)).join(`
1919
- `)}`}function $8($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1920
- `)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 j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.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 j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function nG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!iG.has(B))Z.add(B)}}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 p5($,Z={}){let Y=$,X="",Q=!1,J=[],G=b$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=S$(G.styles),q=Y5(Y);Y=q.code,J=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),d5)));if(W(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=J8(Y);Y=O.code,X=E7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${y$(Y,Z.serverData)}${X}`,Y=o0(Y),!Q&&b1(Z.attrs||""))Y=S1(Y);let z=cG(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1918
+ ${$.map((Y,X)=>tG(Y,X)).join(`
1919
+ `)}`}function J8($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1920
+ `)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 j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.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 j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function ZK($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!$K.has(B))Z.add(B)}}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 c5($,Z={}){let Y=$,X="",Q=!1,J=[],G=S$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=y$(G.styles),q=Y5(Y);Y=q.code,J=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),m5)));if(W(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=q8(Y);Y=O.code,X=S7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${P$(Y,Z.serverData)}${X}`,Y=o0(Y),!Q&&b1(Z.attrs||""))Y=S1(Y);let z=eG(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1921
1921
  ${X}${Y}
1922
1922
  ${z}
1923
- </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($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
1924
- return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped>
1923
+ </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($),H=/function __stx_setup_/.test(Y),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(O){let V=O.length>0?`
1924
+ return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped data-stx-run="always">
1925
1925
  window.stx.mount(function() {
1926
1926
  'use strict';
1927
1927
  ${X}${Y}
1928
1928
  ${z}${V}
1929
- })</script>`}if(!L&&!H){if(B)return F($8($));if(Z.templateContent){let O=$8($);if(O.length>0){let V=nG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
1929
+ })</script>`}if(!F&&!H){if(B)return L(J8($));if(Z.templateContent){let O=J8($);if(O.length>0){let V=ZK(Z.templateContent);if(O.some((R)=>V.has(R)))return L(O)}}}return`${K}<script data-stx-scoped data-stx-run="always">
1930
1930
  ;(function() {
1931
1931
  'use strict';
1932
1932
  ${X}${Y}
1933
1933
  ${z}
1934
- })()</script>`}var bG,xG,Z8,fG,uG,iG;var c5=k(()=>{F0();h5();bG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;xG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],Z8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];fG=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"]);uG={left:0,middle:1,right:2};iG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as oG}from"crypto";function G8($){let Z=$[P$];return Z instanceof Map?Z:null}function K8($){$[P$]=new Map}function q8($,Z){let Y=G8($);if(!Y)return null;let X=oG("sha256").update(Z).digest("hex").slice(0,16),Q=Y.get(X);if(Q)Q.instances++;else Y.set(X,{body:Z,instances:1});return X}function W8($,Z){let Y=G8(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(U,(z,j)=>`(${W.body})(${j});`)}let Q=[...Y].filter(([,q])=>q.instances>1);if(Q.length===0)return X;let G=`<script data-stx-scoped data-stx-component-factories>
1934
+ })()</script>`}var gG,pG,Q8,cG,rG,$K;var i5=k(()=>{L0();d5();gG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;pG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],Q8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];cG=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"]);rG={left:0,middle:1,right:2};$K=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as YK}from"crypto";function U8($){let Z=$[C$];return Z instanceof Map?Z:null}function z8($){$[C$]=new Map}function j8($,Z){let Y=U8($);if(!Y)return null;let X=YK("sha256").update(Z).digest("hex").slice(0,16),Q=Y.get(X);if(Q)Q.instances++;else Y.set(X,{body:Z,instances:1});return X}function B8($,Z){let Y=U8(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(U,(z,j)=>`(${W.body})(${j});`)}let Q=[...Y].filter(([,q])=>q.instances>1);if(Q.length===0)return X;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
1935
1935
  (function() {
1936
1936
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
1937
- ${Q.map(([q,W])=>` factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body};`).join(`
1937
+ ${Q.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
1938
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(q)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
1938
1939
  `)}
1939
1940
  })();
1940
1941
  </script>`,K=X.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
1941
1942
  ${X}`;return`${X.slice(0,K)}${G}
1942
- ${X.slice(K)}`}var P$="__stx_component_client_factories";var k7=()=>{};function tG($){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 eG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(rG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&B8.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function $K($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!B8.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 C$($){let Z=$.trim(),Y=tG(Z);eG(Y,Z),$K(Z);for(let X of j8)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!z8.allowBracketNotation&&aG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function ZK($){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("__")||j8.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=b7(X);else Z[Y]=X}return Z}function b7($,Z=0){if(Z>=z8.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>b7(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]=b7(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=ZK(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return C$($),!0}catch{return!1}}function V0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=C$($),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(_8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1943
+ ${X.slice(K)}`}var C$="__stx_component_client_factories";var y7=()=>{};function GK($){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 KK($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(JK.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&F8.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function qK($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!F8.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 v$($){let Z=$.trim(),Y=GK(Z);KK(Y,Z),qK(Z);for(let X of O8)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!H8.allowBracketNotation&&QK.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function WK($){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("__")||O8.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=P7(X);else Z[Y]=X}return Z}function P7($,Z=0){if(Z>=H8.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>P7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=P7(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=WK(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return v$($),!0}catch{return!1}}function V0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=v$($),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(L8.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1943
1944
  'use strict';
1944
1945
  try {
1945
1946
  return ${Y};
@@ -1950,7 +1951,7 @@ catch (e) {
1950
1951
  }
1951
1952
  throw e;
1952
1953
  }
1953
- `),K=G([]);if(J.length===Z.length)return U8(K,J,G);return U8((...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 U8($,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 j=z instanceof Error?z.message:"",_=J.exec(j);if(!(z instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||_8.has(B))return;q.add(B),K.push(B),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 sG,z8,j8,rG,B8,aG,_8;var _0=k(()=>{sG={maxSanitizeDepth:10,allowBracketNotation:!1},z8={...sG},j8=[/\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/],rG=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"]),B8=new Set(["__proto__","constructor","prototype"]),aG=/[\w)\]]\s*\[\s*['"]/;_8=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 x$($,Z){let Y=YK++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return XK.set(X,{type:$,expression:Z}),X}var YK=0,XK;var H8=k(()=>{XK=new Map});function w8($,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 j1($,Z){return w8($,Z,O8,L8)}function X5($,Z){return w8($,Z,F8,V8)}function i5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function JK($,Z){if($.startsWith("<!--",Z)){let Y=i5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[O8,L8],[F8,V8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function S7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=JK($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function t0($,Z,Y){let X=S7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function B1($){let{output:Z,tokens:Y}=t0($,j1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function n5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var O8,L8,F8,V8;var y1=k(()=>{O8=/<script\b[^>]*>/iy,L8=/<\/script\s*>/ig,F8=/<style\b[^>]*>/iy,V8=/<\/style\s*>/ig});var I8={};s(I8,{usesSignalsInScript:()=>J5,unescapeHtml:()=>jK,registerFilters:()=>GK,registerFilter:()=>N8,processExpressions:()=>_1,interpolateScriptsInTemplate:()=>qK,interpolateScriptExpressions:()=>f$,getAllFilters:()=>T8,evaluateExpression:()=>p0,escapeHtml:()=>s0,defaultFilters:()=>s5,clearCustomFilters:()=>KK,applyFilters:()=>M8});function QK($){let Z=A8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),A8.set($,Z)}return Z.lastIndex=0,Z}function N8($,Z){if($ in s5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);o5[$]=Z}function GK($){for(let[Z,Y]of Object.entries($))N8(Z,Y)}function T8(){return{...s5,...o5}}function KK(){for(let $ of Object.keys(o5))delete o5[$]}function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function J5($){let{scripts:Z}=B1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function R8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function f$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=p0(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=p0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function qK($,Z,Y={}){let{output:X,scripts:Q}=B1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=f$(z,Z);return q[0]+j+G.slice(W)});return n5(X,J)}function _1($,Z,Y,X){let Q=$,J=(j,_)=>{let B=X5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:F,tokens:O}=t0(j,_,(V,w)=>H(L+w));return B.push(...O),F},K=[];Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let q=[];Q=G(Q,j1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||J5($),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,(j,_,B)=>{try{let H=p0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=p0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return x$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return x$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),Q=G(Q,j1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(z.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),T=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=p0(_,Z);if(A)return j;if(W&&!R8(H,Z))return j;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return x$("expr",H);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(A)return j;if(W&&!R8(H,Z))return j;if(T)return j;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<q.length;j++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>q[j]);for(let j=0;j<K.length;j++)Q=Q.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return Q}function M8($,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=o5[G]||s5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(T8()).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=[p0(`(${z})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=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){j.push(_),_="";continue}_+=w}if(_)j.push(_);q=j.map((V)=>{let w=V.trim();return p0(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 WK($){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 p0($,Z,Y=!1){try{let X=$.trim(),Q=WK(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=p0(J,Z,!0);return M8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return $0(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=UK(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 UK($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=zK($,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 zK($,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 jK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var o5,A8,s5;var e0=k(()=>{_0();F0();H8();y1();o5={},A8=new Map;s5={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 s0(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(QK(q),String(W))}),K},t:($,Z,Y={})=>{return s5.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 Q5($="const",Z=[],Y){let X=Z.length?g$.filter((Q)=>!Z.includes(Q)):g$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var g$,D8;var r5=k(()=>{g$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],D8=["onMount","onDestroy"]});class P1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function K5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!G5.has(Y)){if(G5.size>=BK){let X=G5.keys().next().value;if(X)G5.delete(X)}G5.set(Y,new RegExp($,Z))}return G5.get(Y)}class E8{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,`
1954
+ `),K=G([]);if(J.length===Z.length)return _8(K,J,G);return _8((...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 _8($,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 j=z instanceof Error?z.message:"",_=J.exec(j);if(!(z instanceof ReferenceError)||!_)return;let B=_[1];if(q.has(B)||L8.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function x$($){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 XK,H8,O8,JK,F8,QK,L8;var _0=k(()=>{XK={maxSanitizeDepth:10,allowBracketNotation:!1},H8={...XK},O8=[/\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/],JK=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"]),F8=new Set(["__proto__","constructor","prototype"]),QK=/[\w)\]]\s*\[\s*['"]/;L8=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 f$($,Z){let Y=UK++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return zK.set(X,{type:$,expression:Z}),X}var UK=0,zK;var V8=k(()=>{zK=new Map});function M8($,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 j1($,Z){return M8($,Z,w8,R8)}function X5($,Z){return M8($,Z,A8,N8)}function n5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function jK($,Z){if($.startsWith("<!--",Z)){let Y=n5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[w8,R8],[A8,N8]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function C7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=jK($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function t0($,Z,Y){let X=C7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function B1($){let{output:Z,tokens:Y}=t0($,j1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function o5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var w8,R8,A8,N8;var y1=k(()=>{w8=/<script\b[^>]*>/iy,R8=/<\/script\s*>/ig,A8=/<style\b[^>]*>/iy,N8=/<\/style\s*>/ig});var b8={};s(b8,{usesSignalsInScript:()=>J5,unescapeHtml:()=>wK,registerFilters:()=>_K,registerFilter:()=>D8,processExpressions:()=>_1,interpolateScriptsInTemplate:()=>OK,interpolateScriptExpressions:()=>g$,getAllFilters:()=>E8,evaluateExpression:()=>p0,escapeHtml:()=>s0,defaultFilters:()=>r5,clearCustomFilters:()=>HK,applyFilters:()=>k8});function BK($){let Z=T8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),T8.set($,Z)}return Z.lastIndex=0,Z}function D8($,Z){if($ in r5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);s5[$]=Z}function _K($){for(let[Z,Y]of Object.entries($))D8(Z,Y)}function E8(){return{...r5,...s5}}function HK(){for(let $ of Object.keys(s5))delete s5[$]}function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function J5($){let{scripts:Z}=B1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function I8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function g$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=p0(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=p0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function OK($,Z,Y={}){let{output:X,scripts:Q}=B1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=g$(z,Z);return q[0]+j+G.slice(W)});return o5(X,J)}function _1($,Z,Y,X){let Q=$,J=(j,_)=>{let B=X5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let F=B.length,{output:L,tokens:O}=t0(j,_,(V,w)=>H(F+w));return B.push(...O),L},K=[];Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let q=[];Q=G(Q,j1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||J5($),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,(j,_,B)=>{try{let H=p0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let F=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${F}`,Y,$,B,j)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=p0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return f$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return f$("raw",_.trim());let F=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${F}`,Y,$,B,j)}}),Q=G(Q,j1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),Q=G(Q,J,K,(j)=>`<!--__STX_STYLE_${j}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(z.has(H))return j;let F=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(L)?.[1],w=V&&((V in Z)||F.includes(V)),R=Boolean(V&&U.has(V)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(A),T=N&&!F.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=p0(_,Z);if(R)return j;if(W&&!I8(H,Z))return j;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return f$("expr",H);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(R)return j;if(W&&!I8(H,Z))return j;if(T)return j;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<q.length;j++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>q[j]);for(let j=0;j<K.length;j++)Q=Q.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return Q}function k8($,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=s5[G]||r5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(E8()).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=[p0(`(${z})`,Y,!0)];else{let j=[],_="",B=null,H=0,F=0,L=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")L++;else if(w==="}")L--;if(w===","&&H===0&&F===0&&L===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);q=j.map((V)=>{let w=V.trim();return p0(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 FK($){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 p0($,Z,Y=!1){try{let X=$.trim(),Q=FK(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=p0(J,Z,!0);return k8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return $0(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=LK(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 LK($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=VK($,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 VK($,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 wK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var s5,T8,r5;var e0=k(()=>{_0();L0();V8();y1();s5={},T8=new Map;r5={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 s0(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(BK(q),String(W))}),K},t:($,Z,Y={})=>{return r5.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 Q5($="const",Z=[],Y){let X=Z.length?h$.filter((Q)=>!Z.includes(Q)):h$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var h$,S8;var a5=k(()=>{h$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],S8=["onMount","onDestroy"]});class P1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function K5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!G5.has(Y)){if(G5.size>=RK){let X=G5.keys().next().value;if(X)G5.delete(X)}G5.set(Y,new RegExp($,Z))}return G5.get(Y)}class y8{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,`
1954
1955
  'use strict';
1955
1956
  try {
1956
1957
  return ${q};
@@ -1961,33 +1962,33 @@ catch (e) {
1961
1962
  }
1962
1963
  throw e;
1963
1964
  }
1964
- `),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 k8{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 _K(){if(!y7)y7=new k8;return y7}var G5,BK=500,ZO,y7=null,b8;var q5=k(()=>{G5=new Map;ZO=new E8;b8=new Proxy({},{get($,Z){return _K()[Z]}})});function S8($,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 y8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=P7($),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 j=z[1],_=`${Z}_${j}`;W.set(j,_)}}for(let U of K){let z=P8(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1965
+ `),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 P8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function AK(){if(!v7)v7=new P8;return v7}var G5,RK=500,jO,v7=null,C8;var q5=k(()=>{G5=new Map;jO=new y8;C8=new Proxy({},{get($,Z){return AK()[Z]}})});function v8($,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 x8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=x7($),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 j=z[1],_=`${Z}_${j}`;W.set(j,_)}}for(let U of K){let z=f8(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1965
1966
 
1966
- `)}function P7($){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,j]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:j.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=P7(j);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
1967
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.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 P8($,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=P7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>P8(j,Z,Y,X,Q,J)).join(`
1967
+ `)}function x7($){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,j]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:j.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=x7(j);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
1968
+ `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.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 f8($,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=x7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>f8(j,Z,Y,X,Q,J)).join(`
1968
1969
  `);return`${G} {
1969
1970
  ${z}
1970
- }`}return`${G} { ${K} }`}let q=HK(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 HK($,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=OK(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function OK($,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 v8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function h$($,Z){if(!LK.test($))return{html:$,hasScoped:!1};let Y=S8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${C7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=FK(W,X),z=q.replace(new RegExp(C7,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=wK(Q,X),{html:Q,hasScoped:!0}}function FK($,Z){return y8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function wK($,Z){let Y=t0($,(Q,J)=>{let G=j1(Q,J);return G>J?G:X5(Q,J)},(Q,J)=>VK(J)),X=AK(Y.output,Z);return C8.lastIndex=0,X.replace(C8,(Q,J)=>Y.tokens[Number(J)])}function AK($,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 C7,LK,VK=($)=>`\x00stx-scope-mask-${$}\x00`,C8;var v7=k(()=>{y1();C7=String.raw`(?<![\w-])scoped(?![\w-])`,LK=new RegExp(`<style\\s+[^>]*${C7}`,"i");C8=/\u0000stx-scope-mask-(\d+)\u0000/g});function NK($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return RK.test(Z)}function d$($){a5.lastIndex=0;let Z;while((Z=a5.exec($))!==null){if(Z[0].startsWith("</")||NK(Z[0]))continue;let Y=Z.index,X=a5.lastIndex,Q=1,J;while((J=a5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:a5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var a5,RK;var x7=k(()=>{a5=/<\/?template\b[^>]*>/gi,RK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var x8=()=>{};function C0($,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 h7={};s(h7,{useTitle:()=>EK,useSeoMeta:()=>f8,usePageTitle:()=>EK,useHead:()=>g7,seoMetaToHeadConfig:()=>u$,resetHead:()=>IK,renderHtmlAttrs:()=>bK,renderHead:()=>kK,renderBodyAttrs:()=>SK,processTitleDirective:()=>CK,processMetaDirective:()=>vK,processHeadDirective:()=>PK,mergeHeadConfigs:()=>W5,getPageMeta:()=>MK,getHead:()=>f7,definePageMeta:()=>DK,applyHead:()=>yK});function f7(){return H1}function MK(){return m$}function IK(){H1={},TK.length=0,m$={}}function g7($){H1=W5(H1,$)}function W5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function f8($){g7(u$($))}function u$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function DK($){if(m$={...m$,...$},$.title||$.description)f8({title:$.title,description:$.description})}function EK($){let Z=typeof $==="function"?$():$;g7({title:Z})}function kK($=H1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${C1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${C1(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}="${C1(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}="${C1(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}="${C1(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(`
1971
- `)}function bK($=H1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${C1(Y)}"`).join(" ")}function SK($=H1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${C1(Y)}"`).join(" ")}function C1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function yK($=H1){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 PK($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1972
- `,""}),headContent:Z.trim()}}function CK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(K,{title:G}),""})}function vK($,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},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(j,{meta:[z]}),""})}var H1,TK,m$;var t5=k(()=>{H1={},TK=[],m$={}});var l$={};s(l$,{stripTypeScript:()=>u8,splitDeclaration:()=>n8,isModuleResolutionFailure:()=>l8,isCompleteImport:()=>p8,hasVariables:()=>r8,extractVariables:()=>v1,extractScriptFromTemplate:()=>s8,convertToCommonJS:()=>m7});import O1 from"path";import U5 from"process";function xK($){let Z=[],Y=0,X=$.split(`
1973
- `);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((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function u8($){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("..."),j=z?U.slice(3):U,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return W;let L=j.substring(0,_).trim().replace(/\?$/,""),F=j.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let j=Y(z);J.push({start:G+1,end:q,replacement:j})}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,`
1971
+ }`}return`${G} { ${K} }`}let q=NK(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 NK($,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=MK(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function MK($,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 h8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function d$($,Z){if(!TK.test($))return{html:$,hasScoped:!1};let Y=v8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${f7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=IK(W,X),z=q.replace(new RegExp(f7,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=EK(Q,X),{html:Q,hasScoped:!0}}function IK($,Z){return x8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function EK($,Z){let Y=t0($,(Q,J)=>{let G=j1(Q,J);return G>J?G:X5(Q,J)},(Q,J)=>DK(J)),X=kK(Y.output,Z);return g8.lastIndex=0,X.replace(g8,(Q,J)=>Y.tokens[Number(J)])}function kK($,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 f7,TK,DK=($)=>`\x00stx-scope-mask-${$}\x00`,g8;var g7=k(()=>{y1();f7=String.raw`(?<![\w-])scoped(?![\w-])`,TK=new RegExp(`<style\\s+[^>]*${f7}`,"i");g8=/\u0000stx-scope-mask-(\d+)\u0000/g});function SK($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return bK.test(Z)}function m$($){t5.lastIndex=0;let Z;while((Z=t5.exec($))!==null){if(Z[0].startsWith("</")||SK(Z[0]))continue;let Y=Z.index,X=t5.lastIndex,Q=1,J;while((J=t5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:t5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var t5,bK;var h7=k(()=>{t5=/<\/?template\b[^>]*>/gi,bK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var d8=()=>{};function C0($,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 u7={};s(u7,{useTitle:()=>xK,useSeoMeta:()=>m8,usePageTitle:()=>xK,useHead:()=>m7,seoMetaToHeadConfig:()=>l$,resetHead:()=>CK,renderHtmlAttrs:()=>gK,renderHead:()=>fK,renderBodyAttrs:()=>hK,processTitleDirective:()=>uK,processMetaDirective:()=>lK,processHeadDirective:()=>mK,mergeHeadConfigs:()=>W5,getPageMeta:()=>PK,getHead:()=>d7,definePageMeta:()=>vK,applyHead:()=>dK});function d7(){return H1}function PK(){return u$}function CK(){H1={},yK.length=0,u$={}}function m7($){H1=W5(H1,$)}function W5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function m8($){m7(l$($))}function l$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function vK($){if(u$={...u$,...$},$.title||$.description)m8({title:$.title,description:$.description})}function xK($){let Z=typeof $==="function"?$():$;m7({title:Z})}function fK($=H1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${C1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${C1(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}="${C1(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}="${C1(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}="${C1(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(`
1972
+ `)}function gK($=H1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${C1(Y)}"`).join(" ")}function hK($=H1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${C1(Y)}"`).join(" ")}function C1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function dK($=H1){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))if(Z==="class")for(let X of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(X);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function mK($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1973
+ `,""}),headContent:Z.trim()}}function uK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(K,{title:G}),""})}function lK($,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},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(j,{meta:[z]}),""})}var H1,yK,u$;var e5=k(()=>{H1={},yK=[],u$={}});var p$={};s(p$,{stripTypeScript:()=>i8,splitDeclaration:()=>a8,isModuleResolutionFailure:()=>n8,isCompleteImport:()=>o8,hasVariables:()=>$Z,extractVariables:()=>v1,extractScriptFromTemplate:()=>e8,convertToCommonJS:()=>p7});import O1 from"path";import U5 from"process";function pK($){let Z=[],Y=0,X=$.split(`
1974
+ `);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((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function i8($){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("..."),j=z?U.slice(3):U,_=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){_=R;break}if(_===-1)return W;let F=j.substring(0,_).trim().replace(/\?$/,""),L=j.substring(_+1),O=-1,V=0;for(let R=0;R<L.length;R++)if(L[R]==="<")V++;else if(L[R]===">")V--;else if(L[R]==="="&&V===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${F} = ${L.substring(O+1).trim()}`;return`${w}${F}`}).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 _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let j=Y(z);J.push({start:G+1,end:q,replacement:j})}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,`
1974
1975
 
1975
- `),Z}function l8($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}async function v1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),C=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");C=C.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=P.transformSync(C)}catch{Q=u8($)}let J={exports:{}},G=J.exports,K=U5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of W)try{let C=O1.resolve(K,"node_modules",P),x=O1.join(C,"package.json"),u=JSON.parse(q0("fs").readFileSync(x,"utf8")),d=u.main||"index.js";if(u.exports){let U0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof U0==="string")d=U0;else if(U0?.bun)d=U0.bun;else if(U0?.import)d=U0.import;else if(U0?.default)d=U0.default}q[P]=await import(O1.resolve(C,d))}catch{}let U=(P)=>{if(q[P])return q[P];return q0(P)},z=Z.props||{},j=(P)=>{if(!P)return z;let C={};for(let[x,u]of Object.entries(P)){let d=z[x];if(d!==void 0)C[x]=d;else if(typeof u==="function")C[x]=u();else C[x]=u}return C};for(let[P,C]of Object.entries(z))Object.defineProperty(j,P,{value:C,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,P))continue;try{Object.defineProperty(j,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(P)=>{if(!P)return z;let C={...z};for(let[x,u]of Object.entries(P)){let d=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(C[x]===void 0&&d.default!==void 0)C[x]=typeof d.default==="function"?d.default():d.default}return C},B=()=>Z.slots||{},H=(P,C)=>{let x={...P};for(let[u,d]of Object.entries(C))if(x[u]===void 0)if(typeof d==="function")x[u]=d();else x[u]=d;return x},L=(P)=>{let C=()=>P;return C.set=(x)=>{},C.update=(x)=>{},C},F=(P)=>{let C,x=!1;return()=>{if(!x)try{C=P(),x=!0}catch{C=void 0}return C}},O=(P)=>{},V=(P)=>P(),w=(P)=>{},A=(P)=>{},N=(P)=>{},R=()=>{let P=Z.__stxServeContext,C=Z.__stxServeSearch??P?.search??"",x=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(C)),path:x,name:"",fullPath:x+C,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),M=(P)=>{let C=Z.__stx_runtime_head||{};Z.__stx_runtime_head=W5(C,P||{})},I=(P)=>{M(u$(P||{}))},E=(P)=>({value:P}),D=(P)=>P,y=(P)=>({value:typeof P==="function"?P():P}),S=(P,C)=>{},b=(P)=>{},v=(P)=>{},h=(P)=>P?P():Promise.resolve(),f=(P)=>(C,...x)=>{},m=(P)=>{},r=(P,C)=>{},M0=(P,C)=>C,I0=()=>({value:"light"}),m0=()=>L(!1),Y0=(P)=>L(!1),X0=()=>L(!1),D0=()=>Y0("(prefers-color-scheme: dark)"),i0=()=>Y0("(prefers-color-scheme: light)"),W1=()=>Y0("(prefers-reduced-motion: reduce)"),a1=()=>Y0("(prefers-contrast: more)"),i={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:{}},Z0=new Proxy(i,{get(P,C){if(C in P)return P[C];return},set(P,C,x){return P[C]=x,!0}}),j0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},R0=console;try{let P=m7(Q,Y),C=new Set(Object.keys(z)),x=(c)=>/^[a-z_$][\w$]*$/i.test(c),u=Object.keys(Z).filter((c)=>!C.has(c)&&c!=="props"&&x(c)),d=u.map((c)=>Z[c]),U0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),O0=[],Y1=[];for(let[c,f0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(c))continue;if(U0.has(c))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${c}\\b`).test(P))continue;O0.push(c),Y1.push(f0)}let y0=xK(P).map((c)=>`module.exports.${c} = typeof ${c} !== 'undefined' ? ${c} : module.exports.${c};`).join(`
1976
- `),n0=Z.params??{},M1=[],U1=[];for(let c=0;c<u.length;c++){if(u[c]==="params")continue;M1.push(u[c]),U1.push(d[c])}let K0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...O0,...M1,`return (async () => {
1976
+ `),Z}function n8($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}async function v1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),C=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");C=C.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=P.transformSync(C)}catch{Q=i8($)}let J={exports:{}},G=J.exports,K=U5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of W)try{let C=O1.resolve(K,"node_modules",P),x=O1.join(C,"package.json"),u=JSON.parse(q0("fs").readFileSync(x,"utf8")),d=u.main||"index.js";if(u.exports){let U0=typeof u.exports==="string"?u.exports:u.exports["."];if(typeof U0==="string")d=U0;else if(U0?.bun)d=U0.bun;else if(U0?.import)d=U0.import;else if(U0?.default)d=U0.default}q[P]=await import(O1.resolve(C,d))}catch{}let U=(P)=>{if(q[P])return q[P];return q0(P)},z=Z.props||{},j=(P)=>{if(!P)return z;let C={};for(let[x,u]of Object.entries(P)){let d=z[x];if(d!==void 0)C[x]=d;else if(typeof u==="function")C[x]=u();else C[x]=u}return C};for(let[P,C]of Object.entries(z))Object.defineProperty(j,P,{value:C,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,P))continue;try{Object.defineProperty(j,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(P)=>{if(!P)return z;let C={...z};for(let[x,u]of Object.entries(P)){let d=u&&typeof u==="object"&&!Array.isArray(u)?u:{type:u};if(C[x]===void 0&&d.default!==void 0)C[x]=typeof d.default==="function"?d.default():d.default}return C},B=()=>Z.slots||{},H=(P,C)=>{let x={...P};for(let[u,d]of Object.entries(C))if(x[u]===void 0)if(typeof d==="function")x[u]=d();else x[u]=d;return x},F=(P)=>{let C=()=>P;return C.set=(x)=>{},C.update=(x)=>{},C},L=(P)=>{let C,x=!1;return()=>{if(!x)try{C=P(),x=!0}catch{C=void 0}return C}},O=(P)=>{},V=(P)=>P(),w=(P)=>{},R=(P)=>{},A=(P)=>{},N=()=>{let P=Z.__stxServeContext,C=Z.__stxServeSearch??P?.search??"",x=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(C)),path:x,name:"",fullPath:x+C,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),M=(P)=>{let C=Z.__stx_runtime_head||{};Z.__stx_runtime_head=W5(C,P||{})},I=(P)=>{M(l$(P||{}))},E=(P)=>({value:P}),D=(P)=>P,y=(P)=>({value:typeof P==="function"?P():P}),S=(P,C)=>{},b=(P)=>{},v=(P)=>{},h=(P)=>P?P():Promise.resolve(),f=(P)=>(C,...x)=>{},m=(P)=>{},r=(P,C)=>{},T0=(P,C)=>C,I0=()=>({value:"light"}),m0=()=>F(!1),Y0=(P)=>F(!1),X0=()=>F(!1),D0=()=>Y0("(prefers-color-scheme: dark)"),i0=()=>Y0("(prefers-color-scheme: light)"),W1=()=>Y0("(prefers-reduced-motion: reduce)"),a1=()=>Y0("(prefers-contrast: more)"),n={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Z0=new Proxy(n,{get(P,C){if(C in P)return P[C];return},set(P,C,x){return P[C]=x,!0}}),j0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},A0=console;try{let P=p7(Q,Y),C=new Set(Object.keys(z)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),u=Object.keys(Z).filter((i)=>!C.has(i)&&i!=="props"&&x(i)),d=u.map((i)=>Z[i]),U0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),O0=[],Y1=[];for(let[i,f0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(U0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(P))continue;O0.push(i),Y1.push(f0)}let y0=pK(P).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
1977
+ `),n0=Z.params??{},T1=[],U1=[];for(let i=0;i<u.length;i++){if(u[i]==="params")continue;T1.push(u[i]),U1.push(d[i])}let K0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...O0,...T1,`return (async () => {
1977
1978
  ${P}
1978
1979
  ${y0}
1979
1980
  return module.exports
1980
- })()`)(J,G,U,z,j,_,H,L,F,O,V,w,A,N,R,T,M,I,E,D,y,S,b,v,h,f,m,B,r,M0,I0,m0,Y0,X0,D0,i0,W1,a1,Z0,j0,R0,i.confirm,i.alert,i.fetch,n0,...Y1,...U1);if(X.preserveExisting){for(let[c,f0]of Object.entries(K0))if(!(c in Z)||Z[c]===void 0)Z[c]=f0}else Object.assign(Z,K0);for(let[c,f0]of Object.entries(z))if(!(c in Z))Z[c]=f0}catch(P){let C=P instanceof Error?P.message:String(P);if(l8(C))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${C}`);else if(U5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${C}`);try{await mK(Q,Z,Y)}catch(x){if(U5.env.STX_DEBUG){let u=x instanceof Error?x.message:String(x);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${u}`)}}}}function p8($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function m7($,Z){let Y=Z?O1.dirname(Z):U5.cwd(),X=U5.cwd(),Q=$.split(`
1981
- `),J=[],G=0;while(G<Q.length){let K=Q[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<Q.length;G++){for(let W of Q[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1;for(let U=G;U<Q.length&&!W;U++){let z=null,j=!1,_=Q[U];for(let B=0;B<_.length;B++){let H=_[B];if(j){j=!1;continue}if(H==="\\"){j=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")q++;else if(H===")"){if(q--,q===0){G=U+1,W=!0;break}}}}if(!W)G=Q.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!p8(q)&&G+W+1<Q.length)W++,q=`${q} ${Q[G+W].trim()}`;G+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=q.match(/^import\s+['"](.+?)['"]/),_=q,B=(H)=>{if(H.startsWith("."))return O1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return O1.resolve(X,H.slice(2));return H};if(U){let[,H,L]=U,F=B(L);J.push(`const ${H} = await import('${F}')`),J.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,L]=z,F=B(L),O=[],V=[];for(let w of H.split(",")){let A=w.trim();if(!A)continue;let N=A.split(/\s+as\s+/);if(N.length===2){let[R,T]=[N[0].trim(),N[1].trim()];O.push(`${R}: ${T}`),V.push(T)}else O.push(A),V.push(A)}J.push(`const { ${O.join(", ")} } = await import('${F}')`);for(let w of V)J.push(`module.exports.${w} = ${w};`)}else if(j){let H=B(j[1]);J.push(`await import('${H}')`)}else J.push(_);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))J.push(Q[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=g8(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=d7(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=g8(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=d7(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Q];W[G]=q;let U=d7(W,G);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=Q[G].replace(/^export\s+/,""),z=0,j=G;for(;j<Q.length;j++){let _=Q[j];for(let B of _)if(B==="{")z++;else if(B==="}")z--;if(j>G)U+=`
1982
- `+_;if(z<=0&&j>=G)break}J.push(U),J.push(`module.exports.${W} = ${W};`),G=j+1}else J.push(K),G++}else if(K.includes("module.exports"))J.push(K),G++;else if(K.trim()&&!K.startsWith("//"))J.push(K),G++;else G++}return fK(J.join(`
1983
- `),Y,X)}function fK($,Z,Y){let X=$.length,Q="",J=0,G=null,K=!1,q=!1,W=0;while(J<X){let U=$[J],z=$[J+1];if(K){if(Q+=U,U===`
1984
- `)K=!1;J++;continue}if(q){if(Q+=U,U==="*"&&z==="/"){Q+=z,J+=2,q=!1;continue}J++;continue}if(!G&&U==="/"&&z==="/"){K=!0,Q+=U,J++;continue}if(!G&&U==="/"&&z==="*"){q=!0,Q+=U,J++;continue}if(G){if(Q+=U,U==="\\"){Q+=z,J+=2;continue}if(U===G&&G!=="`"){G=null,J++;continue}if(G==="`"){if(U==="$"&&z==="{"){W++,Q+=z,J+=2;continue}if(U==="`"){G=null,J++;continue}}J++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){G=U,Q+=U,J++;continue}if(U==="a"&&$.startsWith("await",J)){let j=gK($,J);if(j){let{quote:_,path:B,end:H}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let L=B.startsWith(".")?O1.resolve(Z,B):O1.resolve(Y,B.slice(2));Q+=`await import(${_}${L}${_})`,J=H;continue}}}Q+=U,J++}return Q}function gK($,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 c8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=C0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function i8($){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=c8(Y,X);if(K){let q=i8(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 n8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function g8($,Z){let Y=$[Z].trim(),X=n8(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",H=z;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;z=H}let _=c8(z,0);if(_){let B=U[1],H=_.pattern,L=z.slice(_.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(j,Z);if(h8(F)){let R=d8($,V,F);O=R.value,V=R.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=i8(H),A=`__stx_src_${Z}`,N=w.map((R)=>`module.exports.${R} = ${R};`).join(`
1985
- `);return{type:B,name:A,value:`${O}; ${B} ${H} = ${A};
1986
- ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(h8(K)){let U=d8($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1987
- ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function d7($,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(hK(Y)){let K=dK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function h8($){let Z=$.trim();if(Z.startsWith("{"))return C0(Z,"{","}",0)===-1;if(Z.startsWith("["))return C0(Z,"[","]",0)===-1;return!o8(Z)}function o8($){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 hK($){let Z=$.indexOf("{");if(Z===-1)return!0;return C0($,"{","}",Z)===-1}function d8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!o8(X)){let J=$[Q];X+=`
1981
+ })()`)(J,G,U,z,j,_,H,F,L,O,V,w,R,A,N,T,M,I,E,D,y,S,b,v,h,f,m,B,r,T0,I0,m0,Y0,X0,D0,i0,W1,a1,Z0,j0,A0,n.confirm,n.alert,n.fetch,n0,...Y1,...U1);if(X.preserveExisting){for(let[i,f0]of Object.entries(K0))if(!(i in Z)||Z[i]===void 0)Z[i]=f0}else Object.assign(Z,K0);for(let[i,f0]of Object.entries(z))if(!(i in Z))Z[i]=f0}catch(P){let C=P instanceof Error?P.message:String(P);if(n8(C))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${C}`);else if(U5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${C}`);try{await sK(Q,Z,Y)}catch(x){if(U5.env.STX_DEBUG){let u=x instanceof Error?x.message:String(x);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${u}`)}}}}function o8($){let Z=0,Y=null,X=!1,Q=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){if(G===Y){if(Y=null,X||Z===0)Q=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",J)&&Z===0)X=!0}return Y===null&&Z===0&&Q}function p7($,Z){let Y=Z?O1.dirname(Z):U5.cwd(),X=U5.cwd(),Q=$.split(`
1982
+ `),J=[],G=0;while(G<Q.length){let K=Q[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<Q.length;G++){for(let W of Q[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1;for(let U=G;U<Q.length&&!W;U++){let z=null,j=!1,_=Q[U];for(let B=0;B<_.length;B++){let H=_[B];if(j){j=!1;continue}if(H==="\\"){j=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")q++;else if(H===")"){if(q--,q===0){G=U+1,W=!0;break}}}}if(!W)G=Q.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!o8(q)&&G+W+1<Q.length)W++,q=`${q} ${Q[G+W].trim()}`;G+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=q.match(/^import\s+['"](.+?)['"]/),_=q,B=(H)=>{if(H.startsWith("."))return O1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return O1.resolve(X,H.slice(2));return H};if(U){let[,H,F]=U,L=B(F);J.push(`const ${H} = await import('${L}')`),J.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,F]=z,L=B(F),O=[],V=[];for(let w of H.split(",")){let R=w.trim();if(!R)continue;let A=R.split(/\s+as\s+/);if(A.length===2){let[N,T]=[A[0].trim(),A[1].trim()];O.push(`${N}: ${T}`),V.push(T)}else O.push(R),V.push(R)}J.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let w of V)J.push(`module.exports.${w} = ${w};`)}else if(j){let H=B(j[1]);J.push(`await import('${H}')`)}else J.push(_);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))J.push(Q[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=u8(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=l7(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=u8(Q,G),{type:W,name:U,value:z}=q;J.push(`${W} ${U} = ${z};`),J.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=l7(Q,G);J.push(q.functionCode),J.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=Q[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Q];W[G]=q;let U=l7(W,G);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=Q[G].replace(/^export\s+/,""),z=0,j=G;for(;j<Q.length;j++){let _=Q[j];for(let B of _)if(B==="{")z++;else if(B==="}")z--;if(j>G)U+=`
1983
+ `+_;if(z<=0&&j>=G)break}J.push(U),J.push(`module.exports.${W} = ${W};`),G=j+1}else J.push(K),G++}else if(K.includes("module.exports"))J.push(K),G++;else if(K.trim()&&!K.startsWith("//"))J.push(K),G++;else G++}return cK(J.join(`
1984
+ `),Y,X)}function cK($,Z,Y){let X=$.length,Q="",J=0,G=null,K=!1,q=!1,W=0;while(J<X){let U=$[J],z=$[J+1];if(K){if(Q+=U,U===`
1985
+ `)K=!1;J++;continue}if(q){if(Q+=U,U==="*"&&z==="/"){Q+=z,J+=2,q=!1;continue}J++;continue}if(!G&&U==="/"&&z==="/"){K=!0,Q+=U,J++;continue}if(!G&&U==="/"&&z==="*"){q=!0,Q+=U,J++;continue}if(G){if(Q+=U,U==="\\"){Q+=z,J+=2;continue}if(U===G&&G!=="`"){G=null,J++;continue}if(G==="`"){if(U==="$"&&z==="{"){W++,Q+=z,J+=2;continue}if(U==="`"){G=null,J++;continue}}J++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){G=U,Q+=U,J++;continue}if(U==="a"&&$.startsWith("await",J)){let j=iK($,J);if(j){let{quote:_,path:B,end:H}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?O1.resolve(Z,B):O1.resolve(Y,B.slice(2));Q+=`await import(${_}${F}${_})`,J=H;continue}}}Q+=U,J++}return Q}function iK($,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 s8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=C0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function r8($){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=s8(Y,X);if(K){let q=r8(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 a8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(Q)=>Q===" "||Q==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let Q=0,J=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(J){if(G==="\\"){Y++;continue}if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Q++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Q--;continue}if(G==="="&&Q<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function u8($,Z){let Y=$[Z].trim(),X=a8(Y),Q=X?[Y,X.type,X.name,X.value]:null;if(!Q){let U=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Y.slice(U[0].length),j=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",H=z;for(let F=Z+1;F<$.length;F++)if(H+=" "+$[F].trim(),j=F,$[F].includes(B))break;z=H}let _=s8(z,0);if(_){let B=U[1],H=_.pattern,F=z.slice(_.endPos).trim();if(F.startsWith("=")){let L=F.slice(1).trim(),O=L,V=Math.max(j,Z);if(l8(L)){let N=p8($,V,L);O=N.value,V=N.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=r8(H),R=`__stx_src_${Z}`,A=w.map((N)=>`module.exports.${N} = ${N};`).join(`
1986
+ `);return{type:B,name:R,value:`${O}; ${B} ${H} = ${R};
1987
+ ${A}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,J,G,K]=Q,q=K,W=Z;if(l8(K)){let U=p8($,Z,K);q=U.value,W=U.nextIndex}else W=Z+1;while(W<$.length){let U=$[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
1988
+ ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:J,name:G,value:q,nextIndex:W}}function l7($,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(nK(Y)){let K=oK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function l8($){let Z=$.trim();if(Z.startsWith("{"))return C0(Z,"{","}",0)===-1;if(Z.startsWith("["))return C0(Z,"[","]",0)===-1;return!t8(Z)}function t8($){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 nK($){let Z=$.indexOf("{");if(Z===-1)return!0;return C0($,"{","}",Z)===-1}function p8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!t8(X)){let J=$[Q];X+=`
1988
1989
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1989
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function dK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(C0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1990
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function m8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...U5.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 mK($,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=m8(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=m8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function s8($){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 r8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var e5=k(()=>{t5();D1();_0()});var u7={};s(u7,{renderSlot:()=>t8,processSlots:()=>$Z,parseSlots:()=>a8,parseSlotElement:()=>iK,extractSlotContent:()=>sK,applySlots:()=>rK});function uK($,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 pK($,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 cK($){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 j=$.indexOf("-->",J+4);Q=j===-1?$.length:j+3;continue}let G=pK($,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 j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);Q=G;continue}if(U==="template"&&Y.length===0){let j=K.match(X);if(j){let _=uK($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:J,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!lK.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){Q=j;continue}}}Q=G}return Z}function a8($){let Z={default:"",named:new Map},Y=$,X=cK($);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,j,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),F=`<${W}${L?" "+L:""}>${_}</${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,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).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 iK($){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 t8($,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((j)=>j.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=nK(Q,G)}return Q}function nK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=e8(Q,Z);return s0(String(J??""))}catch{return`{{ ${X} }}`}})}function e8($,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 $Z($,Z,Y){let X=$;X=await oK(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",j=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],F=H[2];_[L]=e8(F,Y)}return await t8(U,_,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 oK($,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 sK($){let Z=a8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function rK($,Z,Y,X){return await $Z($,{default:Z,named:Y},X)}var lK;var l7=k(()=>{e0();_0();lK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function L1($,Z){let Y=aK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function aK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=C0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function tK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function x1($,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 ZZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=L1($,X);if(!Q)return null;let J=Q.endPos,G=x1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,j=0,_=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let H=K.substring(B);if(tK(K,B)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W});let F=W+L[0].length,O=L1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W}),U="else",z=void 0,W+=5,j=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(j),start:J+j,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function $$($){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=ZZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function p$($,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=C0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,j=x1($,Z,Y,z);if(j===-1){J=Q.exec($);continue}let _=$.slice(z,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:U,content:_,start:K,end:B}),Q.lastIndex=B,J=Q.exec($)}return X}function p7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=L1($,X);if(!Q)return null;let J=Q.endPos,G=x1($,"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 j=K.slice(W),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(z--,U)U.content+=B[0];W+=B[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=L1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&j.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&j.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 YZ=()=>{};var XZ=()=>{};var c$=k(()=>{YZ();XZ()});function o$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(g0)X.add(g0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),Z$)X.forEach((K)=>n$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function s$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,Z$)X.forEach((G)=>n$.add(G));else X.forEach((G)=>G())},J=()=>{if(g0)X.add(g0);if(Y){let G=g0;g0=Q,i$.push(Q);try{Z=$()}finally{i$.pop(),g0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function r$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=g0;g0=Q,i$.push(Q);try{Y=$()}finally{i$.pop(),g0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function c7($){if(Z$){$();return}Z$=!0;try{$()}finally{Z$=!1,n$.forEach((Z)=>Z()),n$.clear()}}function i7($){Yq.push($)}function n7($){Xq.push($)}function a$($){return typeof $==="function"&&$._isSignal===!0}function t$($){return typeof $==="function"&&$._isDerived===!0}function o7($){if(a$($)||t$($))return $();return $}function e$($){let Z=g0;g0=null;try{return $()}finally{g0=Z}}function Jq($,Z){let Y=typeof $==="function"?$:()=>$,X=o$([]),Q=s$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return r$(()=>{if(Y(),!J){J=!0;return}if(e$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((j)=>j!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var g0=null,i$,Z$=!1,n$,Yq,Xq;var s7=k(()=>{i$=[],n$=new Set,Yq=[],Xq=[]});var QZ={};s(QZ,{useOptimistic:()=>Jq,untrack:()=>o7,state:()=>o$,peek:()=>e$,onMount:()=>i7,onDestroy:()=>n7,isSignal:()=>a$,isDerived:()=>t$,generateSignalsRuntimeDev:()=>$4,generateSignalsRuntime:()=>JZ,effect:()=>r$,derived:()=>s$,default:()=>Gq,batch:()=>c7});function JZ(){try{let $=Qq($4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $4()}}function Qq($){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 $4(){return`
1990
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function oK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(C0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1991
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function c8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...U5.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 sK($,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=c8(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=c8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function e8($){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 $Z($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var $$=k(()=>{e5();D1();_0()});var c7={};s(c7,{renderSlot:()=>YZ,processSlots:()=>JZ,parseSlots:()=>ZZ,parseSlotElement:()=>$q,extractSlotContent:()=>Xq,applySlots:()=>Jq});function rK($,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 tK($,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 eK($){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 j=$.indexOf("-->",J+4);Q=j===-1?$.length:j+3;continue}let G=tK($,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 j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);Q=G;continue}if(U==="template"&&Y.length===0){let j=K.match(X);if(j){let _=rK($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:J,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!aK.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){Q=j;continue}}}Q=G}return Z}function ZZ($){let Z={default:"",named:new Map},Y=$,X=eK($);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,j,_]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(B+H).trim(),L=`<${W}${F?" "+F:""}>${_}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,j]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),F=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}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 $q($){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 YZ($,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((j)=>j.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=Zq(Q,G)}return Q}function Zq($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=XZ(Q,Z);return s0(String(J??""))}catch{return`{{ ${X} }}`}})}function XZ($,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 JZ($,Z,Y){let X=$;X=await Yq(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",j=q||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let F=H[1],L=H[2];_[F]=XZ(L,Y)}return await YZ(U,_,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 Yq($,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 Xq($){let Z=ZZ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Jq($,Z,Y,X){return await JZ($,{default:Z,named:Y},X)}var aK;var i7=k(()=>{e0();_0();aK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function F1($,Z){let Y=Qq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function Qq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=C0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function Gq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function x1($,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 QZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=F1($,X);if(!Q)return null;let J=Q.endPos,G=x1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,j=0,_=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let H=K.substring(B);if(Gq(K,B)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let F=H.match(/^@elseif\s*/);if(F){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W});let L=W+F[0].length,O=F1(K,L);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(j,W),start:J+j,end:J+W}),U="else",z=void 0,W+=5,j=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(j),start:J+j,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function Z$($){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=QZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function c$($,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=C0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,j=x1($,Z,Y,z);if(j===-1){J=Q.exec($);continue}let _=$.slice(z,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:U,content:_,start:K,end:B}),Q.lastIndex=B,J=Q.exec($)}return X}function n7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=F1($,X);if(!Q)return null;let J=Q.endPos,G=x1($,"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 j=K.slice(W),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(B){if(z--,U)U.content+=B[0];W+=B[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=j.match(/^@case\s*/),F=j.match(/^@default(?![a-z])/),L=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=F1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(F&&j.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=F[0].length}else if(L&&j.startsWith("@break"))W+=L[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 GZ=()=>{};var KZ=()=>{};var i$=k(()=>{GZ();KZ()});function s$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(g0)X.add(g0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),Y$)X.forEach((K)=>o$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function r$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,Y$)X.forEach((G)=>o$.add(G));else X.forEach((G)=>G())},J=()=>{if(g0)X.add(g0);if(Y){let G=g0;g0=Q,n$.push(Q);try{Z=$()}finally{n$.pop(),g0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function a$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=g0;g0=Q,n$.push(Q);try{Y=$()}finally{n$.pop(),g0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function o7($){if(Y$){$();return}Y$=!0;try{$()}finally{Y$=!1,o$.forEach((Z)=>Z()),o$.clear()}}function s7($){Uq.push($)}function r7($){zq.push($)}function t$($){return typeof $==="function"&&$._isSignal===!0}function e$($){return typeof $==="function"&&$._isDerived===!0}function a7($){if(t$($)||e$($))return $();return $}function $4($){let Z=g0;g0=null;try{return $()}finally{g0=Z}}function jq($,Z){let Y=typeof $==="function"?$:()=>$,X=s$([]),Q=r$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return a$(()=>{if(Y(),!J){J=!0;return}if($4(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((j)=>j!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var g0=null,n$,Y$=!1,o$,Uq,zq;var t7=k(()=>{n$=[],o$=new Set,Uq=[],zq=[]});var WZ={};s(WZ,{useOptimistic:()=>jq,untrack:()=>a7,state:()=>s$,peek:()=>$4,onMount:()=>s7,onDestroy:()=>r7,isSignal:()=>t$,isDerived:()=>e$,generateSignalsRuntimeDev:()=>Z4,generateSignalsRuntime:()=>qZ,effect:()=>a$,derived:()=>r$,default:()=>_q,batch:()=>o7});function qZ(){try{let $=Bq(Z4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return Z4()}}function Bq($){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 Z4(){return`
1991
1992
  // STX Signals Runtime (Development Build)
1992
1993
  console.log('[stx] signals runtime loading');
1993
1994
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -3860,12 +3861,6 @@ catch (e) {
3860
3861
  }
3861
3862
 
3862
3863
  function processElement(el, scope = componentScope) {
3863
- // Debug: log every element with x-class or @click
3864
- if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute) {
3865
- if (el.hasAttribute('x-class') || el.hasAttribute('@click')) {
3866
- console.log('[stx] processElement:', el.tagName, 'x-class:', el.hasAttribute('x-class'), '@click:', el.hasAttribute('@click'));
3867
- }
3868
- }
3869
3864
  // Lazy hydration: if this element has stx-hydrate and hasn't been hydrated
3870
3865
  // yet, defer its subtree processing until the trigger fires.
3871
3866
  if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated) {
@@ -4076,23 +4071,36 @@ else if (part) {
4076
4071
  const pipeResult = parsePipeExpression(expr, activeScope);
4077
4072
  if (pipeResult) {
4078
4073
  const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
4079
- return maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope));
4074
+ var piped = maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope));
4075
+ noteExprSuccess(expr);
4076
+ return piped;
4080
4077
  }
4081
4078
 
4082
4079
  // Use auto-unwrap proxy (Feature #1)
4083
4080
  const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
4084
4081
  const fn = new Function('__scope__', 'with(__scope__) { return (' + expr + ') }');
4085
- return maybeUnwrapSignal(fn(unwrapScope));
4082
+ var value = maybeUnwrapSignal(fn(unwrapScope));
4083
+ noteExprSuccess(expr);
4084
+ return value;
4086
4085
  }
4087
4086
  catch (e) {
4088
4087
  // Auto-unwrap can break explicit signal calls like errorData().message
4089
4088
  // Retry without auto-unwrap so signal functions remain callable
4090
4089
  try {
4091
4090
  const fn = new Function('__scope__', 'with(__scope__) { return (' + expr + ') }');
4092
- return maybeUnwrapSignal(fn(activeScope));
4091
+ var retried = maybeUnwrapSignal(fn(activeScope));
4092
+ noteExprSuccess(expr);
4093
+ return retried;
4093
4094
  }
4094
4095
  catch (e2) {
4095
4096
  if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Attribute expression error:', expr, e2);
4097
+ // ReferenceError/TypeError stay unlogged HERE on purpose: a signal
4098
+ // may not exist yet on an effect's first pass, and warning on every
4099
+ // one of those trains people to ignore the console. Instead the
4100
+ // failure is recorded and cleared the moment the same expression
4101
+ // evaluates successfully, so only expressions that are STILL broken
4102
+ // when hydration finishes get reported \u2014 by the audit (#1773).
4103
+ else noteExprFailure(expr, e2);
4096
4104
  return '';
4097
4105
  }
4098
4106
  }
@@ -4111,18 +4119,11 @@ catch (e2) {
4111
4119
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
4112
4120
 
4113
4121
  // Handle attributes
4114
- if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
4115
- console.log('[stx] attr loop entry:', el.tagName, 'attrs:', getElementAttributes(el).map(a => a.name).join(', '));
4116
- }
4117
4122
  getElementAttributes(el).forEach(attr => {
4118
4123
  const name = attr.name;
4119
4124
  const value = attr.value;
4120
4125
  if (!name) return;
4121
4126
 
4122
- if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
4123
- console.log('[stx] attr iter:', el.tagName, 'name:', name);
4124
- }
4125
-
4126
4127
  // Dynamic attribute binding: @bind:attr, x-bind:attr, :attr, OR x-attr
4127
4128
  // x-attr (e.g. x-class, x-style, x-href, x-src) is the canonical binding prefix.
4128
4129
  // :attr still works for backward compat but is reserved for structural directives.
@@ -4217,7 +4218,6 @@ else {
4217
4218
  el.removeAttribute(name);
4218
4219
  }
4219
4220
  else if (name === '@class' || name === ':class' || name === 'x-class') {
4220
- console.log('[stx] HIT x-class handler:', el.tagName);
4221
4221
  bindClass(el, value, scope);
4222
4222
  el.removeAttribute(name);
4223
4223
  }
@@ -4275,9 +4275,7 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
4275
4275
  ? { ...globalHelpers, ...el.__stx_parent_scope }
4276
4276
  : { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
4277
4277
 
4278
- console.log('[stx] binding event:', eventName, 'on', el.tagName, 'expr:', value.substring(0, 40));
4279
4278
  el.addEventListener(eventName, (event) => {
4280
- console.log('[stx] event fired:', eventName, 'on', el.tagName);
4281
4279
  // Vue-style component listeners fall through to the rendered native
4282
4280
  // root unless the child emits the same event. Signal components use
4283
4281
  // a scope wrapper, so native events arrive here from a descendant.
@@ -4398,7 +4396,7 @@ catch (e) {
4398
4396
  // Skip script elements entirely
4399
4397
  if (child.tagName === 'SCRIPT') return;
4400
4398
  // Skip elements already processed by stx.mount() \u2014 they have their own scope and effects
4401
- if (child.__stx_scope) { console.log('[processElement] skip __stx_scope:', child.tagName); return; }
4399
+ if (child.__stx_scope) return;
4402
4400
  // Skip data-stx-scope elements \u2014 they are managed by the reactive (x-data) runtime
4403
4401
  if (child.hasAttribute && child.hasAttribute('data-stx-scope')) return;
4404
4402
  processElement(child, scope);
@@ -6349,16 +6347,34 @@ else if (timer === null) {
6349
6347
  // flash the boot script exists to prevent.
6350
6348
  var boot = null;
6351
6349
  try { boot = window.__STX_COLOR_MODE__ || null; } catch (e) {}
6352
- var storageKey = options.storageKey || (boot && boot.storageKey) || 'stx-color-mode';
6353
- var initialMode = options.initialMode || (boot && boot.initialMode) || 'auto';
6354
- var darkClass = options.darkClass || (boot && boot.darkClass) || 'dark';
6355
- var attribute = options.attribute || (boot && boot.attribute) || null;
6350
+ // Explicit-undefined checks rather than ||, so an explicit darkClass:null
6351
+ // or attribute:null opts out instead of falling through to the default.
6352
+ function pick(a, b, fallback) {
6353
+ if (a !== undefined) return a;
6354
+ if (b !== undefined && b !== null) return b;
6355
+ return fallback;
6356
+ }
6357
+ var storageKey = pick(options.storageKey, boot && boot.storageKey, 'stx-color-mode');
6358
+ var initialMode = pick(options.initialMode, boot && boot.initialMode, 'auto');
6359
+ var darkClass = pick(options.darkClass, boot && boot.darkClass, 'dark');
6360
+ var attribute = pick(options.attribute, boot && boot.attribute, null);
6361
+ var autoValueOption = pick(options.autoValue, boot && boot.autoValue, undefined);
6356
6362
  var disableTransitions = options.disableTransitions !== false;
6357
- var preference = initialMode;
6358
6363
  var resolved = 'light';
6359
6364
  var listeners = [];
6360
6365
  var cleanups = [];
6361
6366
 
6367
+ // Storage tokens meaning "follow the system". 'system' is a common spelling
6368
+ // for the same concept; rejecting it used to send the app down a silent
6369
+ // data-loss path \u2014 read 'system', fail to recognise it, fall back to
6370
+ // 'auto', then OVERWRITE the stored value with 'auto' (#1788).
6371
+ function normalizeMode(v) {
6372
+ if (v === 'light' || v === 'dark') return v;
6373
+ if (v === 'auto' || v === 'system') return 'auto';
6374
+ return null;
6375
+ }
6376
+ var preference = normalizeMode(initialMode) || 'auto';
6377
+
6362
6378
  function getSystem() {
6363
6379
  return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
6364
6380
  }
@@ -6366,27 +6382,42 @@ else if (timer === null) {
6366
6382
  function applyDOM(mode) {
6367
6383
  var el = document.documentElement;
6368
6384
  if (disableTransitions) el.style.setProperty('transition', 'none', 'important');
6369
- if (attribute) { el.setAttribute(attribute, mode); }
6370
- else { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
6385
+ // Both, when both are configured. The class drives the utility
6386
+ // framework's dark: variants, the attribute drives everything else \u2014
6387
+ // complements, not alternatives.
6388
+ if (attribute) el.setAttribute(attribute, mode);
6389
+ // Explicit add/remove, not toggle(cls, force) \u2014 very-happy-dom ignores
6390
+ // the force argument and plain-toggles, inverting every light-mode test.
6391
+ if (darkClass) { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
6371
6392
  if (disableTransitions) { el.offsetHeight; el.style.removeProperty('transition'); }
6372
6393
  }
6373
- function persist(pref) { try { localStorage.setItem(storageKey, pref); }
6374
- catch (e) {} }
6375
- function readPersisted() {
6376
- try { var v = localStorage.getItem(storageKey); if (v === 'light' || v === 'dark' || v === 'auto') return v; }
6377
- catch (e) {}
6378
- return null;
6394
+ function readRaw() {
6395
+ try { return localStorage.getItem(storageKey); }
6396
+ catch (e) { return null; }
6379
6397
  }
6380
- function update(pref) {
6381
- preference = pref;
6382
- resolved = resolve(pref);
6398
+ // The spelling written back for 'auto': an explicit option wins, else
6399
+ // whatever the app already stored, so its own pre-paint script keeps
6400
+ // reading a value it recognises.
6401
+ var storedRaw = readRaw();
6402
+ var autoValue = autoValueOption !== undefined
6403
+ ? autoValueOption
6404
+ : ((storedRaw === 'auto' || storedRaw === 'system') ? storedRaw : 'auto');
6405
+
6406
+ function persist(pref) {
6407
+ try { localStorage.setItem(storageKey, pref === 'auto' ? autoValue : pref); }
6408
+ catch (e) {} }
6409
+ // persistChoice: only an explicit user choice is written back. Persisting
6410
+ // on init would stamp the resolved default over a stored value this
6411
+ // composable didn't recognise, destroying it.
6412
+ function update(pref, persistChoice) {
6413
+ preference = normalizeMode(pref) || 'auto';
6414
+ resolved = resolve(preference);
6383
6415
  applyDOM(resolved);
6384
- persist(pref);
6416
+ if (persistChoice !== false) persist(preference);
6385
6417
  listeners.forEach(function(fn) { fn(resolved, preference); });
6386
6418
  }
6387
6419
 
6388
- var persisted = readPersisted();
6389
- update(persisted || initialMode);
6420
+ update(normalizeMode(storedRaw) || initialMode, false);
6390
6421
 
6391
6422
  var mql = window.matchMedia('(prefers-color-scheme: dark)');
6392
6423
  var onSystemChange = function() {
@@ -6401,8 +6432,11 @@ catch (e) {}
6401
6432
 
6402
6433
  var onStorage = function(e) {
6403
6434
  if (e.key !== storageKey) return;
6404
- var v = e.newValue;
6405
- if (v === 'light' || v === 'dark' || v === 'auto') {
6435
+ var v = normalizeMode(e.newValue);
6436
+ if (v) {
6437
+ // Track the other tab's spelling too, so a write from here doesn't
6438
+ // convert the key out from under it.
6439
+ if (v === 'auto' && (e.newValue === 'auto' || e.newValue === 'system')) autoValue = e.newValue;
6406
6440
  preference = v; resolved = resolve(v); applyDOM(resolved);
6407
6441
  listeners.forEach(function(fn) { fn(resolved, preference); });
6408
6442
  }
@@ -6826,9 +6860,22 @@ catch (e) {}
6826
6860
  if (config.bodyAttrs && config.bodyAttrs.class) {
6827
6861
  config.bodyAttrs.class.split(' ').forEach(function(cls) { if (cls) document.body.classList.add(cls); });
6828
6862
  }
6829
- // Html lang
6830
- if (config.htmlAttrs && config.htmlAttrs.lang) {
6831
- document.documentElement.setAttribute('lang', config.htmlAttrs.lang);
6863
+ // Html attributes. Every key, not just lang \u2014 the module impl
6864
+ // (head.ts updateHead) has always applied all of them, and a root-level
6865
+ // class is the main reason to reach for htmlAttrs at all (#1798).
6866
+ // class merges rather than replaces, matching bodyAttrs.class above:
6867
+ // the color-mode boot script owns a class on this same element.
6868
+ if (config.htmlAttrs) {
6869
+ for (var hk in config.htmlAttrs) {
6870
+ if (!config.htmlAttrs.hasOwnProperty(hk)) continue;
6871
+ var hv = config.htmlAttrs[hk];
6872
+ if (hv == null) continue;
6873
+ if (hk === 'class') {
6874
+ String(hv).split(' ').forEach(function(cls) { if (cls) document.documentElement.classList.add(cls); });
6875
+ } else {
6876
+ document.documentElement.setAttribute(hk, hv);
6877
+ }
6878
+ }
6832
6879
  }
6833
6880
  }
6834
6881
  // Apply immediately if DOM is ready, otherwise on mount
@@ -7834,6 +7881,12 @@ else {
7834
7881
  window.nextTick = nextTick;
7835
7882
  window.useAsync = useAsync;
7836
7883
  window.useLocalStorage = useLocalStorage;
7884
+ // Paired with the line above. Both are in STX_RUNTIME_GLOBALS, so a
7885
+ // <script client> block gets either via the setup destructure \u2014 but code
7886
+ // that reads the bare window global directly (a plain <script>, or a
7887
+ // bundled module that wasn't rewritten) found useLocalStorage defined and
7888
+ // useSessionStorage undefined.
7889
+ window.useSessionStorage = useSessionStorage;
7837
7890
  window.useEventListener = useEventListener;
7838
7891
  window.useWebSocket = useWebSocket;
7839
7892
  window.useColorMode = useColorMode;
@@ -8224,6 +8277,9 @@ catch (e) {
8224
8277
  }
8225
8278
  }
8226
8279
  });
8280
+
8281
+ // Everything that should have hydrated has now had its chance (#1773).
8282
+ auditHydration(document.body, 'DOMContentLoaded');
8227
8283
  };
8228
8284
  window.__stxDomReadyHandler = stxDomReadyHandler;
8229
8285
  console.log('[stx] registering DOMContentLoaded handler');
@@ -8315,6 +8371,184 @@ catch (e) {
8315
8371
  }
8316
8372
  }
8317
8373
 
8374
+ // ==========================================================================
8375
+ // Post-hydration invariant sweep (stacksjs/stx#1773)
8376
+ // ==========================================================================
8377
+ //
8378
+ // Preserved moustaches are the framework's de-facto error UI: ANY failure in
8379
+ // the detect \u2192 extract \u2192 bundle \u2192 ship \u2192 rebind relay collapses into the same
8380
+ // visible symptom, literal {{ }} on screen. Eight separate fixes each patched
8381
+ // one site's heuristic, and no invariant anywhere asserted the actual
8382
+ // requirement \u2014 zero unhydrated scopes after hydration. So every new upstream
8383
+ // miss reached users silently and had to be diagnosed from a screenshot.
8384
+ //
8385
+ // This is that invariant. It runs at the end of both hydration entry points
8386
+ // and turns a silent miss into one loud, self-healing event:
8387
+ //
8388
+ // - an element carrying data-stx-scope whose id isn't in the registry, or
8389
+ // that hydration reached but never processed, is reported AND processed
8390
+ // with the ambient scope, which is what the walk would have done had the
8391
+ // script arrived. That recovers the D2/D3 shapes (a silent early return
8392
+ // in the walk, a stale __stx_scope guard) rather than merely naming them.
8393
+ // - leftover {{ }} text is reported. Diagnostic only, never auto-fixed:
8394
+ // without a scope there is nothing to interpolate against, and a page may
8395
+ // legitimately print moustaches.
8396
+ //
8397
+ // Deliberately quiet in the normal case: nothing is logged when the page has
8398
+ // no signals at all, and containers that legitimately show template syntax
8399
+ // (<pre>, <code>, <template>, <script>, <style>, <textarea>, and anything
8400
+ // under [data-stx-ignore]) are skipped.
8401
+
8402
+ var AUDIT_SKIP_TAGS = { PRE: 1, CODE: 1, SCRIPT: 1, STYLE: 1, TEXTAREA: 1, TEMPLATE: 1 };
8403
+
8404
+ // Expressions whose evaluation threw a ReferenceError/TypeError and have not
8405
+ // since succeeded. evalAttrExpr swallows those two on purpose \u2014 a signal may
8406
+ // not exist yet on an effect's first pass \u2014 which is why a genuinely broken
8407
+ // binding produces no diagnostic at all today. The classic case is
8408
+ // :if="flag()" where flag is a signal: the auto-unwrap proxy returns the
8409
+ // VALUE, calling it throws TypeError, the directive suppresses it, and the
8410
+ // element silently stays hidden with no warning anywhere (see CLAUDE.md,
8411
+ // "Signals: scripts call, templates don't").
8412
+ //
8413
+ // Recording rather than warning immediately is what keeps this quiet on
8414
+ // working pages: a first-pass failure that later succeeds clears itself, so
8415
+ // only expressions still broken when hydration finishes are reported.
8416
+ var _exprFailures = {};
8417
+ var _exprFailureCount = 0;
8418
+
8419
+ function noteExprFailure(expr, err) {
8420
+ if (_exprFailures[expr] !== undefined) return;
8421
+ // Bounded: one runaway loop must not grow this without limit.
8422
+ if (_exprFailureCount >= 50) return;
8423
+ _exprFailureCount++;
8424
+ _exprFailures[expr] = (err && err.message) ? err.message : String(err);
8425
+ }
8426
+
8427
+ function noteExprSuccess(expr) {
8428
+ if (_exprFailures[expr] === undefined) return;
8429
+ delete _exprFailures[expr];
8430
+ _exprFailureCount--;
8431
+ }
8432
+
8433
+ function auditSkipped(node) {
8434
+ // Not rendered, not audited. Covers <template> content (a detached
8435
+ // DocumentFragment \u2014 which some DOM implementations still walk into) and
8436
+ // :if branches parked off-document, neither of which the user can see.
8437
+ if (node.isConnected === false) return true;
8438
+ for (var p = node.parentNode; p; p = p.parentNode) {
8439
+ if (p.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return true;
8440
+ if (p.nodeType !== Node.ELEMENT_NODE) continue;
8441
+ if (AUDIT_SKIP_TAGS[p.tagName]) return true;
8442
+ if (p.hasAttribute && p.hasAttribute('data-stx-ignore')) return true;
8443
+ }
8444
+ return false;
8445
+ }
8446
+
8447
+ function findLiteralMoustaches(root) {
8448
+ var found = [];
8449
+ if (!root || typeof document.createTreeWalker !== 'function') return found;
8450
+ // Read NodeFilter off window, not the bare global: in a real browser they
8451
+ // are the same object, but some DOM implementations used for testing expose
8452
+ // it only on window, and a bare reference then throws inside the audit.
8453
+ var showText = (window.NodeFilter && window.NodeFilter.SHOW_TEXT) || 4;
8454
+ var walker = document.createTreeWalker(root, showText, null);
8455
+ var node;
8456
+ while ((node = walker.nextNode())) {
8457
+ var text = node.nodeValue || '';
8458
+ if (text.indexOf('{{') === -1 || text.indexOf('}}') === -1) continue;
8459
+ if (auditSkipped(node)) continue;
8460
+ found.push(text.trim().slice(0, 80));
8461
+ if (found.length >= 5) break;
8462
+ }
8463
+ return found;
8464
+ }
8465
+
8466
+ // A diagnostic that can break hydration is worse than no diagnostic, so the
8467
+ // whole sweep is wrapped and every DOM capability it uses is feature-checked.
8468
+ // Minimal document stubs (tests, non-browser embeddings) simply skip it.
8469
+ function auditHydration(container, phase) {
8470
+ try { auditHydrationUnsafe(container, phase); }
8471
+ catch (e) { console.warn('[stx] hydration audit skipped:', e && e.message ? e.message : e); }
8472
+ }
8473
+
8474
+ function auditHydrationUnsafe(container, phase) {
8475
+ if (!window.stx || !window.stx._scopes) return;
8476
+ var root = container && typeof container.querySelectorAll === 'function' ? container : document.body;
8477
+ if (!root || typeof root.querySelectorAll !== 'function') return;
8478
+
8479
+ // Unregistered / unprocessed scopes \u2014 the unambiguous failure, and the one
8480
+ // worth repairing.
8481
+ var stranded = [];
8482
+ root.querySelectorAll('[data-stx-scope]').forEach(function(el) {
8483
+ if (el.__stx_audit_recovered) return;
8484
+ // Deferred islands are unhydrated ON PURPOSE until their trigger fires.
8485
+ if (el.hasAttribute('stx-hydrate') || el.__stx_hydration_scheduled) return;
8486
+ var scopeId = el.getAttribute('data-stx-scope');
8487
+ var registered = window.stx._scopes[scopeId];
8488
+ if (registered && el.__stx_disposers) return;
8489
+ stranded.push({ el: el, id: scopeId, registered: !!registered });
8490
+ });
8491
+
8492
+ if (stranded.length) {
8493
+ console.error(
8494
+ '[stx] hydration invariant failed after ' + phase + ': '
8495
+ + stranded.length + ' scope(s) left unhydrated \u2014 '
8496
+ + stranded.map(function(s) {
8497
+ return s.id + (s.registered ? ' (registered, never processed)' : ' (not registered)');
8498
+ }).join(', ')
8499
+ + '. Recovering with the ambient scope; please report with the page that produced it (stacksjs/stx#1773).',
8500
+ );
8501
+ stranded.forEach(function(s) {
8502
+ // Once per element: a repair that itself fails must not loop on the
8503
+ // next navigation.
8504
+ s.el.__stx_audit_recovered = true;
8505
+ try {
8506
+ var vars = s.registered ? window.stx._scopes[s.id] : null;
8507
+ if (vars) Object.assign(componentScope, vars);
8508
+ s.el.__stx_disposers = trackEffects(function() { processElement(s.el, componentScope); });
8509
+ s.el.removeAttribute('x-cloak');
8510
+ s.el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
8511
+ }
8512
+ catch (e) {
8513
+ console.error('[stx] hydration recovery failed for scope ' + s.id + ':', e);
8514
+ }
8515
+ });
8516
+ }
8517
+
8518
+ var literals = findLiteralMoustaches(root);
8519
+ if (literals.length) {
8520
+ console.error(
8521
+ '[stx] hydration invariant failed after ' + phase + ': literal {{ }} left in the DOM \u2014 '
8522
+ + literals.join(' | ')
8523
+ + '. An expression did not bind; see stacksjs/stx#1773. Wrap intentional '
8524
+ + 'template syntax in <pre>/<code> or [data-stx-ignore] to exclude it.',
8525
+ );
8526
+ }
8527
+
8528
+ // Expressions that threw and never recovered. Reported here rather than at
8529
+ // throw time so a first-pass miss that later resolves stays silent.
8530
+ var brokenExprs = [];
8531
+ for (var expr in _exprFailures) {
8532
+ if (Object.prototype.hasOwnProperty.call(_exprFailures, expr))
8533
+ brokenExprs.push(expr + ' \u2192 ' + _exprFailures[expr]);
8534
+ }
8535
+ if (brokenExprs.length) {
8536
+ var hint = brokenExprs.some(function(m) { return m.indexOf('is not a function') !== -1; })
8537
+ ? ' If one of these calls a signal, drop the parentheses: templates read '
8538
+ + 'a signal by bare name (:if="flag"), scripts call it (flag()). Calling '
8539
+ + 'the unwrapped value is a TypeError, which directives suppress \u2014 the '
8540
+ + 'element just stays hidden.'
8541
+ : '';
8542
+ console.error(
8543
+ '[stx] hydration invariant failed after ' + phase + ': '
8544
+ + brokenExprs.length + ' expression(s) never evaluated \u2014 '
8545
+ + brokenExprs.slice(0, 5).join(' | ') + '.' + hint,
8546
+ );
8547
+ _exprFailures = {};
8548
+ _exprFailureCount = 0;
8549
+ }
8550
+ }
8551
+
8318
8552
  // ==========================================================================
8319
8553
  // Container Cleanup (for SPA navigation)
8320
8554
  // ==========================================================================
@@ -8556,6 +8790,9 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
8556
8790
  catch (e) { console.warn('[stx] mount callback error:', e); }
8557
8791
  });
8558
8792
  mountCallbacks.length = 0;
8793
+
8794
+ // Everything that should have hydrated has now had its chance (#1773).
8795
+ auditHydration(container, 'stx:load');
8559
8796
  }
8560
8797
 
8561
8798
  // Helper to process elements while skipping already-processed scoped containers
@@ -8597,25 +8834,25 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8597
8834
  }
8598
8835
  }
8599
8836
  })();
8600
- `}var Gq;var GZ=k(()=>{s7();s7();Gq={state:o$,derived:s$,effect:r$,batch:c7,onMount:i7,onDestroy:n7,isSignal:a$,isDerived:t$,untrack:o7,peek:e$,generateSignalsRuntime:JZ,generateSignalsRuntimeDev:$4}});var r7={};s(r7,{templateCache:()=>KZ,readFileCached:()=>Kq,invalidateFileCacheByDir:()=>Wq,invalidateFileCache:()=>qq,hashFilePath:()=>Y$,getCachedSignalsRuntime:()=>jq,getCachedRouterScript:()=>Bq,clearDevCaches:()=>_q,checkCache:()=>Hq,cacheTemplate:()=>Oq,__setSignalsGeneratorsForTest:()=>zq});import F1 from"fs";import z5 from"path";async function Kq($){let Y;for(let X=0;X<3;X++)try{let J=(await F1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await F1.promises.stat($)).mtime.getTime();if(W!==J)continue;return f1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function qq($){f1.delete($)}function Wq($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function zq($){qZ=$}async function jq($=!1){let Z=qZ??await Promise.resolve().then(() => (GZ(),QZ));if($)return Z.generateSignalsRuntimeDev();if(Z4===null)Z4=Z.generateSignalsRuntime();return Z4}async function Bq(){if(Y4===null){let{getRouterScript:$}=await import("stx-router");Y4=$()}return Y4}function _q(){f1.clear(),UZ(),Z4=null,Uq=null,Y4=null}function WZ($){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 Hq($,Z){try{if(!Z.cachePath)return null;let Y=z5.resolve(Z.cachePath),X=z5.join(Y,`${Y$($)}.html`),Q=z5.join(Y,`${Y$($)}.meta.json`);if(!await p(X)||!await p(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==WZ(Z))return null;if((await F1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await p(q)){if((await F1.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 Oq($,Z,Y,X){try{if(!X.cachePath)return;let Q=z5.resolve(X.cachePath);await F1.promises.mkdir(Q,{recursive:!0});let J=z5.join(Q,`${Y$($)}.html`),G=z5.join(Q,`${Y$($)}.meta.json`),K=await F1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:WZ(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),KZ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function Y$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Lq)}var KZ,f1,Z4=null,Uq=null,qZ=null,Y4=null,Lq=16;var a7=k(()=>{F0();KZ=new Map,f1=new Map});async function zZ($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8837
+ `}var _q;var UZ=k(()=>{t7();t7();_q={state:s$,derived:r$,effect:a$,batch:o7,onMount:s7,onDestroy:r7,isSignal:t$,isDerived:e$,untrack:a7,peek:$4,generateSignalsRuntime:qZ,generateSignalsRuntimeDev:Z4}});var e7={};s(e7,{templateCache:()=>zZ,readFileCached:()=>Hq,invalidateFileCacheByDir:()=>Fq,invalidateFileCache:()=>Oq,hashFilePath:()=>X$,getCachedSignalsRuntime:()=>wq,getCachedRouterScript:()=>Rq,clearDevCaches:()=>Aq,checkCache:()=>Nq,cacheTemplate:()=>Mq,__setSignalsGeneratorsForTest:()=>Vq});import L1 from"fs";import z5 from"path";async function Hq($){let Y;for(let X=0;X<3;X++)try{let J=(await L1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await L1.promises.stat($)).mtime.getTime();if(W!==J)continue;return f1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Oq($){f1.delete($)}function Fq($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function Vq($){jZ=$}async function wq($=!1){let Z=jZ??await Promise.resolve().then(() => (UZ(),WZ));if($)return Z.generateSignalsRuntimeDev();if(Y4===null)Y4=Z.generateSignalsRuntime();return Y4}async function Rq(){if(X4===null){let{getRouterScript:$}=await import("stx-router");X4=$()}return X4}function Aq(){f1.clear(),_Z(),Y4=null,Lq=null,X4=null}function BZ($){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 Nq($,Z){try{if(!Z.cachePath)return null;let Y=z5.resolve(Z.cachePath),X=z5.join(Y,`${X$($)}.html`),Q=z5.join(Y,`${X$($)}.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!==BZ(Z))return null;if((await L1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await L1.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 Mq($,Z,Y,X){try{if(!X.cachePath)return;let Q=z5.resolve(X.cachePath);await L1.promises.mkdir(Q,{recursive:!0});let J=z5.join(Q,`${X$($)}.html`),G=z5.join(Q,`${X$($)}.meta.json`),K=await L1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:BZ(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),zZ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function X$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Tq)}var zZ,f1,Y4=null,Lq=null,jZ=null,X4=null,Tq=16;var $3=k(()=>{L0();zZ=new Map,f1=new Map});async function HZ($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8601
8838
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
8602
8839
  `+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
8603
8840
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8604
8841
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8605
8842
  `+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8606
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (a7(),r7)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8843
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => ($3(),e7)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8607
8844
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
8608
8845
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8609
8846
  `+Q+$.slice(K+1)}return Q+`
8610
- `+$}async function jZ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8611
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (a7(),r7)),J=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8612
- </body>`+$.slice(G+7)}var G4={};s(G4,{scanScriptTags:()=>VZ,rewriteStxImportSpecifiers:()=>NZ,processSignals:()=>Y3,processScriptSetup:()=>AZ,preEvalLiteralReactiveIfs:()=>$3,parseLoopExpression:()=>wZ,hasSignalsSyntax:()=>Q4,findMarkupIndexOutsideScripts:()=>J4,extractExports:()=>RZ,convertSignalLoopsToAttributes:()=>Z3,convertSignalDirectivesToAttributes:()=>e7});function VZ($,Z={}){let Y=[];for(let X of S7($,j1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function wZ($){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}=_Z(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}=_Z(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function _Z($){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 Q4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function Vq($){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 wq($){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 Aq($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function OZ($,Z,Y){if(!$)return!1;let X=Aq($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(HZ.has(j))continue;if(Z.has(j))Q=!0;else if(Y&&j 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 j=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(HZ.has(j)||Y&&j in Y)continue;G=!0}return(Q||G)&&!J}function X4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(FZ);if(J&&Rq(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Rq($,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 e7($,Z){let Y=wq($);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,j=U;while(j<J.length&&z>0){if(J[j]==="(")z++;else if(J[j]===")")z--;j++}if(z!==0)continue;let _=J.substring(U,j-1).trim(),B=j,H=1,L=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;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(B,L-6).trim(),w;if(Vq(V)){let A=$$(J.substring(W,L));if(A.length===0)continue;let N=A[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>OZ(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return X4(I,"@else-if",M.condition??"");if(M.type==="else")return X4(I,"@else");return X4(I,"@if",M.condition??"")}).join(`
8613
- `)}else{if(!OZ(_,Y,Z))continue;w=X4(X(V),"@if",_)}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:j}=q[W];J=J.substring(0,U)+j+J.substring(z)}return J}return X($)}function Nq($){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 Tq($,Z,Y,X){if(t7.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 _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let B=J.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,j+1);if(!(/\/\s*>$/.test(_)||t7.has(Q)))K++}q=j+1}return-1}function Iq($,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 Mq.test(J)}function $3($){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(([j,_])=>z>=j&&z<_),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,j,_,B,H,L,F]=K,O=Nq(H);if(O===void 0)continue;let V=K.index,w=V+z.length,R=!!F||/\/\s*>$/.test(z)||t7.has(j.toLowerCase())?w:Tq($,V,j,w);if(R===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Iq($,R)){J.lastIndex=w;continue}if(O===!0){let M=`<${j}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),J.lastIndex=R}if(G.length===0)return $;G.sort((z,j)=>z.start-j.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:j,end:_,replacement:B}=q[z];U=U.substring(0,j)+B+U.substring(_)}return U}function Z3($,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(),j=U,_=wZ(z);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=j;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(j,L-B.length).trim(),w=V.match(FZ),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${z}">${T}</${N}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Dq($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8847
+ `+$}async function OZ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8848
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => ($3(),e7)),J=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8849
+ </body>`+$.slice(G+7)}var K4={};s(K4,{scanScriptTags:()=>NZ,rewriteStxImportSpecifiers:()=>DZ,processSignals:()=>Q3,processScriptSetup:()=>TZ,preEvalLiteralReactiveIfs:()=>X3,parseLoopExpression:()=>MZ,hasSignalsSyntax:()=>G4,findMarkupIndexOutsideScripts:()=>Q4,extractExports:()=>IZ,convertSignalLoopsToAttributes:()=>J3,convertSignalDirectivesToAttributes:()=>Y3});function NZ($,Z={}){let Y=[];for(let X of C7($,j1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function MZ($){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}=LZ(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}=LZ(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function LZ($){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 G4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function Dq($){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 Eq($){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 kq($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function wZ($,Z,Y){if(!$)return!1;let X=kq($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(VZ.has(j))continue;if(Z.has(j))Q=!0;else if(Y&&j 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 j=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(VZ.has(j)||Y&&j in Y)continue;G=!0}return(Q||G)&&!J}function J4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(AZ);if(J&&bq(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function bq($,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 Y3($,Z){let Y=Eq($);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,j=U;while(j<J.length&&z>0){if(J[j]==="(")z++;else if(J[j]===")")z--;j++}if(z!==0)continue;let _=J.substring(U,j-1).trim(),B=j,H=1,F=B,L=/@(if\s*\(|endif)/g;L.lastIndex=B;let O;while((O=L.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){F=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(B,F-6).trim(),w;if(Dq(V)){let R=Z$(J.substring(W,F));if(R.length===0)continue;let A=R[0].branches.filter((M)=>M.type!=="else");if(!(A.length>0&&A.every((M)=>wZ(M.condition,Y,Z))))continue;w=R[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return J4(I,"@else-if",M.condition??"");if(M.type==="else")return J4(I,"@else");return J4(I,"@if",M.condition??"")}).join(`
8850
+ `)}else{if(!wZ(_,Y,Z))continue;w=J4(X(V),"@if",_)}q.push({start:W,end:F,replacement:w}),G.lastIndex=F}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];J=J.substring(0,U)+j+J.substring(z)}return J}return X($)}function Sq($){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 yq($,Z,Y,X){if(Z3.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 _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let B=J.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,j+1);if(!(/\/\s*>$/.test(_)||Z3.has(Q)))K++}q=j+1}return-1}function Cq($,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 Pq.test(J)}function X3($){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(([j,_])=>z>=j&&z<_),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,j,_,B,H,F,L]=K,O=Sq(H);if(O===void 0)continue;let V=K.index,w=V+z.length,N=!!L||/\/\s*>$/.test(z)||Z3.has(j.toLowerCase())?w:yq($,V,j,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Cq($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${j}${_}${F}${L}>`;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,j)=>z.start-j.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:j,end:_,replacement:B}=q[z];U=U.substring(0,j)+B+U.substring(_)}return U}function J3($,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(),j=U,_=MZ(z);if(_.iterable){let A=_.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(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,F=j,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=j;let O;while((O=L.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){F=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(j,F-B.length).trim(),w=V.match(AZ),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:F,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 vq($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8614
8851
  `)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,j=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let B=z+2;while(B<J&&$[B]!==`
8615
- `)B++;z=B;continue}if(_==="/"&&$[z+1]==="*"){let B=z+2;while(B<J-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=z+1;while(B<J){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}z=B;continue}if(_==="("||_==="["||_==="{"){j++,z++;continue}if(_===")"||_==="]"||_==="}"){j--,z++;continue}if(_===";"&&j===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 _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=W(X+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=H;continue}Z.add(B),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function AZ($,Z,Y){let X=VZ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(b1(L.attrs))F=S1(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()}_${Fq++}`,{hasUserImports:K,bundleClientScript:q}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),d5))),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=Y5(F).code,K(F))F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>NZ(w));let O=o0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8852
+ `)B++;z=B;continue}if(_==="/"&&$[z+1]==="*"){let B=z+2;while(B<J-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=z+1;while(B<J){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}z=B;continue}if(_==="("||_==="["||_==="{"){j++,z++;continue}if(_===")"||_==="]"||_==="}"){j--,z++;continue}if(_===";"&&j===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 _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=W(X+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=H;continue}Z.add(B),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function TZ($,Z,Y){let X=NZ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let F of X){let L=F.body;if(b1(F.attrs))L=S1(L);if(Q.test(L))J.push({fullMatch:F.fullMatch,attrs:F.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Iq++}`,{hasUserImports:K,bundleClientScript:q}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),m5))),W=[];for(let F=0;F<J.length;F++){let L=J[F].content;if(L=Y5(L).code,K(L))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,(V,w)=>DZ(w));let O=o0(L);W.push(`// \u2500\u2500 merged signal script #${F+1} \u2500\u2500
8616
8853
  ${O}`)}let U=W.join(`
8617
8854
 
8618
- `);U=Dq(U);let z=RZ(U),j=z.split(",").map((L)=>L.trim()).filter(Boolean),_=y$(U,Y),B=`
8855
+ `);U=vq(U);let z=IZ(U),j=z.split(",").map((F)=>F.trim()).filter(Boolean),_=P$(U,Y),B=`
8619
8856
  <script data-stx-scoped>
8620
8857
  function ${G}() {
8621
8858
  ${Q5("const",j)}
@@ -8624,18 +8861,18 @@ ${_}${U}
8624
8861
  }
8625
8862
  window.__stx_latestSetup=${G};
8626
8863
  if(window.stx)window.stx._latestSetup=${G};
8627
- </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${BZ})>`),`<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(${BZ})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function RZ($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let B=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!B){B=!0,J++;continue}if(H==="]"&&B){B=!1,J++;continue}if(H==="/"&&!B){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8864
+ </script>`,H=$;for(let F of J)H=H.split(F.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${FZ})>`),`<body$1 data-stx="${G}">`);else{let F=["script","style","html","head","meta","link","title","!doctype"],L=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${FZ})>`,"gi"),(O,V,w)=>{if(L||F.includes(V.toLowerCase()))return O;return L=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function IZ($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let B=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!B){B=!0,J++;continue}if(H==="]"&&B){B=!1,J++;continue}if(H==="/"&&!B){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8628
8865
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(B)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===B){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 B=1;while(J<G&&B>0)if(Z[J]==="{")B++,J++;else if(Z[J]==="}")B--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},j=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8629
- `)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},_=()=>{if(Q!==0)return;let B=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(j())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])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function Y3($,Z,Y,X){if(!Q4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await AZ(Q,Y,X);if(Q=J,Q=await zZ(Q,Z),G){let U=J4(Q,/<\/head>/i),z=U===-1?J4(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8866
+ `)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},_=()=>{if(Q!==0)return;let B=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[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 F=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[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 L=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[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(j())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])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function Q3($,Z,Y,X){if(!G4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await TZ(Q,Y,X);if(Q=J,Q=await HZ(Q,Z),G){let U=Q4(Q,/<\/head>/i),z=U===-1?Q4(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8630
8867
  ${Q.slice(U)}`;else if(z!==-1){let j=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+j.length;Q=`${Q.slice(0,_)}
8631
8868
  ${G}${Q.slice(_)}`}else Q=`${Q}
8632
- ${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=J4(Q,U);if(z!==-1){let j=Q.slice(0,z),_=Q.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=j+_}}return Q}function J4($,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 NZ($){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 LZ;return`var ${Z.join(", ")}; ${LZ}`}var Fq=0,BZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,FZ,HZ,t7,Mq,LZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var X$=k(()=>{c5();c$();r5();F0();y1();h5();FZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;HZ=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"]);t7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Mq=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Eq from"fs";import g from"path";function bq($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function TZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function b1($){return!Sq($)}function S1($){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:l0()}).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 yq($){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]!==`
8633
- `)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 B=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)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 B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(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 Pq($){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 Cq($){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 vq($,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 Pq(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=Cq(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 j=W.slice(U+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[z]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function W4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(g.join(g.dirname(B),"components"));_(Z),_(Q._rootComponentsDir),_(g.join(g.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(g.resolve(U,"resources/views/components")),_(g.resolve(U,"resources/components")),_(g.resolve(U,"src/components")),_(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return p(g.resolve(g.dirname(X),`${J}.stx`));for(let L of j){let F=g.isAbsolute(L)?L:g.resolve(z,L);for(let O of W)if(await p(g.join(F,O)))return!0}return!1}function xq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function fq($){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 gq($){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 g1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await a("stx/variable-extractor",()=>Promise.resolve().then(() => (e5(),l$))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&xq(j)?j:"";try{let B=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let C=[L,L.toLowerCase(),B(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=Q.__originalFilePath,d=[];if(u){let K0=g.join(g.dirname(u),"components");d.push(K0)}if(X)d.push(X);let U0=G._rootComponentsDir;if(typeof U0==="string"&&!d.includes(U0))d.push(U0);let O0=g.join(g.dirname(J),"components");if(!d.includes(O0))d.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let Y1=G._pluginComponentDirs;if(Array.isArray(Y1)){for(let K0 of Y1)if(typeof K0==="string"&&!d.includes(K0))d.push(K0)}let u0=typeof G.root==="string"?g.resolve(G.root):void 0,y0=u0??g.dirname(J),n0=[];if(u0)n0.push(g.resolve(u0,"resources/views/components")),n0.push(g.resolve(u0,"resources/components")),n0.push(g.resolve(u0,"src/components")),n0.push(g.resolve(u0,"components"));n0.push(g.resolve(import.meta.dir,"components"));for(let K0 of n0)if(!d.includes(K0))d.push(K0);let M1=[...new Set(d.map((K0)=>{if(!K0)return K0;return g.isAbsolute(K0)?K0:g.resolve(y0,K0)}))];d.length=0,d.push(...M1);let U1=`${L}\x00${J}\x00${M1.join("\x00")}`,t1=q4.get(U1);if(t1)if(await p(t1))F=t1;else q4.delete(U1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=g.resolve(g.dirname(J),`${L}.stx`),V.push(F);else if(!F)for(let K0 of d){if(!K0)continue;for(let c of x){let f0=g.join(K0,c);if(V.push(f0),await p(f0)){F=f0;break}}if(F)break;if(!F)try{let c=await import("fs");if(!c.statSync(K0,{throwIfNoEntry:!1})?.isDirectory())continue;let S5=8,e1=[{path:K0,depth:0}];while(e1.length>0&&!F){let X1=e1.pop();if(X1.depth>=S5)continue;let A$;try{A$=c.readdirSync(X1.path,{withFileTypes:!0})}catch{continue}for(let R$ of A$){if(!R$.isDirectory())continue;if(R$.name==="node_modules"||R$.name.startsWith("."))continue;let q9=g.join(X1.path,R$.name);for(let PQ of x){let F7=g.join(q9,PQ);if(V.push(F7),await p(F7)){F=F7;break}}if(F)break;e1.push({path:q9,depth:X1.depth+1})}}}catch{}if(F)break}if(F)q4.set(U1,F)}if(!F||!await p(F)){let C=V.length>0?`
8869
+ ${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=Q4(Q,U);if(z!==-1){let j=Q.slice(0,z),_=Q.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=j+_}}return Q}function Q4($,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 DZ($){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 RZ;return`var ${Z.join(", ")}; ${RZ}`}var Iq=0,FZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,AZ,VZ,Z3,Pq,RZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var J$=k(()=>{i5();i$();a5();L0();y1();d5();AZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;VZ=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"]);Z3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Pq=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import xq from"fs";import g from"path";function gq($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let Q={};for(let J of Object.keys(X).sort())Q[J]=Y(X[J]);return Q};return JSON.stringify(Y($))}catch{return null}}function EZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function b1($){return!hq($)}function S1($){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:l0()}).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 dq($){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]!==`
8870
+ `)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 B=U[2].split(",").map((H)=>{let F=H.trim().split(":");return F[F.length-1].trim()});for(let H of B)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 B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(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 mq($){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 uq($){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 lq($,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 mq(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=uq(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 j=W.slice(U+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[z]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function U4($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),K=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let F of[J,J.toLowerCase(),G(J),K(J)])if(q.has(F))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?g.resolve(Q.root):void 0,z=U??g.dirname(X),j=[],_=(F)=>{if(F&&!j.includes(F))j.push(F)},B=Y.__originalFilePath;if(B)_(g.join(g.dirname(B),"components"));_(Z),_(Q._rootComponentsDir),_(g.join(g.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let F of H)_(typeof F==="string"?F:null);if(U)_(g.resolve(U,"resources/views/components")),_(g.resolve(U,"resources/components")),_(g.resolve(U,"src/components")),_(g.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(g.resolve(g.dirname(X),`${J}.stx`));for(let F of j){let L=g.isAbsolute(F)?F:g.resolve(z,F);for(let O of W)if(await c(g.join(L,O)))return!0}return!1}function pq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function cq($){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 iq($){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 g1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await a("stx/variable-extractor",()=>Promise.resolve().then(() => ($$(),p$))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&pq(j)?j:"";try{let B=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Q.__importedComponents;if(O){let C=[F,F.toLowerCase(),B(F),H(F)];for(let x of C)if(O.has(x)){L=O.get(x);break}}let V=[];if(!L){let C=[`${F}.stx`,`${B(F)}.stx`,`${H(F)}.stx`],x=[...new Set(C)],u=Q.__originalFilePath,d=[];if(u){let K0=g.join(g.dirname(u),"components");d.push(K0)}if(X)d.push(X);let U0=G._rootComponentsDir;if(typeof U0==="string"&&!d.includes(U0))d.push(U0);let O0=g.join(g.dirname(J),"components");if(!d.includes(O0))d.push(O0);if(G.componentsDir&&G.componentsDir!==X&&!d.includes(G.componentsDir))d.push(G.componentsDir);let Y1=G._pluginComponentDirs;if(Array.isArray(Y1)){for(let K0 of Y1)if(typeof K0==="string"&&!d.includes(K0))d.push(K0)}let u0=typeof G.root==="string"?g.resolve(G.root):void 0,y0=u0??g.dirname(J),n0=[];if(u0)n0.push(g.resolve(u0,"resources/views/components")),n0.push(g.resolve(u0,"resources/components")),n0.push(g.resolve(u0,"src/components")),n0.push(g.resolve(u0,"components"));n0.push(g.resolve(import.meta.dir,"components"));for(let K0 of n0)if(!d.includes(K0))d.push(K0);let T1=[...new Set(d.map((K0)=>{if(!K0)return K0;return g.isAbsolute(K0)?K0:g.resolve(y0,K0)}))];d.length=0,d.push(...T1);let U1=`${F}\x00${J}\x00${T1.join("\x00")}`,t1=W4.get(U1);if(t1)if(await c(t1))L=t1;else W4.delete(U1);if(!L&&(F.startsWith("./")||F.startsWith("../")))L=g.resolve(g.dirname(J),`${F}.stx`),V.push(L);else if(!L)for(let K0 of d){if(!K0)continue;for(let i of x){let f0=g.join(K0,i);if(V.push(f0),await c(f0)){L=f0;break}}if(L)break;if(!L)try{let i=await import("fs");if(!i.statSync(K0,{throwIfNoEntry:!1})?.isDirectory())continue;let y5=8,e1=[{path:K0,depth:0}];while(e1.length>0&&!L){let X1=e1.pop();if(X1.depth>=y5)continue;let A$;try{A$=i.readdirSync(X1.path,{withFileTypes:!0})}catch{continue}for(let N$ of A$){if(!N$.isDirectory())continue;if(N$.name==="node_modules"||N$.name.startsWith("."))continue;let j9=g.join(X1.path,N$.name);for(let mQ of x){let R7=g.join(j9,mQ);if(V.push(R7),await c(R7)){L=R7;break}}if(L)break;e1.push({path:j9,depth:X1.depth+1})}}}catch{}if(L)break}if(L)W4.set(U1,L)}if(!L||!await c(L)){let C=V.length>0?`
8634
8871
  Searched paths:
8635
8872
  ${V.map((x)=>` - ${x}`).join(`
8636
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(K4.has(F))w=K4.get(F);else try{w=await Bun.file(F).text(),K4.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents",P$]),N={};for(let[C,x]of Object.entries(Q))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await a("stx/slots",()=>Promise.resolve().then(() => (l7(),u7))),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...fq(Y)&&{__stx_force_signals:!0}};vq(w,I);let E=w,D=d$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((C)=>/\bserver\b/.test(C[1]||"")&&/\bcache\b/.test(C[1]||""))&&S.every((C)=>/\bserver\b/.test(C[1]||"")),h=null,f=null;if(v){let C=bq({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(C!==null){h=`${F}\x00${C}`;let x=X3.get(h);if(x){for(let u of x.dependencies)q.add(u);return x.output}f=new Set(q)}}for(let C of S){let x=C[1]||"",u=C[2]||"",d=x.includes("server");if(b1(x)&&u.trim())u=S1(u);if(d&&u)try{await W(u,I,F)}catch(O0){}if(!d){let O0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Y1=O0.includes("{{")&&O0.includes("}}"),u0=O0.includes("{!!")&&O0.includes("!!}");if(Y1||u0)O0=f$(O0,I);let y0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${y0}>${O0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",M0=m?m[2]:"",I0="",m0=r&&/\bscoped\b/i.test(r);if(m)I0=`<style${r}>${M0}</style>`;let Y0=E;if(Y0=Y0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Y0=Y0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Y0=Y0.replace(C,(u,d)=>{let U0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(U0)x.push(`<style${U0[1]}>${U0[2]}</style>`);return""}),Y0=Y0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)I0=`${I0}${x.join(`
8637
- `)}`}if(Y&&Y0.includes("{{ text || slot }}"))Y0=Y0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:X0}=await a("stx/slots",()=>Promise.resolve().then(() => (l7(),u7))),{defaultSlot:D0,namedSlots:i0}=T;Y0=await X0(Y0,D0,i0,I);let W1=b.some((C)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),a1=gq(b);if(a1.length>0)I.__stx_client_signal_names=a1;let i={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:W1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let Z0=await w0(Y0,I,F,i,q),j0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let C of Z0.matchAll(/\{\{([\s\S]*?)\}\}/g))j0.add(C[1].trim());if(j0.size>0)Q.__stx_preserved_client_expressions=[...j0];let R0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++kq}_${Math.random().toString(36).slice(2,8)}`,P=Z0;if(W1){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${TZ(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${TZ(_)}"`:"";P=`<div data-stx-scope="${R0}"${C}${x}>${Z0}</div>`;let u=await Promise.all(b.map(async(d)=>{let U0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!U0)return d;let[,O0,Y1]=U0,u0=b$(Y1,{filePath:F,projectRoot:process.cwd()}),y0=u0.code,n0=S$(u0.styles);y0=Y5(y0).code;let{hasUserImports:M1,bundleClientScript:U1}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),d5)));if(M1(y0))y0=await U1(y0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:t1}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),G4)));y0=y0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(X1,A$)=>t1(A$));let K0=o0(y0),c=yq(K0),f0=`function(__scopeId) {
8638
- ${Q5("const",[...D8,...c],K0)}
8873
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(L);let w;if(q4.has(L))w=q4.get(L);else try{w=await Bun.file(L).text(),q4.set(L,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let R=new Set(["__originalFilePath","__importedComponents",C$]),A={};for(let[C,x]of Object.entries(Q))if(!C.startsWith("__")||R.has(C))A[C]=x;let{extractSlotContent:N}=await a("stx/slots",()=>Promise.resolve().then(() => (i7(),c7))),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...cq(Y)&&{__stx_force_signals:!0}};lq(w,I);let E=w,D=m$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],b=[],v=S.some((C)=>/\bserver\b/.test(C[1]||"")&&/\bcache\b/.test(C[1]||""))&&S.every((C)=>/\bserver\b/.test(C[1]||"")),h=null,f=null;if(v){let C=gq({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(C!==null){h=`${L}\x00${C}`;let x=G3.get(h);if(x){for(let u of x.dependencies)q.add(u);return x.output}f=new Set(q)}}for(let C of S){let x=C[1]||"",u=C[2]||"",d=x.includes("server");if(b1(x)&&u.trim())u=S1(u);if(d&&u)try{await W(u,I,L)}catch(O0){}if(!d){let O0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Y1=O0.includes("{{")&&O0.includes("}}"),u0=O0.includes("{!!")&&O0.includes("!!}");if(Y1||u0)O0=g$(O0,I);let y0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${y0}>${O0}</script>`)}}let m=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),r=m?m[1]:"",T0=m?m[2]:"",I0="",m0=r&&/\bscoped\b/i.test(r);if(m)I0=`<style${r}>${T0}</style>`;let Y0=E;if(Y0=Y0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)Y0=Y0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Y0=Y0.replace(C,(u,d)=>{let U0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(U0)x.push(`<style${U0[1]}>${U0[2]}</style>`);return""}),Y0=Y0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)I0=`${I0}${x.join(`
8874
+ `)}`}if(Y&&Y0.includes("{{ text || slot }}"))Y0=Y0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:X0}=await a("stx/slots",()=>Promise.resolve().then(() => (i7(),c7))),{defaultSlot:D0,namedSlots:i0}=T;Y0=await X0(Y0,D0,i0,I);let W1=b.some((C)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),a1=iq(b);if(a1.length>0)I.__stx_client_signal_names=a1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:W1||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let Z0=await w0(Y0,I,L,n,q),j0=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let C of Z0.matchAll(/\{\{([\s\S]*?)\}\}/g))j0.add(C[1].trim());if(j0.size>0)Q.__stx_preserved_client_expressions=[...j0];let A0=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++fq}_${Math.random().toString(36).slice(2,8)}`,P=Z0;if(W1){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${EZ(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${EZ(_)}"`:"";P=`<div data-stx-scope="${A0}"${C}${x}>${Z0}</div>`;let u=await Promise.all(b.map(async(d)=>{let U0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!U0)return d;let[,O0,Y1]=U0,u0=S$(Y1,{filePath:L,projectRoot:process.cwd()}),y0=u0.code,n0=y$(u0.styles);y0=Y5(y0).code;let{hasUserImports:T1,bundleClientScript:U1}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),m5)));if(T1(y0))y0=await U1(y0,L,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:t1}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),K4)));y0=y0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(X1,A$)=>t1(A$));let K0=o0(y0),i=dq(K0),f0=`function(__scopeId) {
8875
+ ${Q5("const",[...S8,...i],K0)}
8639
8876
  const __scope = window.stx._scopes = window.stx._scopes || {};
8640
8877
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
8641
8878
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -8653,7 +8890,7 @@ ${K0}
8653
8890
  // Register all defined signals and functions in this scope
8654
8891
  const __localVars = {};
8655
8892
  try {
8656
- ${c.map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
8893
+ ${i.map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
8657
8894
  `)}
8658
8895
  }
8659
8896
  catch (e) {}
@@ -8662,15 +8899,15 @@ catch (e) {}
8662
8899
  finally {
8663
8900
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
8664
8901
  }
8665
- }`,S5=_?null:q8(Q,f0),e1=S5?`window.__stxComponentFactories[${JSON.stringify(S5)}](${JSON.stringify(R0)});`:`(${f0})(${JSON.stringify(R0)});`;if(_)return`${n0}<script type="stx/island" data-stx-island="${R0}" data-stx-scoped${O0}>${e1}</script>`;return`${n0}<script data-stx-scoped${O0}>${e1}</script>`}));if(P=P+`
8902
+ }`,y5=_?null:j8(Q,f0),e1=y5?`window.__stxComponentFactories[${JSON.stringify(y5)}](${JSON.stringify(A0)});`:`(${f0})(${JSON.stringify(A0)});`;if(_)return`${n0}<script type="stx/island" data-stx-island="${A0}" data-stx-scoped${O0}>${e1}</script>`;return`${n0}<script data-stx-scoped${O0}>${e1}</script>`}));if(P=P+`
8666
8903
  `+u.join(`
8667
8904
  `),I0)P+=`
8668
8905
  `+I0}else{if(I0)P+=`
8669
- `+I0;if(b.length>0){let C=I.__stx_event_bindings||[],x=l5(I),u=await Promise.all(b.map(async(d)=>{let U0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!U0)return d;return await p5(U0[1],{eventBindings:C,templateContent:P,filePath:F,projectRoot:process.cwd(),serverData:x})}));P+=`
8906
+ `+I0;if(b.length>0){let C=I.__stx_event_bindings||[],x=p5(I),u=await Promise.all(b.map(async(d)=>{let U0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!U0)return d;return await c5(U0[1],{eventBindings:C,templateContent:P,filePath:L,projectRoot:process.cwd(),serverData:x})}));P+=`
8670
8907
  `+u.join(`
8671
- `),I.__stx_event_bindings=[]}}if(m0){let C=h$(P,F);if(C.hasScoped)P=C.html}if(h&&f)X3.set(h,{output:P,dependencies:[...q].filter((C)=>!f.has(C))});return P}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function p($){return Bun.file($).exists()}function J3($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function Q3($,Z,Y,X){let Q=await hq($,Z,Y,X);if(Q===null)return null;let J=J3(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(J3(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function hq($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let j=g.join(J,$),_=J3(j,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await p(_)&&X)X.add(_);return _}let G=g.join(Q,$);if(await p(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 j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await p(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=g.resolve(Q),W=process.cwd();for(let j=0;j<10;j++){let _=g.join(q,"layouts"),B=!1;try{B=Eq.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=g.join(K,j);if(await p(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,_);if(await p(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await p(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 j=$.split("layouts/"),_=g.join(Y.partialsDir||Q,"layouts",j[1]);if(await p(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await p(K)){let j=g.join(K,$);if(await p(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await p(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(Q.includes("temp")){let j=g.join(g.dirname(Q),"layouts",$);if(await p(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}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 MZ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8908
+ `),I.__stx_event_bindings=[]}}if(m0){let C=d$(P,L);if(C.hasScoped)P=C.html}if(h&&f)G3.set(h,{output:P,dependencies:[...q].filter((C)=>!f.has(C))});return P}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function K3($,Z){let Y=g.resolve(Z),X=g.resolve($),Q=Y.endsWith(g.sep)?Y:Y+g.sep;if(X===Y||X.startsWith(Q))return X;return null}async function q3($,Z,Y,X){let Q=await nq($,Z,Y,X);if(Q===null)return null;let J=K3(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(K3(Q,q))return g.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function nq($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=g.dirname(Z),J=process.cwd();if($.startsWith("/")){let j=g.join(J,$),_=K3(j,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&X)X.add(_);return _}let G=g.join(Q,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=g.resolve(Q),W=process.cwd();for(let j=0;j<10;j++){let _=g.join(q,"layouts"),B=!1;try{B=xq.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=g.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=g.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.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 j=$.split("layouts/"),_=g.join(Y.partialsDir||Q,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await c(K)){let j=g.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||g.join(process.cwd(),"views"),z=g.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(Q.includes("temp")){let j=g.join(g.dirname(Q),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}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 kZ($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8672
8909
  `),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,j)=>{let _=W+j+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
8673
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return MZ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function W0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=MZ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
8910
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return kZ($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function W0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=kZ(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
8674
8911
  `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
8675
8912
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
8676
8913
  `;if(U+=`
@@ -8683,8 +8920,8 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
8683
8920
  `,K)U+=`
8684
8921
  ${t.blue}${t.bold}Context:${t.reset}
8685
8922
  ${t.dim}${K}${t.reset}
8686
- `;return U}function UZ(){K4.clear(),q4.clear(),X3.clear()}var K4,q4,X3,kq=0,t;var F0=k(()=>{c5();k7();e0();r5();q5();U4();D1();v7();x7();h5();x8();e5();K4=new P1(500),q4=new P1(1000),X3=new P1(2000);t={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 IZ($,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,j=U,_=-1;while(z>0&&j<$.length){let L=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
8687
- `||O==="\r"||O===" "||O===void 0)z++;j=L+9}else{if(z--,z===0){_=F;break}j=F+12}}if(_===-1)continue;let B=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:B,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},_=g5(W.trim(),j);X=X.split(K).join(_)}catch(z){let j=z instanceof Error?z.message:String(z),_=W0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function DZ($,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}),g5($.trim(),Q)}var G3=k(()=>{F0()});function uq($){if(dq.set($.name,$),$.client)mq.set($.name,$.client)}function z4($){return uq($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=lq(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 lq($,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 dq,mq;var K3=k(()=>{dq=new Map,mq=new Map});function q3($,Z=j5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${Q$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function EZ($,Z,Y=pq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${Q$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function W3($,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 Q$($,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 U3($){return cq[$]||"application/octet-stream"}var j5,pq,J$,cq;var z3=k(()=>{j5=[320,480,640,768,1024,1280,1536,1920,2560],pq=[1,1.5,2,3],J$=["avif","webp","jpeg"],cq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function nq(){try{return await import("ts-images")}catch{return null}}async function oq($,Z={}){let Y={...iq,...Z},X=await nq();if(X)try{return await sq($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return rq($,Y)}async function sq($,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 rq($,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 kZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8923
+ `;return U}function _Z(){q4.clear(),W4.clear(),G3.clear()}var q4,W4,G3,fq=0,t;var L0=k(()=>{i5();y7();e0();a5();q5();z4();D1();g7();h7();d5();d8();$$();q4=new P1(500),W4=new P1(1000),G3=new P1(2000);t={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 bZ($,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,j=U,_=-1;while(z>0&&j<$.length){let F=$.indexOf("@markdown",j),L=$.indexOf("@endmarkdown",j);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let O=$[F+9];if(O==="("||O===`
8924
+ `||O==="\r"||O===" "||O===void 0)z++;j=F+9}else{if(z--,z===0){_=L;break}j=L+12}}if(_===-1)continue;let B=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:B,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},_=h5(W.trim(),j);X=X.split(K).join(_)}catch(z){let j=z instanceof Error?z.message:String(z),_=W0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function SZ($,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}),h5($.trim(),Q)}var W3=k(()=>{L0()});function rq($){if(oq.set($.name,$),$.client)sq.set($.name,$.client)}function j4($){return rq($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=aq(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 aq($,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 oq,sq;var U3=k(()=>{oq=new Map,sq=new Map});function z3($,Z=j5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${G$($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function yZ($,Z,Y=tq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${G$($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function j3($,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 G$($,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 B3($){return eq[$]||"application/octet-stream"}var j5,tq,Q$,eq;var _3=k(()=>{j5=[320,480,640,768,1024,1280,1536,1920,2560],tq=[1,1.5,2,3],Q$=["avif","webp","jpeg"],eq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function ZW(){try{return await import("ts-images")}catch{return null}}async function YW($,Z={}){let Y={...$W,...Z},X=await ZW();if(X)try{return await XW($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return JW($,Y)}async function XW($,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 JW($,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 PZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8688
8925
  #${$} {
8689
8926
  --stx-img-transition-duration: ${X}ms;
8690
8927
  --stx-img-transition-easing: ${Q};
@@ -8701,7 +8938,7 @@ ${t.dim}${K}${t.reset}
8701
8938
  #${$}.stx-img-loaded img {
8702
8939
  opacity: 1;
8703
8940
  }
8704
- `.trim()}async function bZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(j3.has(Y))return j3.get(Y);let X=await oq($,Z);return j3.set(Y,X),X}var iq,B3,j3;var SZ=k(()=>{iq={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},B3=`
8941
+ `.trim()}async function CZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(H3.has(Y))return H3.get(Y);let X=await YW($,Z);return H3.set(Y,X),X}var $W,O3,H3;var vZ=k(()=>{$W={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},O3=`
8705
8942
  .stx-img-placeholder {
8706
8943
  position: relative;
8707
8944
  overflow: hidden;
@@ -8730,8 +8967,8 @@ ${t.dim}${K}${t.reset}
8730
8967
  filter: blur(0);
8731
8968
  transform: scale(1);
8732
8969
  }
8733
- `.trim();j3=new Map});import{createHash as PZ}from"crypto";import{readFile as aq,stat as CZ}from"fs/promises";async function E0($){try{let Z=await aq($);return PZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function yZ($){return PZ("sha256").update($).digest("hex").slice(0,16)}function j4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${yZ($)}-${yZ(Y)}`}async function _3($){try{return(await CZ($)).mtimeMs}catch{return 0}}async function N0($){try{return await CZ($),!0}catch{return!1}}var h1=()=>{};import{mkdir as tq,readFile as eq,writeFile as $W,readdir as IL,rm as ZW,stat as DL}from"fs/promises";import{join as xZ,dirname as YW}from"path";async function XW($){try{await tq($,{recursive:!0})}catch{}}function fZ($,Z,Y){return xZ($,Y,`${Z}.json`)}async function vZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await _3(Z)!==$.srcMtime)return!1;return!0}async function B4($,Z,Y,X=H3){if(!X.enabled)return null;let Q=j4($,Z),J=B5.get(Q);if(J){if(await vZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;B5.delete(Q)}let G=fZ(X.directory,Q,Y);if(await N0(G))try{let K=await eq(G,"utf-8"),q=JSON.parse(K);if(await vZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),B5.set(Q,q),q.data}catch{}return null}async function _4($,Z,Y,X,Q=H3){if(!Q.enabled)return;let J=j4($,Z),G=await E0($),K=await _3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:j4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};B5.set(J,q);let W=fZ(Q.directory,J,X);try{await XW(YW(W)),await $W(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function H4($,Z=H3){if($==="all")B5.clear();else B5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=xZ(Z.directory,X);try{await ZW(Q,{recursive:!0,force:!0})}catch{}}}var B5,H3;var O3=k(()=>{h1();B5=new Map,H3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={...JW,...$}}async get($,Z){return B4($,Z,"image",this.config)}async set($,Z,Y){return _4($,Z,Y,"image",this.config)}async clear(){return H4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function L3($){if(!O4)O4=new L4($);else if($)O4.updateConfig($);return O4}async function F4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L3(X).get($,Z)}async function V4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return L3(Q).set($,Z,Y)}async function gZ(){return L3().clear()}var JW,O4=null;var F3=k(()=>{O3();JW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as QW,basename as GW,extname as KW,join as qW}from"path";import{mkdir as WW}from"fs/promises";async function V3(){try{return await import("ts-images")}catch{return null}}function hZ($){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 UW($,Z){let Y=Z?hZ(Z):hZ("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 dZ($,Z,Y){let X=await V3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await F4($,Z,Y);if(Q)return Q;try{let J=QW($);if(!await N0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=UW(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await WW(K,{recursive:!0});let W=await E0(J),U=GW($,KW($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await w3(J,Z.transformations,X);for(let B of z){let H=G[B]||{},L=`${U}-${W}.${B}`,F=qW(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(J);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(J,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await V4($,Z,j,Y),j}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function mZ($,Z,Y,X){let Q=await V3();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 w3($,Z,Y){let X=Y||await V3();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 uZ=k(()=>{h1();F3()});import{resolve as zW,basename as jW,extname as BW,join as _W}from"path";import{mkdir as HW}from"fs/promises";async function OW(){try{return await import("ts-images")}catch{return null}}async function lZ($,Z,Y){let X=await OW();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=zW($);if(!await N0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||LW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await HW(K,{recursive:!0});let W=await E0(Q),U=jW($,BW($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${B}`,O=_W(K,F),V=`${q}/${F}`;try{let w=z[B]?.quality||80;if(await N0(O)){j.byFormat[B].push({path:O,url:V,width:L,height:0,format:B,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await X.generateThumbHash(Q);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(Q,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||FW(J),j}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function FW($){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 pZ($,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 LW;var cZ=k(()=>{h1();LW=[320,480,640,768,1024,1280,1536,1920]});var iZ={};s(iZ,{setCachedImageResult:()=>V4,processImage:()=>dZ,optimizeImage:()=>mZ,getCachedImageResult:()=>F4,generateSrcset:()=>pZ,generateResponsiveVariants:()=>lZ,clearImageCache:()=>gZ,applyTransformations:()=>w3,ImageProcessorCache:()=>L4});var nZ=k(()=>{uZ();cZ();F3()});async function VW(){try{return await Promise.resolve().then(() => (nZ(),iZ))}catch($){if(!oZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),oZ=!0;return null}}async function w4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return NW(X,Y)}if(Y.processedResult?.processed)return T3($,Y.processedResult,Z);if(Y.responsiveVariants)return tZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=j5,dpr:U,formats:z=J$,quality:j=A3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":R4,decoding:V=A4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return RW($);let b,v,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{b=await bZ(Q,{strategy:B,...H}),v=kZ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=AW($,h,b,Z);else m=await wW($,h,b,Z);let r;if(F){let m0=z.includes("webp")?"webp":z[0],Y0=q3(Q,W,{..._,q:j},m0),X0=typeof q==="object"?W3(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Y0}" imagesizes="${X0}" />`}let M0=[];if(!sZ&&B!=="none")M0.push(B3),sZ=!0;if(v)M0.push(v);let I0=L?aZ(h):void 0;return{html:m,preloadLink:r,css:M0.length>0?M0.join(`
8734
- `):void 0,script:I0}}async function wW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=j5,formats:U=J$,quality:z=A3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":R4,decoding:L=A4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?W3(q):q||"100vw",I=[];for(let y of U){let S=q3(Q,W,{...j,q:z},y),b=U3(y);if(_&&!B)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=R3({src:Q$(Q,{...j,q:z}),alt:J,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:rZ(N,Y),style:N3(R,O,V,Y),lazy:_&&!B,data:T}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
8970
+ `.trim();H3=new Map});import{createHash as fZ}from"crypto";import{readFile as QW,stat as gZ}from"fs/promises";async function E0($){try{let Z=await QW($);return fZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function xZ($){return fZ("sha256").update($).digest("hex").slice(0,16)}function B4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${xZ($)}-${xZ(Y)}`}async function F3($){try{return(await gZ($)).mtimeMs}catch{return 0}}async function N0($){try{return await gZ($),!0}catch{return!1}}var h1=()=>{};import{mkdir as GW,readFile as KW,writeFile as qW,readdir as fF,rm as WW,stat as gF}from"fs/promises";import{join as dZ,dirname as UW}from"path";async function zW($){try{await GW($,{recursive:!0})}catch{}}function mZ($,Z,Y){return dZ($,Y,`${Z}.json`)}async function hZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await F3(Z)!==$.srcMtime)return!1;return!0}async function _4($,Z,Y,X=L3){if(!X.enabled)return null;let Q=B4($,Z),J=B5.get(Q);if(J){if(await hZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;B5.delete(Q)}let G=mZ(X.directory,Q,Y);if(await N0(G))try{let K=await KW(G,"utf-8"),q=JSON.parse(K);if(await hZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),B5.set(Q,q),q.data}catch{}return null}async function H4($,Z,Y,X,Q=L3){if(!Q.enabled)return;let J=B4($,Z),G=await E0($),K=await F3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:B4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};B5.set(J,q);let W=mZ(Q.directory,J,X);try{await zW(UW(W)),await qW(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function O4($,Z=L3){if($==="all")B5.clear();else B5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=dZ(Z.directory,X);try{await WW(Q,{recursive:!0,force:!0})}catch{}}}var B5,L3;var V3=k(()=>{h1();B5=new Map,L3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={...jW,...$}}async get($,Z){return _4($,Z,"image",this.config)}async set($,Z,Y){return H4($,Z,Y,"image",this.config)}async clear(){return O4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function w3($){if(!F4)F4=new L4($);else if($)F4.updateConfig($);return F4}async function V4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return w3(X).get($,Z)}async function w4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return w3(Q).set($,Z,Y)}async function uZ(){return w3().clear()}var jW,F4=null;var R3=k(()=>{V3();jW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as BW,basename as _W,extname as HW,join as OW}from"path";import{mkdir as FW}from"fs/promises";async function A3(){try{return await import("ts-images")}catch{return null}}function lZ($){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 LW($,Z){let Y=Z?lZ(Z):lZ("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 pZ($,Z,Y){let X=await A3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await V4($,Z,Y);if(Q)return Q;try{let J=BW($);if(!await N0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=LW(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await FW(K,{recursive:!0});let W=await E0(J),U=_W($,HW($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await N3(J,Z.transformations,X);for(let B of z){let H=G[B]||{},F=`${U}-${W}.${B}`,L=OW(K,F);try{let O=await X.optimizeImage({input:_||J,output:L,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:L,url:`${q}/${F}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(J);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(J,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await w4($,Z,j,Y),j}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function cZ($,Z,Y,X){let Q=await A3();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 N3($,Z,Y){let X=Y||await A3();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 iZ=k(()=>{h1();R3()});import{resolve as VW,basename as wW,extname as RW,join as AW}from"path";import{mkdir as NW}from"fs/promises";async function MW(){try{return await import("ts-images")}catch{return null}}async function nZ($,Z,Y){let X=await MW();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=VW($);if(!await N0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||TW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await NW(K,{recursive:!0});let W=await E0(Q),U=wW($,RW($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let F of J){let L=`${U}-${F}w-${W}.${B}`,O=AW(K,L),V=`${q}/${L}`;try{let w=z[B]?.quality||80;if(await N0(O)){j.byFormat[B].push({path:O,url:V,width:F,height:0,format:B,size:0}),H.push(`${V} ${F}w`);continue}let R=await X.processImage({input:Q,output:O,format:B,quality:w,resize:{width:F}});if(R)j.byFormat[B].push({path:O,url:V,width:F,height:R.height||Math.round(F*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),H.push(`${V} ${F}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await X.generateThumbHash(Q);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(Q,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||IW(J),j}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function IW($){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 oZ($,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 TW;var sZ=k(()=>{h1();TW=[320,480,640,768,1024,1280,1536,1920]});var rZ={};s(rZ,{setCachedImageResult:()=>w4,processImage:()=>pZ,optimizeImage:()=>cZ,getCachedImageResult:()=>V4,generateSrcset:()=>oZ,generateResponsiveVariants:()=>nZ,clearImageCache:()=>uZ,applyTransformations:()=>N3,ImageProcessorCache:()=>L4});var aZ=k(()=>{iZ();sZ();R3()});async function DW(){try{return await Promise.resolve().then(() => (aZ(),rZ))}catch($){if(!tZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),tZ=!0;return null}}async function R4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return SW(X,Y)}if(Y.processedResult?.processed)return D3($,Y.processedResult,Z);if(Y.responsiveVariants)return Y2($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=j5,dpr:U,formats:z=Q$,quality:j=M3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:F=!0,priority:L=!1,loading:O=L?"eager":N4,decoding:V=A4,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return bW($);let b,v,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await CZ(Q,{strategy:B,...H}),v=PZ(h,b,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=kW($,h,b,Z);else m=await EW($,h,b,Z);let r;if(L){let m0=z.includes("webp")?"webp":z[0],Y0=z3(Q,W,{..._,q:j},m0),X0=typeof q==="object"?j3(q):q||"100vw";r=`<link rel="preload" as="image" imagesrcset="${Y0}" imagesizes="${X0}" />`}let T0=[];if(!eZ&&B!=="none")T0.push(O3),eZ=!0;if(v)T0.push(v);let I0=F?Z2(h):void 0;return{html:m,preloadLink:r,css:T0.length>0?T0.join(`
8971
+ `):void 0,script:I0}}async function EW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=j5,formats:U=Q$,quality:z=M3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":N4,decoding:F=A4,fetchpriority:L,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?j3(q):q||"100vw",I=[];for(let y of U){let S=z3(Q,W,{...j,q:z},y),b=B3(y);if(_&&!B)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=T3({src:G$(Q,{...j,q:z}),alt:J,width:G,height:K,loading:B?void 0:H,decoding:F,fetchpriority:B?"high":L,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:$2(A,Y),style:I3(N,O,V,Y),lazy:_&&!B,data:T}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
8735
8972
  <picture>
8736
8973
  ${I.join(`
8737
8974
  `)}
@@ -8741,9 +8978,9 @@ ${I.join(`
8741
8978
  ${I.join(`
8742
8979
  `)}
8743
8980
  <img ${E} />
8744
- </picture>`;return D}function AW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=A3,params:U={},lazy:z=!0,priority:j=!1,loading:_=j?"eager":R4,decoding:B=A4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=EZ(Q,R,q,{...U,q:W}),M=R3({src:Q$(Q,{...U,w:R,q:W}),alt:J,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:rZ(w,Y),style:N3(A,L,F,Y),lazy:z&&!j,data:N}),I=z&&!j?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8981
+ </picture>`;return D}function kW($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=M3,params:U={},lazy:z=!0,priority:j=!1,loading:_=j?"eager":N4,decoding:B=A4,fetchpriority:H,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=yZ(Q,N,q,{...U,q:W}),M=T3({src:G$(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V,className:$2(w,Y),style:I3(R,F,L,Y),lazy:z&&!j,data:A}),I=z&&!j?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8745
8982
  <img ${M} ${I} />
8746
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function RW($){let{src:Z,alt:Y,width:X,height:Q,loading:J=R4,decoding:G=A4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${R3({src:Z,alt:Y,width:X,height:Q,loading:j?"eager":J,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:N3(B,q,W),id:H,data:L})} />`}}function R3($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.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="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${r0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function rZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function N3($,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 r0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function aZ($){return`
8983
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function bW($){let{src:Z,alt:Y,width:X,height:Q,loading:J=N4,decoding:G=A4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,F=$.data||{};return{html:`<img ${T3({src:Z,alt:Y,width:X,height:Q,loading:j?"eager":J,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:I3(B,q,W),id:H,data:F})} />`}}function T3($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.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="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${r0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function $2($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function I3($,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 r0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Z2($){return`
8747
8984
  (function() {
8748
8985
  const container = document.getElementById('${$}');
8749
8986
  if (!container) return;
@@ -8780,22 +9017,22 @@ ${I.join(`
8780
9017
 
8781
9018
  observer.observe(container);
8782
9019
  })();
8783
- `.trim()}async function NW($,Z){let Y=await VW();if(!Y)return w4({...$,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 tZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return T3($,J,Z)}return w4({...$,process:!1},Z)}async function T3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],N=["avif","webp","jpeg","png"];for(let v of N){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=U3(v);if(G&&!K)A.push(` <source type="${m}" data-srcset="${f}" />`);else A.push(` <source type="${m}" srcset="${f}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${r0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${r0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${r0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(U)R.push(`crossorigin="${U}"`);if(z)R.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)R.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[v,h]of Object.entries(H))R.push(`data-${v}="${r0(h)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${v}">
9020
+ `.trim()}async function SW($,Z){let Y=await DW();if(!Y)return R4({...$,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 Y2($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return D3($,J,Z)}return R4({...$,process:!1},Z)}async function D3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},F=Z.variants||[],L=F.find((v)=>v.format==="jpeg")||F.find((v)=>v.format==="webp")||F[0],O=L?.url||$.src,V=F.filter((v)=>v.format===(L?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of F){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let R=[],A=["avif","webp","jpeg","png"];for(let v of A){let h=w.get(v);if(h&&h.length>0){let f=h.map((r)=>`${r.url} ${r.width}w`).join(", "),m=B3(v);if(G&&!K)R.push(` <source type="${m}" data-srcset="${f}" />`);else R.push(` <source type="${m}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${r0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${r0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${r0(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(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[v,h]of Object.entries(H))N.push(`data-${v}="${r0(h)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${v}">
8784
9021
  <picture>
8785
- ${A.join(`
9022
+ ${R.join(`
8786
9023
  `)}
8787
- <img ${R.join(" ")} />
9024
+ <img ${N.join(" ")} />
8788
9025
  </picture>
8789
9026
  </div>`}else D=`<picture${B?` id="${B}"`:""}>
8790
- ${A.join(`
9027
+ ${R.join(`
8791
9028
  `)}
8792
- <img ${R.join(" ")} />
8793
- </picture>`;let y=[];if(Z.placeholder)y.push(B3);let S=G?aZ(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:y.length>0?y.join(`
8794
- `):void 0,script:S}}async function tZ($,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 T3($,X,Y)}var oZ=!1,A3=80,A4="async",R4="lazy",sZ=!1;var eZ=k(()=>{z3();SZ()});function TW(){return z4({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}=MW($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||j5,formats:G.formats||J$,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 w4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
9029
+ <img ${N.join(" ")} />
9030
+ </picture>`;let y=[];if(Z.placeholder)y.push(O3);let S=G?Z2(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:y.length>0?y.join(`
9031
+ `):void 0,script:S}}async function Y2($,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 D3($,X,Y)}var tZ=!1,M3=80,A4="async",N4="lazy",eZ=!1;var X2=k(()=>{_3();vZ()});function yW(){return j4({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}=PW($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||j5,formats:G.formats||Q$,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 R4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
8795
9032
  `+U;if(W.css)U+=`
8796
9033
  <style>${W.css}</style>`;if(W.script)U+=`
8797
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function MW($,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=IW(X),J=M3(Q[0],Y)||"",G=M3(Q[1],Y)||"",K={};if(Q[2]){let q=M3(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 IW($){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 M3($,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 $2;var Z2=k(()=>{K3();eZ();z3();$2=TW()});class T4{config;constructor($={}){this.config={...DW,...$}}async get($,Z){return B4($,Z,"video",this.config)}async set($,Z,Y){return _4($,Z,Y,"video",this.config)}async clear(){return H4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function I3($){if(!N4)N4=new T4($);else if($)N4.updateConfig($);return N4}async function M4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return I3(X).get($,Z)}async function I4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return I3(Q).set($,Z,Y)}async function Y2(){return I3().clear()}var DW,N4=null;var D3=k(()=>{O3();DW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as E3,basename as k3,extname as b3,join as D4}from"path";import{mkdir as S3}from"fs/promises";async function y3(){try{return await import("ts-videos")}catch{return null}}async function E4($,Z,Y,X){let Q=await y3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=E3($);if(!await N0(J))return null;await S3(Y,{recursive:!0});let G=await E0(J),K=k3($,b3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=D4(Y,U),j=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(j&&j.length>0){let _=j[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function k4($,Z,Y,X){let Q=await y3();if(!Q)return[];try{let J=E3($);if(!await N0(J))return[];await S3(Y,{recursive:!0});let G=await E0(J),K=k3($,b3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,j=Z.count||10,_=Z.interval||z/j,B=[];for(let L=0;L<j&&L*_<z;L++)B.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:B,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||D4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function X2($,Z,Y,X){let Q=await y3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=E3($);if(!await N0(J))return null;await S3(Y,{recursive:!0});let G=await E0(J),K=k3($,b3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/j),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=D4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*j);let A=await Q.extractThumbnails(J,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:D4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=z*_,T=F*B,M=await N.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:B,interval:j,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 P3=k(()=>{h1()});import{resolve as Q2,basename as G2,extname as K2,join as d1}from"path";import{mkdir as b4,writeFile as q2}from"fs/promises";async function W2(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,X,Q){let J=await W2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=Q2($);if(!await N0(G))return null;let K=await E0(G),q=G2($,K2($)),W=d1(Y,`${q}-${K}-hls`);await b4(W,{recursive:!0});let U=Z.length>0?Z:U2,z=Q?.segmentDuration||6,B=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=d1(W,V.label);await b4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=d1(w,A);try{let R=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(B/z)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=d1(W,"master.m3u8"),O=EW(H,X,q,K);return await q2(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function EW($,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(`
8798
- `)}async function y4($,Z,Y,X,Q){let J=await W2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=Q2($);if(!await N0(G))return null;let K=await E0(G),q=G2($,K2($)),W=d1(Y,`${q}-${K}-dash`);await b4(W,{recursive:!0});let U=Z.length>0?Z:U2,z=Q?.segmentDuration||4,j=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let N=d1(W,A.label);await b4(N,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:N,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=d1(W,"manifest.mpd"),V=kW(L,F,H,z,j);await q2(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 kW($,Z,Y,X,Q){let J=J2(Y),G=J2(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
9034
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function PW($,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=CW(X),J=E3(Q[0],Y)||"",G=E3(Q[1],Y)||"",K={};if(Q[2]){let q=E3(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 CW($){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 E3($,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 J2;var Q2=k(()=>{U3();X2();_3();J2=yW()});class T4{config;constructor($={}){this.config={...vW,...$}}async get($,Z){return _4($,Z,"video",this.config)}async set($,Z,Y){return H4($,Z,Y,"video",this.config)}async clear(){return O4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function k3($){if(!M4)M4=new T4($);else if($)M4.updateConfig($);return M4}async function I4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return k3(X).get($,Z)}async function D4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return k3(Q).set($,Z,Y)}async function G2(){return k3().clear()}var vW,M4=null;var b3=k(()=>{V3();vW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as S3,basename as y3,extname as P3,join as E4}from"path";import{mkdir as C3}from"fs/promises";async function v3(){try{return await import("ts-videos")}catch{return null}}async function k4($,Z,Y,X){let Q=await v3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=S3($);if(!await N0(J))return null;await C3(Y,{recursive:!0});let G=await E0(J),K=y3($,P3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=E4(Y,U),j=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(j&&j.length>0){let _=j[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function b4($,Z,Y,X){let Q=await v3();if(!Q)return[];try{let J=S3($);if(!await N0(J))return[];await C3(Y,{recursive:!0});let G=await E0(J),K=y3($,P3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,j=Z.count||10,_=Z.interval||z/j,B=[];for(let F=0;F<j&&F*_<z;F++)B.push(F*_);let H=await Q.extractThumbnails(J,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((F,L)=>({path:F.path||E4(Y,`${K}-thumb-${G}-${L}.${q}`),url:`${X}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:B[L],size:F.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function K2($,Z,Y,X){let Q=await v3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=S3($);if(!await N0(J))return null;await C3(Y,{recursive:!0});let G=await E0(J),K=y3($,P3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",F=Math.ceil(U/j),L=Math.ceil(F/z),O=`${K}-sprite-${G}.${H}`,V=E4(Y,O),w=[];for(let A=0;A<F;A++)w.push(A*j);let R=await Q.extractThumbnails(J,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:E4(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=z*_,T=L*B,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:L,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:F}}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 x3=k(()=>{h1()});import{resolve as W2,basename as U2,extname as z2,join as d1}from"path";import{mkdir as S4,writeFile as j2}from"fs/promises";async function B2(){try{return await import("ts-videos")}catch{return null}}async function y4($,Z,Y,X,Q){let J=await B2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=W2($);if(!await N0(G))return null;let K=await E0(G),q=U2($,z2($)),W=d1(Y,`${q}-${K}-hls`);await S4(W,{recursive:!0});let U=Z.length>0?Z:_2,z=Q?.segmentDuration||6,B=(await new J.Input(G).getInfo()).duration||0,H=[],F=0;for(let V of U){let w=d1(W,V.label);await S4(w,{recursive:!0});let R=`${V.label}.m3u8`,A=d1(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}),F+=N.segmentCount||Math.ceil(B/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let L=d1(W,"master.m3u8"),O=xW(H,X,q,K);return await j2(L,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function xW($,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(`
9035
+ `)}async function P4($,Z,Y,X,Q){let J=await B2();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=W2($);if(!await N0(G))return null;let K=await E0(G),q=U2($,z2($)),W=d1(Y,`${q}-${K}-dash`);await S4(W,{recursive:!0});let U=Z.length>0?Z:_2,z=Q?.segmentDuration||4,j=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,F=[],L=[];for(let R of U){let A=d1(W,R.label);await S4(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(F.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)L.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(F.length===0)return null;let O=d1(W,"manifest.mpd"),V=fW(F,L,H,z,j);await j2(O,V);let w=[{type:"video",representations:F}];if(L.length>0)w.push({type:"audio",representations:L});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 fW($,Z,Y,X,Q){let J=q2(Y),G=q2(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
8799
9036
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
8800
9037
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8801
9038
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -8821,7 +9058,7 @@ ${A.join(`
8821
9058
  </Representation>
8822
9059
  `}K+=` </AdaptationSet>
8823
9060
  `}return K+=` </Period>
8824
- </MPD>`,K}function J2($){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 U2;var C3=k(()=>{h1();U2=[{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 z2,basename as bW,extname as SW,join as yW}from"path";import{mkdir as PW}from"fs/promises";async function j2(){try{return await import("ts-videos")}catch{return null}}function CW($){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 vW($){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 v3($){let Z=await j2();if(!Z)return null;try{let Y=z2($),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 B2($,Z,Y,X){let Q=await j2();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await M4($,Z,Y);if(J)return J;try{let G=z2($);if(!await N0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await PW(K,{recursive:!0});let W=await E0(G),U=bW($,SW($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await v3(G)||void 0;let j={};if(Z.quality)j.bitrate=CW(Z.quality);if(Z.platform)Object.assign(j,vW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=yW(K,_);try{let H=await xW(G,B,j,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.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 _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await E4(G,_,K,q);if(B)z.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await k4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await S4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(_.format==="dash"){let B=await y4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await I4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xW($,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 _2=k(()=>{h1();D3();P3();C3()});var H2={};s(H2,{setCachedVideoResult:()=>I4,processVideo:()=>B2,getCachedVideoResult:()=>M4,generateThumbnails:()=>k4,generateSpriteSheet:()=>X2,generatePoster:()=>E4,generateHLSManifest:()=>S4,generateDASHManifest:()=>y4,clearVideoCache:()=>Y2,analyzeVideo:()=>v3,VideoProcessorCache:()=>T4});var O2=k(()=>{_2();P3();C3();D3()});async function F2(){try{return await Promise.resolve().then(() => (O2(),H2))}catch($){if(!L2)console.warn("[stx-media] Video processor not available, some features disabled:",$),L2=!0;return null}}async function P4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return uW(X,Y)}if(Y.processedResult?.processed)return R2($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await lW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=V2,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:_=w2,playsinline:B=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return hW($,Z);if(F&&F!=="video")return gW(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:A2(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(N)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),R)D.push(`data-poster="${H0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),R)D.push(`poster="${H0(R)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${H0(T)}"`);if(M)D.push(`style="${H0(M)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${H0(v.src)}"`:`src="${H0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
9061
+ </MPD>`,K}function q2($){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 _2;var f3=k(()=>{h1();_2=[{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 H2,basename as gW,extname as hW,join as dW}from"path";import{mkdir as mW}from"fs/promises";async function O2(){try{return await import("ts-videos")}catch{return null}}function uW($){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 lW($){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 g3($){let Z=await O2();if(!Z)return null;try{let Y=H2($),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 F2($,Z,Y,X){let Q=await O2();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await I4($,Z,Y);if(J)return J;try{let G=H2($);if(!await N0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await mW(K,{recursive:!0});let W=await E0(G),U=gW($,hW($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await g3(G)||void 0;let j={};if(Z.quality)j.bitrate=uW(Z.quality);if(Z.platform)Object.assign(j,lW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,B=dW(K,_);try{let H=await pW(G,B,j,Q,(F)=>X?.({percentage:10+F*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.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 _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await k4(G,_,K,q);if(B)z.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await b4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await y4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(_.format==="dash"){let B=await P4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await D4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function pW($,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 L2=k(()=>{h1();b3();x3();f3()});var V2={};s(V2,{setCachedVideoResult:()=>D4,processVideo:()=>F2,getCachedVideoResult:()=>I4,generateThumbnails:()=>b4,generateSpriteSheet:()=>K2,generatePoster:()=>k4,generateHLSManifest:()=>y4,generateDASHManifest:()=>P4,clearVideoCache:()=>G2,analyzeVideo:()=>g3,VideoProcessorCache:()=>T4});var w2=k(()=>{L2();x3();f3();b3()});async function A2(){try{return await Promise.resolve().then(() => (w2(),V2))}catch($){if(!R2)console.warn("[stx-media] Video processor not available, some features disabled:",$),R2=!0;return null}}async function C4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return rW(X,Y)}if(Y.processedResult?.processed)return I2($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await aW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=N2,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:_=M2,playsinline:B=!0,lazy:H=!0,player:F="native",type:L,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(F==="ts-video")return nW($,Z);if(L&&L!=="video")return iW(J||"",L,$);let E=G.length>0?G:J?[{src:J,type:T2(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${H0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${H0(N)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${H0(T)}"`);if(M)D.push(`style="${H0(M)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${H0(v.src)}"`:`src="${H0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
8825
9062
  `),S=`<video ${D.join(" ")}>
8826
9063
  ${y}
8827
9064
  Your browser does not support the video tag.
@@ -8860,15 +9097,15 @@ ${y}
8860
9097
 
8861
9098
  observer.observe(video);
8862
9099
  })();
8863
- `.trim();return{html:S,script:b}}function gW($,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=dW($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=mW($),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="${H0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${H0(J)}"`);if(G)U.push(`style="${H0(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;">
9100
+ `.trim();return{html:S,script:b}}function iW($,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=oW($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=sW($),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="${H0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${H0(J)}"`);if(G)U.push(`style="${H0(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;">
8864
9101
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
8865
- </div>`}}function hW($,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:j,height:_}=$,B=$.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",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
9102
+ </div>`}}function nW($,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:j,height:_}=$,B=$.class,H=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={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",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
8866
9103
  <div
8867
- id="${L}"
9104
+ id="${F}"
8868
9105
  class="ts-video-player${B?" "+H0(B):""}"
8869
9106
  style="${O}"
8870
9107
  data-ts-video-player
8871
- data-config='${JSON.stringify(F)}'
9108
+ data-config='${JSON.stringify(L)}'
8872
9109
  ${z?"data-lazy":""}
8873
9110
  >
8874
9111
  <div class="ts-video-player__container">
@@ -8885,7 +9122,7 @@ ${y}
8885
9122
  </div>
8886
9123
  `.trim(),w=`
8887
9124
  (function() {
8888
- var container = document.getElementById('${L}');
9125
+ var container = document.getElementById('${F}');
8889
9126
  if (!container) return;
8890
9127
 
8891
9128
  var config = JSON.parse(container.dataset.config || '{}');
@@ -8899,7 +9136,7 @@ ${y}
8899
9136
 
8900
9137
  // Load ts-video-player from CDN
8901
9138
  var script = document.createElement('script');
8902
- script.src = '${fW}';
9139
+ script.src = '${cW}';
8903
9140
  script.onload = initPlayer;
8904
9141
  script.onerror = function() {
8905
9142
  console.error('[stx] Failed to load ts-video-player');
@@ -8977,7 +9214,7 @@ else {
8977
9214
  });
8978
9215
  }
8979
9216
  })();
8980
- `.trim(),A=`
9217
+ `.trim(),R=`
8981
9218
  .ts-video-player {
8982
9219
  position: relative;
8983
9220
  background: #000;
@@ -9029,14 +9266,14 @@ else {
9029
9266
  .ts-video-player__play-button svg {
9030
9267
  margin-left: 4px;
9031
9268
  }
9032
- `.trim();return{html:V,script:w,css:A}}function A2($){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 dW($){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 mW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function H0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function uW($,Z){let Y=await F2();if(!Y)return P4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return R2($,Q,Z);return P4({...$,process:!1},Z)}async function lW($,Z){let Y=await F2();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 R2($,Z,Y){let{controls:X=V2,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=w2,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=A2(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(X)N.push("controls");if(Q)N.push("autoplay");if(J)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(_)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(j)N.push(`crossorigin="${j}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${H0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${H0(A)}"`);let R=U||Z.metadata?.width,T=z||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${H0(H)}"`);if(L)N.push(`style="${H0(L)}"`);let I=` <source ${W?`data-src="${H0(O)}"`:`src="${H0(O)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
9269
+ `.trim();return{html:V,script:w,css:R}}function T2($){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 oW($){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 sW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function H0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function rW($,Z){let Y=await A2();if(!Y)return C4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return I2($,Q,Z);return C4({...$,process:!1},Z)}async function aW($,Z){let Y=await A2();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 I2($,Z,Y){let{controls:X=N2,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=M2,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=T2(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="${L}"`];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(_)A.push("disablepictureinpicture");if(B)A.push("disableremoteplayback");if(j)A.push(`crossorigin="${j}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${H0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${H0(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="${H0(H)}"`);if(F)A.push(`style="${H0(F)}"`);let I=` <source ${W?`data-src="${H0(O)}"`:`src="${H0(O)}"`} type="${V}" />`,E=`<video ${A.join(" ")}>
9033
9270
  ${I}
9034
9271
  Your browser does not support the video tag.
9035
9272
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${H0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
9036
9273
  ${E}
9037
9274
  </div>`;let D;if(W)D=`
9038
9275
  (function() {
9039
- var video = document.getElementById('${F}');
9276
+ var video = document.getElementById('${L}');
9040
9277
  if (!video) return;
9041
9278
 
9042
9279
  var observer = new IntersectionObserver(function(entries) {
@@ -9078,9 +9315,9 @@ ${E}
9078
9315
  width: 100%;
9079
9316
  height: auto;
9080
9317
  }
9081
- `.trim();return{html:E,script:D,css:y}}var L2=!1,V2=!0,w2="metadata",fW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var N2=k(()=>{f3()});function T2(){return z4({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}=pW($,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 P4(G,q),U=W.html;if(W.css)U+=`
9318
+ `.trim();return{html:E,script:D,css:y}}var R2=!1,N2=!0,M2="metadata",cW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var D2=k(()=>{d3()});function E2(){return j4({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}=tW($,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 C4(G,q),U=W.html;if(W.css)U+=`
9082
9319
  <style>${W.css}</style>`;if(W.script)U+=`
9083
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function pW($,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=cW(X),J=M2(Q[0],Y)||"",G={};if(Q[1]){let K=M2(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 cW($){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 M2($,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 x3;var f3=k(()=>{K3();N2();x3=T2()});function iW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
9320
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function tW($,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=eW(X),J=k2(Q[0],Y)||"",G={};if(Q[1]){let K=k2(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 eW($){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 k2($,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 d3=k(()=>{U3();D2();h3=E2()});function $U($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
9084
9321
  ${$}
9085
9322
  </div>
9086
9323
  <script>
@@ -9125,7 +9362,7 @@ ${E}
9125
9362
  }
9126
9363
  }
9127
9364
  })();
9128
- </script>`}function nW($,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=`
9365
+ </script>`}function ZU($,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=`
9129
9366
  <div class="stx-pwa-update-banner" style="
9130
9367
  position: fixed;
9131
9368
  bottom: 0;
@@ -9236,7 +9473,7 @@ else {
9236
9473
  // Also listen for custom event
9237
9474
  window.addEventListener('pwa-update-available', showUpdate);
9238
9475
  })();
9239
- </script>`}function oW($,Z){let Y=$.trim().length>0,X=`
9476
+ </script>`}function YU($,Z){let Y=$.trim().length>0,X=`
9240
9477
  <div class="stx-offline-indicator" style="
9241
9478
  position: fixed;
9242
9479
  top: 16px;
@@ -9297,7 +9534,7 @@ else {
9297
9534
  window.addEventListener('offline', updateStatus);
9298
9535
  updateStatus();
9299
9536
  })();
9300
- </script>`}function sW($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9537
+ </script>`}function XU($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9301
9538
  ${$}
9302
9539
  </div>
9303
9540
  <script>
@@ -9379,55 +9616,55 @@ catch (error) {
9379
9616
  init();
9380
9617
  }
9381
9618
  })();
9382
- </script>`}function IF($){return[...$,...g3]}var rW,aW,tW,eW,g3;var h3=k(()=>{rW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return iW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},aW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return nW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},tW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return oW($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},eW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return sW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},g3=[rW,aW,tW,eW]});function d3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var C4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function G$(){return!1}function K$(){return!G$()||process.env.STX_DEBUG==="true"}function v4(){return!1}import $U from"path";function x4(){return{...m3}}function f4($){if(!m3.showRelativePaths||!$)return $;let Z=m3.baseDir||process.cwd();try{let Y=$U.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var ZU,m3,g4,m1,h4;var d4=k(()=>{C4();ZU={showRelativePaths:!1,enableAutoRecovery:K$(),logRecoveryWarnings:!0},m3={...ZU};g4=class g4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=f4(this.filePath)}};m1=class m1 extends g4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};h4=class h4 extends g4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function D2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,j=J,_=G;if(!j&&K&&q!==void 0){let O=KU(K,q);j=O.line,_=O.column}let B=Q?f4(Q):void 0,H=X?d3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=XU(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=JU(L,K,q);break;case"text":default:F=YU(L,K,q);break}return{formatted:F,data:L}}function YU($,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(`
9383
- ${$.message}`),Z&&$.line){let J=QU(Z,$.line,2);if(J)X.push(`
9619
+ </script>`}function fL($){return[...$,...m3]}var JU,QU,GU,KU,m3;var u3=k(()=>{JU={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return $U($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},QU={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return ZU($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},GU={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return YU($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},KU={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return XU($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},m3=[JU,QU,GU,KU]});function l3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var v4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function K$(){return!1}function q$(){return!K$()||process.env.STX_DEBUG==="true"}function x4(){return!1}import qU from"path";function f4(){return{...p3}}function g4($){if(!p3.showRelativePaths||!$)return $;let Z=p3.baseDir||process.cwd();try{let Y=qU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var WU,p3,h4,m1,d4;var m4=k(()=>{v4();WU={showRelativePaths:!1,enableAutoRecovery:q$(),logRecoveryWarnings:!0},p3={...WU};h4=class h4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=g4(this.filePath)}};m1=class m1 extends h4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};d4=class d4 extends h4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function S2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,j=J,_=G;if(!j&&K&&q!==void 0){let O=HU(K,q);j=O.line,_=O.column}let B=Q?g4(Q):void 0,H=X?l3(X):void 0,F={type:Z,code:X,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},L;switch(z){case"html":L=zU(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=jU(F,K,q);break;case"text":default:L=UU(F,K,q);break}return{formatted:L,data:F}}function UU($,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(`
9620
+ ${$.message}`),Z&&$.line){let J=BU(Z,$.line,2);if(J)X.push(`
9384
9621
  ${J}`)}if($.snippet)X.push(`
9385
9622
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
9386
- Suggestion: ${$.suggestion}`);return X.join(" ")}function XU($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${I2($.message)}`;if($.suggestion)X+=` | Suggestion: ${I2($.suggestion)}`;return X+=" -->",X}function JU($,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(`
9623
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function zU($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${b2($.message)}`;if($.suggestion)X+=` | Suggestion: ${b2($.suggestion)}`;return X+=" -->",X}function jU($,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(`
9387
9624
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
9388
9625
 
9389
- ${$.message}`),Z&&$.line){let z=GU(Z,$.line,2);if(z)W.push(`
9626
+ ${$.message}`),Z&&$.line){let z=_U(Z,$.line,2);if(z)W.push(`
9390
9627
 
9391
9628
  \x1B[90mContext:\x1B[0m
9392
9629
  ${z}`)}if($.suggestion)W.push(`
9393
9630
 
9394
9631
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
9395
- ${"\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 QU($,Z,Y){let X=$.split(`
9632
+ ${"\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 BU($,Z,Y){let X=$.split(`
9396
9633
  `),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(`
9397
- `)}function GU($,Z,Y){let X=$.split(`
9634
+ `)}function _U($,Z,Y){let X=$.split(`
9398
9635
  `),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),j=U===Z-1,_=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${_}\x1B[90m${z}\x1B[0m | ${B}`)}return W.join(`
9399
- `)}function I2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function KU($,Z){let X=$.substring(0,Z).split(`
9400
- `);return{line:X.length,column:X[X.length-1].length}}function e($,Z,Y){return D2({type:$,message:Z,code:Y,format:"html"}).formatted}async function _5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var E2=k(()=>{C4();d4()});class l3{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(`
9636
+ `)}function b2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function HU($,Z){let X=$.substring(0,Z).split(`
9637
+ `);return{line:X.length,column:X[X.length-1].length}}function e($,Z,Y){return S2({type:$,message:Z,code:Y,format:"html"}).formatted}async function _5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var y2=k(()=>{v4();m4()});class i3{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(`
9401
9638
  `).slice(1).join(`
9402
9639
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
9403
9640
  `)}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($)}
9404
9641
  `;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(`
9405
9642
 
9406
- `),"utf-8")}}async flush(){await this.writeQueue}}var u3,a0,p3;var k2=k(()=>{d4();u3={isEnabled(){return x4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=x4();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+=`
9407
- @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(K$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};a0=new l3,p3={isDevelopment(){return K$()},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(`
9408
- `)}}});var b2=()=>{};var S2=k(()=>{C4();E2();k2();b2();d4()});var G1=k(()=>{S2()});function y2($,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,j=U.length>1?U[1]:"";if(j&&Z[j])W=Z[j];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(),j=U+1,_=(()=>{try{let B=V0(z,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return e("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(j),J.lastIndex=0}return Q}function P2($,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,j=(()=>{try{let _=V0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return e("StructuredData",B,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(z),Q.lastIndex=0}return X}function C2($,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 j=Q.substring(W).match(/^\s*\)/);if(!j)break;let _=W+j[0].length,B=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=V0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
9643
+ `),"utf-8")}}async flush(){await this.writeQueue}}var c3,a0,n3;var P2=k(()=>{m4();c3={isEnabled(){return f4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=f4();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+=`
9644
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(q$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};a0=new i3,n3={isDevelopment(){return q$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
9645
+ `)}}});var C2=()=>{};var v2=k(()=>{v4();y2();P2();C2();m4()});var G1=k(()=>{v2()});function x2($,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,j=U.length>1?U[1]:"";if(j&&Z[j])W=Z[j];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(),j=U+1,_=(()=>{try{let B=V0(z,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return e("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(j),J.lastIndex=0}return Q}function f2($,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,j=(()=>{try{let _=V0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return e("StructuredData",B,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(z),Q.lastIndex=0}return X}function g2($,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 L=Q[W];if(z){z=!1,W++;continue}if(L==="\\"&&U){z=!0,W++;continue}if(U){if(L===U)U=null;W++;continue}if(L==='"'||L==="'"||L==="`"){U=L,W++;continue}if(L==="{")q++;else if(L==="}")q--;W++}if(q!==0)break;let j=Q.substring(W).match(/^\s*\)/);if(!j)break;let _=W+j[0].length,B=Q.substring(K,W),H=Q.substring(G.index,_),F=((L)=>{try{let O=V0(L,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
9409
9646
  `,V+=`<meta name="title" content="${l(O.title)}">
9410
9647
  `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
9411
9648
  `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
9412
9649
  `}if(O.robots)V+=`<meta name="robots" content="${l(O.robots)}">
9413
9650
  `;if(O.canonical)V+=`<link rel="canonical" href="${l(O.canonical)}">
9414
9651
  `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${l(w.type||"website")}">
9415
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta property="og:title" content="${l(A)}">
9416
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta property="og:description" content="${l(A)}">
9417
- `}if(w.url||O.canonical){let A=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(A)}">
9652
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${l(R)}">
9653
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${l(R)}">
9654
+ `}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(R)}">
9418
9655
  `}if(w.image){if(V+=`<meta property="og:image" content="${l(w.image)}">
9419
9656
  `,w.imageAlt)V+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
9420
9657
  `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
9421
9658
  `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
9422
9659
  `}if(w.siteName)V+=`<meta property="og:site_name" content="${l(w.siteName)}">
9423
9660
  `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
9424
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(A)}">
9425
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(A)}">
9426
- `}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${l(A)}">
9661
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(R)}">
9662
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(R)}">
9663
+ `}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)}">
9427
9664
  `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
9428
9665
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
9429
9666
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
9430
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function v2($,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=`
9667
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(_),J.lastIndex=G.index+F.length}return Q}function h2($,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=`
9431
9668
  <!-- stx SEO Tags -->
9432
9669
  <meta name="title" content="${l(G)}">
9433
9670
  <meta name="description" content="${l(K)}">
@@ -9443,7 +9680,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
9443
9680
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
9444
9681
  <title>${l(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
9445
9682
  ${W}
9446
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var x2,f2;var c3=k(()=>{G1();_0();x2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},f2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return e("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return e("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import q$ from"path";function qU($,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 j=z[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)J=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.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 WU($){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)=>`
9683
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var d2,m2;var o3=k(()=>{G1();_0();d2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},m2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return e("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return e("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import W$ from"path";function OU($,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 j=z[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)J=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let H=j.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 FU($){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)=>`
9447
9684
  get ${z}() {
9448
9685
  return this.getAttribute('${z}') || '';
9449
9686
  }
@@ -9494,16 +9731,16 @@ ${U}
9494
9731
  }
9495
9732
 
9496
9733
  customElements.define('${Z}', ${G});
9497
- `}async function g2($,Z,Y,X){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[q$.join(q$.dirname(X),G,`${Q}.stx`),q$.join(process.cwd(),G,`${Q}.stx`),q$.join(q$.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await p(z)){q=await Bun.file(z).text();break}if(!q)return e("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=qU(q,Q);return`<script type="module">
9498
- ${WU(W)}
9499
- </script>`}var h2=k(()=>{G1();F0()});var d2={};s(d2,{timingPlugin:()=>_U,pluginManager:()=>UU,definePlugin:()=>m4,debugPlugin:()=>BU,createVariablesPlugin:()=>HU,createFilterPlugin:()=>jU,createDirectivePlugin:()=>zU,PluginManager:()=>i3});function m4($){return $}class i3{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 zU($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function jU($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function HU($){return m4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var UU,BU,_U;var m2=k(()=>{UU=new i3;BU=m4({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)}}),_U=m4({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 l2={};s(l2,{validateConfig:()=>wU,loadStxConfig:()=>O5,defineStxConfig:()=>VU,defaultConfig:()=>u1,config:()=>o3});import n3 from"fs";import k0 from"path";import{loadConfigWithResult as OU}from"bunfig";function LU($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=k0.join(process.cwd(),"resources","views"),Q=k0.join(process.cwd(),"resources","layouts");if(n3.existsSync(X)&&n3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=k0.join(process.cwd(),"resources","views","pages");if(n3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function FU($){if(k9($.stateDir),$.stateDir=v5(),$.cachePath=f5($.cachePath),$.build)$.build.cacheDir=f5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=f5($.media.cache.directory);if($.story)$.story.outDir=f5($.story.outDir)}async function O5($){if(!$){if(H5)return H5;if(u4)return u4}let Z=$?k0.resolve($):process.cwd(),Y=u2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await OU({name:"stx",alias:"ui",cwd:Z,defaultConfig:u1,verbose:!1})).config;FU(J);let G=LU(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!k0.isAbsolute(J.partialsDir))J.partialsDir=k0.join(K,J.partialsDir);if(J.componentsDir&&!k0.isAbsolute(J.componentsDir))J.componentsDir=k0.join(K,J.componentsDir);if(J.layoutsDir&&!k0.isAbsolute(J.layoutsDir))J.layoutsDir=k0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (m2(),d2)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],j=typeof U==="string"?{}:U[1]||{};try{let _,B;try{_=await import(z),B=k0.dirname(q0.resolve(z))}catch{let L=k0.resolve(process.cwd(),z);_=await import(L),B=k0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=k0.resolve(B,H.components);q.push(L)}if(H.pages){let L=k0.resolve(B,H.pages),F=j.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:B,config:J};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(u2.set(Z,X),!$)u4=X,X.then((Q)=>{H5=Q}).catch(()=>{});return X}function VU($){return $}function wU($){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 u1,H5=null,u2,u4=null,o3;var L5=k(()=>{N7();T7();M7();I7();G3();Z2();f3();h3();c3();k$();h2();u1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Z5,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:DZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:g2,hasEndTag:!1,description:"Include a web component in the template"},y9,P9,x2,f2,C9,x9,f9,v9,m9,p9,$2,x3,...g3],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}};u2=new Map;o3=new Proxy(u1,{get($,Z){if(H5&&Z in H5)return H5[Z];if(!u4)O5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as AU}from"bunfig";function p4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function r3($,Z){if(l1.has($))l1.delete($);else if(l1.size>=i2)l1.delete(l1.keys().next().value);l1.set($,Z)}function RU($){let Z=p4($);if(F5.has(Z))F5.delete(Z);else if(F5.size>=i2)F5.delete(F5.keys().next().value);return F5.set(Z,$),Z}async function NU($){if(!V1)return null;try{let Z=Bun.file(G0.join(V1,`cw-${p4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function TU($,Z){if(!V1)return;try{if(!fs.existsSync(V1))fs.mkdirSync(V1,{recursive:!0});await Bun.write(G0.join(V1,`cw-${p4($)}.css`),Z)}catch{}}async function c2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function MU(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function IU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function DU(){if(p2)return K1;p2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await c2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return K1=J,K1}let Z=await $(MU());if(Z)return K1=Z,K1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await c2(Q);if(J){if(K1=J,!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded`);return K1}}let X=await $(IU());if(X)return K1=X,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${L0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${L0.reset}`),console.warn(`${L0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${L0.reset}`),null}}async function EU($){try{if(!AU({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=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${L0.yellow}[Crosswind]${L0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function kU($){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 bU($,Z){try{let Y=await DU();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):kU($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!V1)V1=x5(Q,"cache");let J=[...X].sort().join(" "),G=`${s3||"default"}::${J}`,K=l1.get(G);if(K!==void 0)return r3(G,K),K;let q=await NU(G);if(q!==null)return r3(G,q),q;if(!l4){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (L5(),l2)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=G0.isAbsolute(R.css)?R.css:G0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=G0.isAbsolute(R.css.config)?R.css.config:G0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${L0.green}[Crosswind]${L0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l4=A||await EU(Q);try{s3=p4(JSON.stringify(l4??{}))}catch{s3="unhashable"}}let W=Y.defaultConfig||Y.config,U=l4||{},z=W.theme||{},_=(U.theme||{}).extend||{},B={...z};if(Object.keys(_).length>0)B.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
9500
- `);for(let[A,N]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let v=w[b].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let h=b,f="";while(h<w.length){if(f+=w[h],w[h].includes("}"))break;h++}let m=f.match(/\{([^}]+)\}/);if(m)if(E)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
9501
- .${A} { ${T.join(" ")} }`;if(M.length)O+=`
9502
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return r3(G,O),TU(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function n2($,Z,Y=!1){let X=await bU($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${RU(X)}.css">`:`<style data-crosswind="generated">
9734
+ `}async function u2($,Z,Y,X){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[W$.join(W$.dirname(X),G,`${Q}.stx`),W$.join(process.cwd(),G,`${Q}.stx`),W$.join(W$.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 e("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=OU(q,Q);return`<script type="module">
9735
+ ${FU(W)}
9736
+ </script>`}var l2=k(()=>{G1();L0()});var p2={};s(p2,{timingPlugin:()=>AU,pluginManager:()=>LU,definePlugin:()=>u4,debugPlugin:()=>RU,createVariablesPlugin:()=>NU,createFilterPlugin:()=>wU,createDirectivePlugin:()=>VU,PluginManager:()=>s3});function u4($){return $}class s3{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 VU($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function wU($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function NU($){return u4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var LU,RU,AU;var c2=k(()=>{LU=new s3;RU=u4({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)}}),AU=u4({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 n2={};s(n2,{validateConfig:()=>EU,loadStxConfig:()=>O5,defineStxConfig:()=>DU,defaultConfig:()=>u1,config:()=>a3});import r3 from"fs";import k0 from"path";import{loadConfigWithResult as MU}from"bunfig";function TU($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=k0.join(process.cwd(),"resources","views"),Q=k0.join(process.cwd(),"resources","layouts");if(r3.existsSync(X)&&r3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=k0.join(process.cwd(),"resources","views","pages");if(r3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function IU($){if(P9($.stateDir),$.stateDir=x5(),$.cachePath=g5($.cachePath),$.build)$.build.cacheDir=g5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=g5($.media.cache.directory);if($.story)$.story.outDir=g5($.story.outDir)}async function O5($){if(!$){if(H5)return H5;if(l4)return l4}let Z=$?k0.resolve($):process.cwd(),Y=i2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await MU({name:"stx",alias:"ui",cwd:Z,defaultConfig:u1,verbose:!1})).config;IU(J);let G=TU(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!k0.isAbsolute(J.partialsDir))J.partialsDir=k0.join(K,J.partialsDir);if(J.componentsDir&&!k0.isAbsolute(J.componentsDir))J.componentsDir=k0.join(K,J.componentsDir);if(J.layoutsDir&&!k0.isAbsolute(J.layoutsDir))J.layoutsDir=k0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (c2(),p2)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],j=typeof U==="string"?{}:U[1]||{};try{let _,B;try{_=await import(z),B=k0.dirname(q0.resolve(z))}catch{let F=k0.resolve(process.cwd(),z);_=await import(F),B=k0.dirname(F)}let H=_.default||_;if(K.register(H,J),H.components){let F=k0.resolve(B,H.components);q.push(F)}if(H.pages){let F=k0.resolve(B,H.pages),L=j.path||"/";W.push({dir:F,prefix:L})}if(H.setup){let F={addDirective:(L)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(L)},addRoute:(L,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[L]=O},addMiddleware:(L)=>{J.middleware=J.middleware||[],J.middleware.push(L)},pluginDir:B,config:J};await H.setup(j,F)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(i2.set(Z,X),!$)l4=X,X.then((Q)=>{H5=Q}).catch(()=>{});return X}function DU($){return $}function EU($){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 u1,H5=null,i2,l4=null,a3;var F5=k(()=>{I7();D7();E7();k7();W3();Q2();d3();u3();o3();b$();l2();u1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Z5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:SZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:u2,hasEndTag:!1,description:"Include a web component in the template"},x9,f9,d2,m2,g9,d9,m9,h9,c9,o9,J2,h3,...m3],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}};i2=new Map;a3=new Proxy(u1,{get($,Z){if(H5&&Z in H5)return H5[Z];if(!l4)O5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as kU}from"bunfig";function c4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function e3($,Z){if(l1.has($))l1.delete($);else if(l1.size>=r2)l1.delete(l1.keys().next().value);l1.set($,Z)}function bU($){let Z=c4($);if(L5.has(Z))L5.delete(Z);else if(L5.size>=r2)L5.delete(L5.keys().next().value);return L5.set(Z,$),Z}async function SU($){if(!V1)return null;try{let Z=Bun.file(G0.join(V1,`cw-${c4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function yU($,Z){if(!V1)return;try{if(!fs.existsSync(V1))fs.mkdirSync(V1,{recursive:!0});await Bun.write(G0.join(V1,`cw-${c4($)}.css`),Z)}catch{}}async function s2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function PU(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function CU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function vU(){if(o2)return K1;o2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await s2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return K1=J,K1}let Z=await $(PU());if(Z)return K1=Z,K1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await s2(Q);if(J){if(K1=J,!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} CSS engine loaded`);return K1}}let X=await $(CU());if(X)return K1=X,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${F0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${F0.reset}`),console.warn(`${F0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${F0.reset}`),null}}async function xU($){try{if(!kU({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=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${F0.yellow}[Crosswind]${F0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function fU($){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 gU($,Z){try{let Y=await vU();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):fU($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!V1)V1=f5(Q,"cache");let J=[...X].sort().join(" "),G=`${t3||"default"}::${J}`,K=l1.get(G);if(K!==void 0)return e3(G,K),K;let q=await SU(G);if(q!==null)return e3(G,q),q;if(!p4){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (F5(),n2)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=G0.isAbsolute(N.css)?N.css:G0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${F0.green}[Crosswind]${F0.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=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${F0.green}[Crosswind]${F0.reset} Using inline CSS config from stx.config.ts`)}}catch{}p4=R||await xU(Q);try{t3=c4(JSON.stringify(p4??{}))}catch{t3="unhashable"}}let W=Y.defaultConfig||Y.config,U=p4||{},z=W.theme||{},_=(U.theme||{}).extend||{},B={...z};if(Object.keys(_).length>0)B.extend=_;let H=[...W.safelist||[],...U.safelist||[]],F={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},L=new Y.CSSGenerator(F);for(let R of H)L.generate(R);for(let R of X)L.generate(R);let O=L.toCSS(!0,!1),V=F.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)L.generate(T)}O=L.toCSS(!0,!1);let w=O.split(`
9737
+ `);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 E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let v=w[b].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let h=b,f="";while(h<w.length){if(f+=w[h],w[h].includes("}"))break;h++}let m=f.match(/\{([^}]+)\}/);if(m)if(E)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
9738
+ .${R} { ${T.join(" ")} }`;if(M.length)O+=`
9739
+ @media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return e3(G,O),yU(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function a2($,Z,Y=!1){let X=await gU($,Z);if(!X)return $;let Q=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${bU(X)}.css">`:`<style data-crosswind="generated">
9503
9740
  ${X}
9504
9741
  </style>`,J=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(J.test($)){let G=!1;return $.replace(J,()=>{if(G)return"";return G=!0,Q})}if($.includes("</head>"))return $.replace("</head>",`${Q}
9505
9742
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
9506
- ${Q}`);return Q+$}var K1=null,p2=!1,l4=null,i2=256,l1,F5,V1=null,s3=null;var o2=k(()=>{k$();b9();l1=new Map,F5=new Map});function s2(){return`
9743
+ ${Q}`);return Q+$}var K1=null,o2=!1,p4=null,r2=256,l1,L5,V1=null,t3=null;var t2=k(()=>{b$();C9();l1=new Map,L5=new Map});function e2(){return`
9507
9744
  // STX Lifecycle Runtime
9508
9745
  (function() {
9509
9746
  if (typeof window === 'undefined') return;
@@ -9848,7 +10085,7 @@ else {
9848
10085
 
9849
10086
  console.log('[stx] Lifecycle runtime initialized');
9850
10087
  })();
9851
- `}function a3($){return Symbol($)}var uV,lV,pV;var r2=k(()=>{uV=a3("theme"),lV=a3("router"),pV=a3("i18n")});import*as t2 from"crypto";function a2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function SU(){return`stx-${t2.randomBytes(4).toString("hex")}`}function yU($){return/\$\w+\./.test($)}function PU($){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,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(yU(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),a2(A).forEach((R)=>Y.add(R)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let B=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=SU(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:a2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function CU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
10088
+ `}function $6($){return Symbol($)}var eV,$w,Zw;var $Y=k(()=>{eV=$6("theme"),$w=$6("router"),Zw=$6("i18n")});import*as YY from"crypto";function ZY($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function hU(){return`stx-${YY.randomBytes(4).toString("hex")}`}function dU($){return/\$\w+\./.test($)}function mU($){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,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let F of _){let L=F[0],O=F[1],V=F[2];if(dU(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:L,originalAttr:O}),ZY(R).forEach((N)=>Y.add(N)),O==="text")z=z.replace(L,"");else if(O==="class")z=z.replace(L,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(L,"");else z=z.replace(L,`${O}=""`)}}}if(!U)return J;let B=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=hU(),z=` id="${H}"${z}`;for(let F of W)Z.push({elementId:H,attribute:F.attr,expression:F.expr,stores:ZY(F.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function uU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9852
10089
  <script>
9853
10090
  (function() {
9854
10091
  'use strict';
@@ -10006,10 +10243,10 @@ else {
10006
10243
  }
10007
10244
  })();
10008
10245
  </script>
10009
- `,X}function e2($){let{html:Z,bindings:Y,stores:X}=PU($);if(Y.length===0)return $;let Q=CU(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var $Y=()=>{};function vU($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return xU(Z);case"google-analytics":return fU(Z);case"plausible":return gU(Z);case"self-hosted":return hU(Z);case"custom":return dU(Z);default:return""}}function xU($){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="${h0(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="${h0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
10246
+ `,X}function XY($){let{html:Z,bindings:Y,stores:X}=mU($);if(Y.length===0)return $;let Q=uU(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var JY=()=>{};function lU($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return pU(Z);case"google-analytics":return cU(Z);case"plausible":return iU(Z);case"self-hosted":return nU(Z);case"custom":return oU(Z);default:return""}}function pU($){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="${h0(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="${h0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
10010
10247
  <!-- Fathom Analytics -->
10011
10248
  <script src="${h0(Y)}" ${Q.join(" ")}${X}></script>
10012
- `}function fU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=h0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
10249
+ `}function cU($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=h0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
10013
10250
  <!-- Google Analytics -->
10014
10251
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
10015
10252
  <script>
@@ -10019,10 +10256,10 @@ else {
10019
10256
  gtag('config', '${Y}');
10020
10257
  ${X}
10021
10258
  </script>
10022
- `}function gU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${h0(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`
10259
+ `}function iU($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${h0(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`
10023
10260
  <!-- Plausible Analytics -->
10024
10261
  <script defer data-domain="${h0(Z.domain)}" src="${h0(Q)}"></script>
10025
- `}function hU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=h0(Z.siteId),X=h0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
10262
+ `}function nU($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=h0(Z.siteId),X=h0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
10026
10263
  d.addEventListener('click',function(e){
10027
10264
  var a=e.target.closest('a');
10028
10265
  if(a&&a.hostname!==location.hostname){
@@ -10055,7 +10292,7 @@ else {
10055
10292
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
10056
10293
  })();
10057
10294
  </script>
10058
- `}function dU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
10295
+ `}function oU($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
10059
10296
  <!-- Custom Analytics -->
10060
10297
  <script>
10061
10298
  ${Z.inlineScript}
@@ -10063,7 +10300,7 @@ ${Z.inlineScript}
10063
10300
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${h0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${h0(Q)}="${h0(J)}"`);return`
10064
10301
  <!-- Custom Analytics -->
10065
10302
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${h0(Z.scriptUrl)}" defer></script>
10066
- `}function ZY($,Z){let Y=vU(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 h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var YY=()=>{};function QY($){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(mU.has(X))Z.systemKeys.push(X);else if(X in GY)Z.mouse=X;else if(X in JY||/^[a-z]$/.test(X))Z.keys.push(JY[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 KY($){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=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!XY.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:QY(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!XY.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:QY(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function uU($){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=GY[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 lU($,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 pU($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=uU($),Q=lU($.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`
10303
+ `}function QY($,Z){let Y=lU(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 h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var GY=()=>{};function WY($){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(sU.has(X))Z.systemKeys.push(X);else if(X in UY)Z.mouse=X;else if(X in qY||/^[a-z]$/.test(X))Z.keys.push(qY[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 zY($){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=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,F]=_,L=H.split("."),O=L[0];if(!KY.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:F,modifiers:WY(L.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,F]=_,L=H.split("."),O=L[0];if(!KY.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:F,modifiers:WY(L.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function rU($){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=UY[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 aU($,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 tU($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=rU($),Q=aU($.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`
10067
10304
  (function() {
10068
10305
  var $el = document.getElementById('${Y}');
10069
10306
  if (!$el) return;
@@ -10117,7 +10354,7 @@ else {
10117
10354
  __stx_runHandler('${K}', $event, $el);
10118
10355
  }
10119
10356
  }${G});
10120
- })();`}function cU($){if($.length===0)return"";return`
10357
+ })();`}function eU($){if($.length===0)return"";return`
10121
10358
  <script data-stx-events>
10122
10359
  (function() {
10123
10360
  'use strict';
@@ -10165,11 +10402,11 @@ else {
10165
10402
  }
10166
10403
 
10167
10404
  // Event listeners
10168
- ${$.flatMap((Y)=>Y.events).map(pU).join(`
10405
+ ${$.flatMap((Y)=>Y.events).map(tU).join(`
10169
10406
  `)}
10170
10407
  })();
10171
- </script>`}function iU($){let Z=KY($);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 qY($,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}=iU($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=KY($);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 j of W.events)j.elementId=z[1]}for(let z of W.events){let j=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(B,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=cU(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10172
- `+J.slice(K);else J+=G;return J}var XY,JY,mU,GY;var WY=k(()=>{XY=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"]),JY={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"},mU=new Set(["ctrl","alt","shift","meta"]),GY={left:0,middle:1,right:2}});function c4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function UY($,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 oU($){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=UY(G,"x-data");if(!q)continue;let W=`__stx_scope_${jY++}`,U=UY(G,"x-init"),z=sU($,J,K+Q.length),j=$.slice(K,z.endIndex),_=rU(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function sU($,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 rU($){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=aU(J);Z.set(G,K)}return Z}function aU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${nU++}`}function tU(){return`
10408
+ </script>`}function $z($){let Z=zY($);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 jY($,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}=$z($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=zY($);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 j of W.events)j.elementId=z[1]}for(let z of W.events){let j=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(B,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=eU(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10409
+ `+J.slice(K);else J+=G;return J}var KY,qY,sU,UY;var BY=k(()=>{KY=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"]),qY={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"},sU=new Set(["ctrl","alt","shift","meta"]),UY={left:0,middle:1,right:2}});function i4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _Y($,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 Yz($){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=_Y(G,"x-data");if(!q)continue;let W=`__stx_scope_${OY++}`,U=_Y(G,"x-init"),z=Xz($,J,K+Q.length),j=$.slice(K,z.endIndex),_=Jz(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function Xz($,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 Jz($){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=Qz(J);Z.set(G,K)}return Z}function Qz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Zz++}`}function Gz(){return`
10173
10410
  // STX Reactive Runtime - x-cloak and transition CSS
10174
10411
  (function() {
10175
10412
  var style = document.createElement('style');
@@ -10376,7 +10613,7 @@ window.__stx_reactive = (function() {
10376
10613
 
10377
10614
  return { initScope: initScope, reactive: reactive };
10378
10615
  })();
10379
- `}function zY($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=p0(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=p0(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 eU($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=zY(X.stateExpr,Z),G=X.initExpr?zY(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10616
+ `}function HY($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=p0(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=p0(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 Kz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=HY(X.stateExpr,Z),G=X.initExpr?HY(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10380
10617
  (function() {
10381
10618
  var scopeEl = document.querySelector('${X.selector}');
10382
10619
  if (!scopeEl) return;
@@ -10385,16 +10622,16 @@ window.__stx_reactive = (function() {
10385
10622
  })();`}).join(`
10386
10623
  `);return`
10387
10624
  <script data-stx-scoped data-stx-reactive>
10388
- ${tU()}
10625
+ ${Gz()}
10389
10626
  ${Y}
10390
- </script>`}function BY($,Z,Y){if(jY=0,!Zz($))return $;let X=oU($);if(X.length===0)return $;let Q=$z($,X),J=eU(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10391
- `+Q.slice(G);else Q+=J;return Q}function $z($,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*["']${c4(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*["']${c4(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*"${c4(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*'${c4(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 Zz($){return/x-data\s*=\s*["']/.test($)}var jY=0,nU=0;var _Y=k(()=>{e0()});import Yz from"fs";import t3 from"path";import{createHighlighter as Xz}from"ts-syntax-highlighter";async function Jz($,Z={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let X=(await Yz.promises.stat($)).mtime.getTime();if(Z.cache&&e3.has($)){let z=e3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=i9(Q),K=Z.markdown||o3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=g5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Qz(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)e3.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:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Qz($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!i4)try{i4=await Xz({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,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!i4.getSupportedLanguages().includes(j))return K;return(await i4.highlight(z,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,j=await Q(q,W,U,z);J=J.replace(q,j)}return J}async function HY($,Z,Y="",X={}){return await Gz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!t3.isAbsolute(K))U=t3.resolve(t3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);z[A]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:_}=await Jz(U,X),B={...Z,..._,...z},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return W0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function Gz($,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 e3,i4=null;var OY=k(()=>{L5();F0();e3=new Map});function w1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var LY=k(()=>{_0()});function Kz($,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=p7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(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 j;if(z.value&&J0(z.value))j=Q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=$0(z.value,Z);if(q===j){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=e("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function p1($,Z,Y){let X=$;X=Kz(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=L1(X,K+7);if(!q)break;let W=q.endPos,U=x1(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),j=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${z}@endif`;X=X.substring(0,K)+B+X.substring(U+10),J=!0}}X=Z6(X,Z,Y),X=Y6(X,Z,Y),X=$6(X,Z);let Q=()=>{let J=$$(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=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=e(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=e("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function FY($){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 $6($,Z){let Y=$;function X(K,q,W,U){let z=1,j=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&z>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,j=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;j=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=z.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,F)=>L.pos-F.pos);for(let L of B)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,j=Y.slice(W+5),_=FY(j);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let B=X(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?w1(`auth?.check && auth?.user?.[${U}]`,Z):w1("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(B+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,j=Y.slice(W+6),_=FY(j);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let B=X(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,B),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?w1(`!auth?.check || !auth?.user?.[${U}]`,Z):w1("!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(B+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=w1(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 j=z.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,v)=>b.pos-v.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=[],E=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:F.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let h=F.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:F.slice(E,v.pos)},E=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:F.length;I.push({content:F.slice(E,r),ability:f.ability,type:f.type,id:f.id}),E=r}}else E=v.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function Z6($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=J.match(z);if(!j||j.index===void 0)break;let _=j.index,B=L1(J,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=x1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=B.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";J=J.substring(0,_)+R+J.substring(L+`@${K}`.length),U=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=w1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=w1(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 Y6($,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"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(B);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,w=O,A=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),y=z.exec(B),S=D?D.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+D[0].length;else if(b<1/0){if(V--,V===0){A=b;break}w=b+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let D=N.indexOf("@",M);if(D===-1)break;let y=N.substring(D);if(j.test(y)){T++,M=D+1;continue}if(_.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){R=D;break}M=D+1}let I;if(R!==-1){let D=N.slice(0,R),y=N.slice(R+5);I=W?D:y}else I=W?N:"";let E=`@${q}`.length;B=B.substring(0,F)+I+B.substring(A+E),H=!0}return B}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 n4=k(()=>{LY();G1();c$();_0()});function wY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function o4($,Z){if(!$)return Z?.nonceGenerator?.()??wY();let Y=VY.get($);if(!Y)Y=Z?.nonceGenerator?.()??wY(),VY.set($,Y);return Y}function qz($,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 AY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${qz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function RY($,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?o4(Y,Z):void 0,Q=AY(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10392
- ${Q}`)}function NY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function TY($,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?o4(Z,J):void 0;return AY(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return o4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=o4(Z,J);return Q}var VY;var MY=k(()=>{VY=new WeakMap});import Wz from"crypto";function zz($=Uz){let Z=Wz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return X6=Z,Z}function jz(){if(!X6)zz();return X6}function Bz($=IY){let Z=jz();return`<input type="hidden" name="${$}" value="${Z}">`}function DY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return Bz(X||IY)})}var Uz=40,IY="_token",X6=null;var EY=()=>{};async function kY($,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 _z(Q,J,Z,Y,X);else Q=await Hz(Q,J,Z,Y,X)}return Q}async function _z($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=K5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],j=U.exec(W);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let F=B?bY(B):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,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:_,processed:e("CustomDirective",`Error in @${J}${B?`(${B})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}j=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];W=W.replace(B,H)}return W}async function Hz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=K5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,B=""]=U,H=U.index||0;try{let L=bY(B),F=await G("",L,Y,X);W.push({original:_,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:_,processed:e("CustomDirective",`Error in @${J}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=K5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:B})}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:_,processed:e("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:H}=W[_];K=K.replace(B,H)}return K}function bY($){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 SY=k(()=>{G1();q5()});function c1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Lz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(c1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(c1(Y.key,"appearance.key"),c1(Y.attribute,"appearance.attribute"),c1(Y.default,"appearance.default"),c1(X.key,"colorMode.key"),c1(X.attribute,"colorMode.attribute"),c1(X.default,"colorMode.default"),!PY.test(Y.key)||!PY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!yY.test(Y.attribute)||!yY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Oz.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function Fz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Vz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Fz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function wz($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function CY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=wz(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=$0(`(${K})`,Z),W=Vz(Lz(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var yY,PY,Oz;var vY=k(()=>{_0();yY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,PY=/^[A-Za-z_$][\w$]*$/,Oz=new Set(["light","dark","system"])});import Az from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function s4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function Rz(){return Az.randomUUID()}function r4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=Rz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(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="${A0(J)}">`;return X}),Y}function gY($,Z,Y=fY){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||"",j=A1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${A0(B)}" action="${A0(z)}"${j?` ${j}`:""}>`;if(H+=`
10393
- ${r4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
10394
- ${r4(`@method('${_}')`,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||"",j=A1(W),_=W$(U,Z),B=_!==void 0&&_!==null?_:z||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=U$(U,Z),O=j.match(/class=['"]([^'"]+)['"]/i),V=s4(O?O[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(L)}" name="${A0(U)}" value="${A0(B)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=A1(G),W=W$(J,Z)||K.trim(),U=U$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=s4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(J)}" class="${j}"${_?` ${_}`:""}>${A0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=A1(G),W=W$(J,Z),U=U$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=s4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=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="${A0(J)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=A1(K),W=W$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((B)=>String(B)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(J)}" value="${A0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=A1(K),W=W$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(J)}" value="${A0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=A1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=U$(J,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=s4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${A0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${A0(W)}"`);if(U)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=A1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function hY($,Z,Y=fY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(U$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return xY(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 xY(Q,Z)}let q=K.trim();if(J0(q)){let W=$0(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 U$($,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 xY($,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 W$($,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 A1($){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 fY;var dY=k(()=>{_0();fY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import G6 from"path";async function Nz(){if(z$!==void 0)return z$;try{z$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{z$=null}return z$}function Tz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Mz($,Z){if({...W6,...Z.i18n}.cache&&K6[$]){let Q=K6[$],J=Z.i18n?.cacheMaxAge??0;if(!Tz(Q,J))return Q.translations}if(j$[$]?.state==="loading")return j$[$].promise;J6[$]="loading";let X=q6($,Z).then((Q)=>{return J6[$]="loaded",delete j$[$],Q}).catch((Q)=>{throw J6[$]="error",j$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return j$[$]={promise:X,state:"loading"},X}async function q6($,Z){let Y={...W6,...Z.i18n},X=G6.isAbsolute(Y.translationsDir)?Y.translationsDir:G6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await Nz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:bz(Y.format)}):await Iz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return q6(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)K6[$]={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 q6(Y.defaultLocale,Z);return{}}}async function Iz($,Z,Y){let X=G6.join(Y,`${$}${Dz(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 Ez(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function Dz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Ez($){let Z={},Y=$.split(`
10395
- `),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(),j=U.trim();if(j==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=kz(j)}}return Z}function kz($){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 bz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Sz($,Z){return Mz($,Z)}function yz($,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 Pz($,Z={}){return lY($,Z)}function lY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=Cz($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=vz(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 Cz($,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 vz($,Z){let Y=xz($);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 fz(Q,Y.slice(2).join(","),Z);case"select":return hz(Q,Y.slice(2).join(","));case"selectordinal":return dz(Q,Y.slice(2).join(","));case"number":return uz(Q,Y[2]?.trim());case"date":return lz(Q,Y[2]?.trim());case"time":return pz(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function xz($){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 fz($,Z,Y){let X=Number($)||0,Q=U6(Z),J=`=${X}`;if(Q[J])return Q6(Q[J],X,Y);let G=gz(X);if(Q[G])return Q6(Q[G],X,Y);if(Q.other)return Q6(Q.other,X,Y);return String(X)}function Q6($,Z,Y){let X=$.replace(/#/g,String(Z));return lY(X,Y)}function gz($){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 hz($,Z){let Y=String($||""),X=U6(Z);if(X[Y])return X[Y];return X.other||String($)}function dz($,Z){let Y=Number($)||0,X=U6(Z),Q=mz(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 mz($){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 U6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function uz($,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 lz($,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 pz($,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 cz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function mY($,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(cz(G))return Pz(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=yz(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 pY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...W6,...X.i18n},K=await Sz(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await uY(Q,J,async(U,z,j,_,B)=>{try{let H={};if(j)try{let F=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return V0(j,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 mY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await uY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return V0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return mY(z,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),Q}async function uY($,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 z$,W6,K6,j$,J6;var cY=k(()=>{G1();_0();W6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},K6={},j$={},J6={}});var B6={};s(B6,{streamingSuspenseDirective:()=>oY,streamToResponse:()=>Xj,streamTemplateSimple:()=>ez,streamTemplate:()=>nz,renderStreamingPage:()=>sz,registerStreamingDirectives:()=>Zj,processStreamDirectives:()=>az,processSectionDirectives:()=>Yj,islandDirective:()=>sY,generateHydrationRuntime:()=>Jj,extractStreamBoundaries:()=>tz,createStreamRenderer:()=>$j,buildSuspenseResolveScript:()=>j6,SUSPENSE_RESOLVER_RUNTIME:()=>nY});import a4 from"path";function iz($){let Z=[],Y=0,X;iY.lastIndex=0;while((X=iY.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 nz($,Z={},Y={}){let X={...u1,...Y,streaming:{...z6,...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:a4.dirname($)};if(q.trim())await v1(q,U,$);let z=iz(W),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",H=new RegExp(i1.source,"g");if(!(B!=="manual"&&H.test(W))){let F=await w0(W,U,$,X,j);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(i1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await w0(R,U,$,X,j);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await w0(A.content,U,$,X,j);J.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await w0(A,U,$,X,j);J.enqueue(N)}}}}else{let B=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await w0(L.content,U,$,X,j);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;">
10627
+ </script>`}function FY($,Z,Y){if(OY=0,!Wz($))return $;let X=Yz($);if(X.length===0)return $;let Q=qz($,X),J=Kz(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10628
+ `+Q.slice(G);else Q+=J;return Q}function qz($,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*["']${i4(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*["']${i4(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*"${i4(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*'${i4(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 Wz($){return/x-data\s*=\s*["']/.test($)}var OY=0,Zz=0;var LY=k(()=>{e0()});import Uz from"fs";import Z6 from"path";import{createHighlighter as zz}from"ts-syntax-highlighter";async function jz($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await Uz.promises.stat($)).mtime.getTime();if(Z.cache&&Y6.has($)){let z=Y6.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=r9(Q),K=Z.markdown||a3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=h5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Bz(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)Y6.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:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Bz($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!n4)try{n4=await zz({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,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!n4.getSupportedLanguages().includes(j))return K;return(await n4.highlight(z,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,j=await Q(q,W,U,z);J=J.replace(q,j)}return J}async function VY($,Z,Y="",X={}){return await _z($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!Z6.isAbsolute(K))U=Z6.resolve(Z6.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(L){if(X.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:j,data:_}=await jz(U,X),B={...Z,..._,...z},H=j,F=/\{\{([^}]+)\}\}/g;return H=H.replace(F,(L,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):L}),H}catch(U){let z=U instanceof Error?U.message:String(U);return W0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function _z($,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 Y6,n4=null;var wY=k(()=>{F5();L0();Y6=new Map});function w1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var RY=k(()=>{_0()});function Hz($,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=n7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(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 j;if(z.value&&J0(z.value))j=Q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=$0(z.value,Z);if(q===j){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=e("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function p1($,Z,Y){let X=$;X=Hz(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=F1(X,K+7);if(!q)break;let W=q.endPos,U=x1(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),j=q.expression,_=-1;{let H=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=F.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=L.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){_=R.pos;break}}let B;if(_!==-1){let H=z.slice(0,_),F=z.slice(_+5);B=`@if (${j})${F}@else ${H}@endif`}else B=`@if (!(${j}))${z}@endif`;X=X.substring(0,K)+B+X.substring(U+10),J=!0}}X=J6(X,Z,Y),X=Q6(X,Z,Y),X=X6(X,Z);let Q=()=>{let J=Z$(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=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=e(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=e("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function AY($){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 X6($,Z){let Y=$;function X(K,q,W,U){let z=1,j=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&z>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),F=B.exec(K),L=H?H.index:1/0,O=F?F.index:1/0;if(L<O)z++,j=L+H[0].length;else if(O<1/0){if(z--,z===0)return O;j=O+F[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=z.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")U++;else if(F.type==="close")U--;else if(F.type==="else"&&U===0)return F.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,j=Y.slice(W+5),_=AY(j);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let B=X(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,B),F=Q(H,"auth","endauth"),L;if(!Z.auth)L=!1;else L=U?w1(`auth?.check && auth?.user?.[${U}]`,Z):w1("auth?.check",Z);let O;if(F!==-1){let V=H.slice(0,F),w=H.slice(F+5);O=L?V:w}else O=L?H:"";Y=Y.substring(0,W)+O+Y.substring(B+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,j=Y.slice(W+6),_=AY(j);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let B=X(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,B),F=Q(H,"guest","endguest"),L;if(!Z.auth)L=!0;else L=U?w1(`!auth?.check || !auth?.user?.[${U}]`,Z):w1("!auth?.check",Z);let O;if(F!==-1){let V=H.slice(0,F),w=H.slice(F+5);O=L?V:w}else O=L?H:"";Y=Y.substring(0,W)+O+Y.substring(B+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=w1(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 j=z.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,F=X(Y,K,q,H);if(F===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let L=Y.slice(H,F),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(L))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((b,v)=>b.pos-v.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=[],E=0;for(let b=0;b<O.length;b++){let v=O[b];if(I.push({content:L.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let h=L.slice(v.pos+`@${W}`.length),f=G(h);if(f){I[I.length-1]={content:L.slice(E,v.pos)},E=v.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],r=m?m.pos:L.length;I.push({content:L.slice(E,r),ability:f.ability,type:f.type,id:f.id}),E=r}}else E=v.pos+5}if(E<L.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:L.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:L.slice(E)})}let D=J(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let b=!1;for(let v=1;v<I.length;v++){let h=I[v];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let f=J(h.ability,h.type,h.id);if(K==="can"?f:!f){S=h.content,b=!0;break}}}if(!b&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,j)+S+Y.substring(F+`@${q}`.length),U=!0}}return Y}function J6($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=J.match(z);if(!j||j.index===void 0)break;let _=j.index,B=F1(J,_+`@${G}`.length);if(!B)break;let H=B.endPos,F=x1(J,G,K,H);if(F===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let L=J.slice(H,F),O=B.expression,V=-1,w=0,R=0;while(R<L.length){let A=L.indexOf("@",R);if(A===-1)break;let N=L.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=L.slice(0,V),M=L.slice(V+5);N=A?T:M}else N=A?L:"";J=J.substring(0,_)+N+J.substring(F+`@${K}`.length),U=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=e(W,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(F+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=w1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=w1(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 Q6($,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"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),B=G,H=!0;while(H){H=!1,U.lastIndex=0;let F=U.exec(B);if(!F)break;let L=F.index,O=L+F[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,w=O,R=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),y=z.exec(B),S=D?D.index:1/0,b=y?y.index:1/0;if(S<b)V++,w=S+D[0].length;else if(b<1/0){if(V--,V===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let A=B.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let D=A.indexOf("@",M);if(D===-1)break;let y=A.substring(D);if(j.test(y)){T++,M=D+1;continue}if(_.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=D;break}M=D+1}let I;if(N!==-1){let D=A.slice(0,N),y=A.slice(N+5);I=W?D:y}else I=W?A:"";let E=`@${q}`.length;B=B.substring(0,L)+I+B.substring(R+E),H=!0}return B}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 o4=k(()=>{RY();G1();i$();_0()});function MY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function s4($,Z){if(!$)return Z?.nonceGenerator?.()??MY();let Y=NY.get($);if(!Y)Y=Z?.nonceGenerator?.()??MY(),NY.set($,Y);return Y}function Oz($,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 TY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Oz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function IY($,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?s4(Y,Z):void 0,Q=TY(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10629
+ ${Q}`)}function DY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function EY($,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?s4(Z,J):void 0;return TY(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return s4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=s4(Z,J);return Q}var NY;var kY=k(()=>{NY=new WeakMap});import Fz from"crypto";function Vz($=Lz){let Z=Fz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return G6=Z,Z}function wz(){if(!G6)Vz();return G6}function Rz($=bY){let Z=wz();return`<input type="hidden" name="${$}" value="${Z}">`}function SY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return Rz(X||bY)})}var Lz=40,bY="_token",G6=null;var yY=()=>{};async function PY($,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 Az(Q,J,Z,Y,X);else Q=await Nz(Q,J,Z,Y,X)}return Q}async function Az($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=K5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],j=U.exec(W);while(j!==null){let[_,B="",H=""]=j,F=j.index||0;try{let L=B?CY(B):[],O=H.trim(),V=await G(O,L,Y,X);z.push({original:_,processed:V,startIndex:F})}catch(L){let O=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);z.push({original:_,processed:e("CustomDirective",`Error in @${J}${B?`(${B})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:F})}j=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];W=W.replace(B,H)}return W}async function Nz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=K5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,B=""]=U,H=U.index||0;try{let F=CY(B),L=await G("",F,Y,X);W.push({original:_,processed:L,startIndex:H})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);W.push({original:_,processed:e("CustomDirective",`Error in @${J}(${B}): ${L}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=K5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:B})}catch(H){let F=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:e("CustomDirective",`Error in @${J}: ${F}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:B,processed:H}=W[_];K=K.replace(B,H)}return K}function CY($){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 vY=k(()=>{G1();q5()});function c1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Tz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(c1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(c1(Y.key,"appearance.key"),c1(Y.attribute,"appearance.attribute"),c1(Y.default,"appearance.default"),c1(X.key,"colorMode.key"),c1(X.attribute,"colorMode.attribute"),c1(X.default,"colorMode.default"),!fY.test(Y.key)||!fY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!xY.test(Y.attribute)||!xY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Mz.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function Iz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Dz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Iz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function Ez($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function gY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=Ez(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=$0(`(${K})`,Z),W=Dz(Tz(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var xY,fY,Mz;var hY=k(()=>{_0();xY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,fY=/^[A-Za-z_$][\w$]*$/,Mz=new Set(["light","dark","system"])});import kz from"crypto";function R0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function bz(){return kz.randomUUID()}function a4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=bz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${R0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${R0(J)}">`;return X}),Y}function uY($,Z,Y=mY){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||"",j=R1(W),_=U.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${R0(B)}" action="${R0(z)}"${j?` ${j}`:""}>`;if(H+=`
10630
+ ${a4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
10631
+ ${a4(`@method('${_}')`,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||"",j=R1(W),_=U$(U,Z),B=_!==void 0&&_!==null?_:z||"",H=j.match(/type=['"]([^'"]+)['"]/i),F=H?H[1]:"text",L=z$(U,Z),O=j.match(/class=['"]([^'"]+)['"]/i),V=r4(O?O[1]:"",Y.input,L,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${R0(F)}" name="${R0(U)}" value="${R0(B)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=R1(G),W=U$(J,Z)||K.trim(),U=z$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=r4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${R0(J)}" class="${j}"${_?` ${_}`:""}>${R0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=R1(G),W=U$(J,Z),U=z$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),j=r4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,F,L)=>{if((Array.isArray(W)?W.some((V)=>String(V)===L):String(W)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return H});return`<select name="${R0(J)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=R1(K),W=U$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((B)=>String(B)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${R0(J)}" value="${R0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=R1(K),W=U$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${R0(J)}" value="${R0(G)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=R1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=z$(J,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=r4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${R0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${R0(W)}"`);if(U)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=R1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${R0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function lY($,Z,Y=mY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(z$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return dY(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 dY(Q,Z)}let q=K.trim();if(J0(q)){let W=$0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function z$($,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 dY($,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 U$($,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 R1($){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 mY;var pY=k(()=>{_0();mY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import W6 from"path";async function Sz(){if(j$!==void 0)return j$;try{j$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{j$=null}return j$}function yz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Pz($,Z){if({...j6,...Z.i18n}.cache&&U6[$]){let Q=U6[$],J=Z.i18n?.cacheMaxAge??0;if(!yz(Q,J))return Q.translations}if(B$[$]?.state==="loading")return B$[$].promise;K6[$]="loading";let X=z6($,Z).then((Q)=>{return K6[$]="loaded",delete B$[$],Q}).catch((Q)=>{throw K6[$]="error",B$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return B$[$]={promise:X,state:"loading"},X}async function z6($,Z){let Y={...j6,...Z.i18n},X=W6.isAbsolute(Y.translationsDir)?Y.translationsDir:W6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await Sz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:gz(Y.format)}):await Cz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return z6(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)U6[$]={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 z6(Y.defaultLocale,Z);return{}}}async function Cz($,Z,Y){let X=W6.join(Y,`${$}${vz(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 xz(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function vz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function xz($){let Z={},Y=$.split(`
10632
+ `),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(),j=U.trim();if(j==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=fz(j)}}return Z}function fz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function gz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function hz($,Z){return Pz($,Z)}function dz($,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 mz($,Z={}){return nY($,Z)}function nY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=uz($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=lz(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 uz($,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 lz($,Z){let Y=pz($);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 cz(Q,Y.slice(2).join(","),Z);case"select":return nz(Q,Y.slice(2).join(","));case"selectordinal":return oz(Q,Y.slice(2).join(","));case"number":return rz(Q,Y[2]?.trim());case"date":return az(Q,Y[2]?.trim());case"time":return tz(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function pz($){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 cz($,Z,Y){let X=Number($)||0,Q=B6(Z),J=`=${X}`;if(Q[J])return q6(Q[J],X,Y);let G=iz(X);if(Q[G])return q6(Q[G],X,Y);if(Q.other)return q6(Q.other,X,Y);return String(X)}function q6($,Z,Y){let X=$.replace(/#/g,String(Z));return nY(X,Y)}function iz($){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 nz($,Z){let Y=String($||""),X=B6(Z);if(X[Y])return X[Y];return X.other||String($)}function oz($,Z){let Y=Number($)||0,X=B6(Z),Q=sz(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 sz($){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 B6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function rz($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function az($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let 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 tz($,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 ez($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function cY($,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(ez(G))return mz(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=dz(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 oY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...j6,...X.i18n},K=await hz(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await iY(Q,J,async(U,z,j,_,B)=>{try{let H={};if(j)try{let L=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return V0(j,Z)}];for(let O of L)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(L){if(X.debug)console.error("Error parsing parameters for @translate directive:",L)}return cY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await iY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let F=`{"data":${j}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return V0(j,Z)}];for(let F of H)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return cY(z,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),Q}async function iY($,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 j$,j6,U6,B$,K6;var sY=k(()=>{G1();_0();j6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},U6={},B$={},K6={}});var O6={};s(O6,{streamingSuspenseDirective:()=>tY,streamToResponse:()=>zj,streamTemplateSimple:()=>Kj,streamTemplate:()=>Zj,renderStreamingPage:()=>Xj,registerStreamingDirectives:()=>Wj,processStreamDirectives:()=>Qj,processSectionDirectives:()=>Uj,islandDirective:()=>eY,generateHydrationRuntime:()=>jj,extractStreamBoundaries:()=>Gj,createStreamRenderer:()=>qj,buildSuspenseResolveScript:()=>H6,SUSPENSE_RESOLVER_RUNTIME:()=>aY});import t4 from"path";function $j($){let Z=[],Y=0,X;rY.lastIndex=0;while((X=rY.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 Zj($,Z={},Y={}){let X={...u1,...Y,streaming:{..._6,...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:t4.dirname($)};if(q.trim())await v1(q,U,$);let z=$j(W),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",H=new RegExp(i1.source,"g");if(!(B!=="manual"&&H.test(W))){let L=await w0(W,U,$,X,j);for(let O=0;O<L.length;O+=Q)J.enqueue(L.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let L=[],O=new RegExp(i1.source,"g"),V;while((V=O.exec(W))!==null)L.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of L){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await w0(N,U,$,X,j);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await w0(R.content,U,$,X,j);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 w0(R,U,$,X,j);J.enqueue(A)}}}}else{let B=new Map;for(let F of z)if(F.type==="shell"||F.type==="content"){let L=await w0(F.content,U,$,X,j);J.enqueue(L)}else if(F.type==="suspense"&&F.name){let L=`stx-suspense-${F.name}`;J.enqueue(`<div id="${L}" data-suspense="${F.name}" style="display:contents;">
10396
10633
  <template data-suspense-fallback>Loading...</template>
10397
- </div>`),B.set(L.name,w0(L.content,U,$,X,j))}J.enqueue(`
10634
+ </div>`),B.set(F.name,w0(F.content,U,$,X,j))}J.enqueue(`
10398
10635
  <script>
10399
10636
  (function() {
10400
10637
  window.__stxSuspense = window.__stxSuspense || {
@@ -10410,13 +10647,13 @@ ${Q}`)}function NY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
10410
10647
  }
10411
10648
  };
10412
10649
  })();
10413
- </script>`);let H=Array.from(B.entries()).map(async([L,F])=>{J.enqueue(await j6(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function j6($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
10650
+ </script>`);let H=Array.from(B.entries()).map(async([F,L])=>{J.enqueue(await H6(F,L))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function H6($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
10414
10651
  <script>
10415
10652
  window.__stxSuspense.resolve('${$}', \`${X}\`);
10416
10653
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
10417
10654
  <script>
10418
10655
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${s0(X)}</div>');
10419
- </script>`}}function oz($,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 sz($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(nY),await Promise.all(Z.map(async(J)=>{let G=oz(J.render(),X,J.id);Q.enqueue(await j6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function az($,Z){return $.replace(rz,(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 tz($){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 ez($,Z={},Y={}){let X={...u1,...Y,streaming:{...z6,...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:a4.dirname($)};if(q.trim())await v1(q,U,$);let z=new Set,j=X.streaming?.strategy||"auto",_=new RegExp(i1.source,"g");if(!(j!=="manual"&&_.test(W))){let H=await w0(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(i1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await w0(A,U,$,X,z);J.enqueue(N)}}let w=await w0(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 w0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function $j($,Z={}){let Y={...u1,...Z,streaming:{...z6,...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;i1.lastIndex=0;while((W=i1.exec(G))!==null){let j=W[1],_=W[2];q[j]=_}let U=G.replace(i1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:a4.dirname($)};return await v1(J,_,$),w0(U,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let B={..._,__filename:$,__dirname:a4.dirname($)};await v1(J,B,$);let H=new Set;return await w0(q[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return W0("Expression",H,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function Zj($={}){let Z=[];if($.streaming?.enabled)Z.push(oY);if($.hydration?.enabled)Z.push(sY);return Z}async function Yj($,Z,Y,X={}){return $}function Xj($,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 Jj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10656
+ </script>`}}function Yj($,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 Xj($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(aY),await Promise.all(Z.map(async(J)=>{let G=Yj(J.render(),X,J.id);Q.enqueue(await H6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function Qj($,Z){return $.replace(Jj,(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 Gj($){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 Kj($,Z={},Y={}){let X={...u1,...Y,streaming:{..._6,...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:t4.dirname($)};if(q.trim())await v1(q,U,$);let z=new Set,j=X.streaming?.strategy||"auto",_=new RegExp(i1.source,"g");if(!(j!=="manual"&&_.test(W))){let H=await w0(W,U,$,X,z);for(let F=0;F<H.length;F+=Q)J.enqueue(H.slice(F,F+Q))}else{let H=[],F=new RegExp(i1.source,"g"),L;while((L=F.exec(W))!==null)H.push({name:L[1],content:L[2],start:L.index,end:L.index+L[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 w0(R,U,$,X,z);J.enqueue(A)}}let w=await w0(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 w0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function qj($,Z={}){let Y={...u1,...Z,streaming:{..._6,...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;i1.lastIndex=0;while((W=i1.exec(G))!==null){let j=W[1],_=W[2];q[j]=_}let U=G.replace(i1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:t4.dirname($)};return await v1(J,_,$),w0(U,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let B={..._,__filename:$,__dirname:t4.dirname($)};await v1(J,B,$);let H=new Set;return await w0(q[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return W0("Expression",H,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function Wj($={}){let Z=[];if($.streaming?.enabled)Z.push(tY);if($.hydration?.enabled)Z.push(eY);return Z}async function Uj($,Z,Y,X={}){return $}function zj($,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 jj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10420
10657
  `);if(Z==="loader")return`
10421
10658
  (function() {
10422
10659
  window.__stx = window.__stx || {};
@@ -10558,7 +10795,7 @@ else {
10558
10795
  else {
10559
10796
  stx.hydrate();
10560
10797
  }
10561
- })();`}var z6,i1,iY,nY=`
10798
+ })();`}var _6,i1,rY,aY=`
10562
10799
  <script>
10563
10800
  (function(){
10564
10801
  window.__stxSuspense = window.__stxSuspense || {
@@ -10578,25 +10815,25 @@ else {
10578
10815
  }
10579
10816
  };
10580
10817
  })();
10581
- </script>`,rz,oY,sY;var _6=k(()=>{L5();e0();U4();F0();z6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},i1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,iY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;rz=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;oY={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} -->`}},sY={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}">
10818
+ </script>`,Jj,tY,eY;var F6=k(()=>{F5();e0();z4();L0();_6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},i1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,rY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Jj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;tY={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} -->`}},eY={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}">
10582
10819
  ${W}
10583
10820
  <script type="application/json" data-island-props="${G}">
10584
10821
  ${q?`{${q}}`:"{}"}
10585
10822
  </script>
10586
- </div>`}}});var tY={};s(tY,{warnUnbalancedTags:()=>H6,findUnbalancedTags:()=>aY});function V5($){return $.replace(/[^\n]/g," ")}function aY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,V5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,V5).replace(/<!--[\s\S]*?-->/g,V5).replace(/\{\{\{[\s\S]*?\}\}\}/g,V5).replace(/\{\{[\s\S]*?\}\}/g,V5).replace(/\{!![\s\S]*?!!\}/g,V5),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(Qj.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(`
10587
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(Gj.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 H6($,Z){let Y;try{Y=aY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(rY.has(X))return;rY.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 Qj,Gj,rY;var O6=k(()=>{Qj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Gj=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);rY=new Set});import c0 from"path";import L6 from"fs";function eY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function $X($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class ZX{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 _=[Q,Q.toLowerCase(),eY(Q),$X(Q)];for(let B of _)if(J.has(B))return J.get(B)}let G=[...new Set([`${Q}.stx`,`${eY(Q)}.stx`,`${$X(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=c0.resolve(c0.dirname(Z),`${Q}.stx`);if(await p(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(c0.join(c0.dirname(W),"components"));if(q)K.push(q);let U=c0.join(c0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[c0.resolve(z,"src/components"),c0.resolve(z,"components"),c0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=c0.join(_,B);if(await p(H))return H}try{if(!L6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=L6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=c0.join(_,L.name);for(let O of G){let V=c0.join(F,O);if(await p(V))return V}}}catch{}}return null}}var v0;var F6=k(()=>{F0();v0=new ZX});function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(b0(J));continue}Y.push(`${b0(J)}="${b0(Q)}"`)}return Y}var t4=()=>{};function B$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kj($){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 V6;var w6=k(()=>{t4();V6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=Kj($),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="${B$(X.value)}"`);else q.push(`href="${B$(X.value)}"`);if(Q)q.push(`class="${B$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${B$(J)}"`),q.push(`data-stx-exact-active-class="${B$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...w5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function R6($,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 YX($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=qj[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 N6($,Z,Y,X){return Z.map((Q)=>`${_$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function Wj($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${_$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function _$($,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 Uj($,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 qj,A6,T6;var M6=k(()=>{t4();qj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},A6=[320,640,768,1024,1280,1536,1920];T6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=S0($,"src")||"",Q=S0($,"alt")||"",J=S0($,"width"),G=S0($,"height"),K=S0($,"sizes"),q=S0($,"srcset"),W=S0($,"densities"),U=S0($,"format"),z=S0($,"placeholder"),j=S0($,"placeholderColor")||"#e5e7eb",_=S0($,"provider"),B=S0($,"class")||S0($,"className")||"",H=S0($,"style")||"",L=S0($,"quality"),F=R6($,"lazy",!0),O=R6($,"preload",!1),V=R6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=N6(X,A6,_,U),R=YX(K);else if(!N&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=Wj(X,S,w,_,U)}else if(K)R=YX(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=Uj(w||16,A||9,j);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${T0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=_$(X,w,A,_,U),I=[];if(I.push(`src="${T0(M)}"`),I.push(`alt="${T0(Q)}"`),J)I.push(`width="${T0(J)}"`);if(G)I.push(`height="${T0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${T0(B)}"`);if(T.length>0)I.push(`style="${T0(T.join(";"))}"`);if(N)I.push(`srcset="${T0(N)}"`);if(R)I.push(`sizes="${T0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...w5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${T0(M)}"${b?` type="${b}"`:""}${N?` imagesrcset="${T0(N)}"`:""}${R?` imagesizes="${T0(R)}"`:""} />
10588
- `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=_$(X,w,A,_,"avif"),v=N?N6(X,A6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${T0(v)}"${R?` sizes="${T0(R)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=_$(X,w,A,_,"webp"),v=N?N6(X,A6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${T0(v)}"${R?` sizes="${T0(R)}"`:""} />`)}return`${y}<picture>
10823
+ </div>`}}});var YX={};s(YX,{warnUnbalancedTags:()=>L6,findUnbalancedTags:()=>ZX});function V5($){return $.replace(/[^\n]/g," ")}function ZX($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,V5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,V5).replace(/<!--[\s\S]*?-->/g,V5).replace(/\{\{\{[\s\S]*?\}\}\}/g,V5).replace(/\{\{[\s\S]*?\}\}/g,V5).replace(/\{!![\s\S]*?!!\}/g,V5),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(Bj.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(`
10824
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(_j.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 L6($,Z){let Y;try{Y=ZX($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if($X.has(X))return;$X.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 Bj,_j,$X;var V6=k(()=>{Bj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_j=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);$X=new Set});import c0 from"path";import w6 from"fs";function XX($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function JX($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class QX{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 _=[Q,Q.toLowerCase(),XX(Q),JX(Q)];for(let B of _)if(J.has(B))return J.get(B)}let G=[...new Set([`${Q}.stx`,`${XX(Q)}.stx`,`${JX(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=c0.resolve(c0.dirname(Z),`${Q}.stx`);if(await c(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(c0.join(c0.dirname(W),"components"));if(q)K.push(q);let U=c0.join(c0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[c0.resolve(z,"src/components"),c0.resolve(z,"components"),c0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=c0.join(_,B);if(await c(H))return H}try{if(!w6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=w6.readdirSync(_,{withFileTypes:!0});for(let F of H)if(F.isDirectory()){let L=c0.join(_,F.name);for(let O of G){let V=c0.join(L,O);if(await c(V))return V}}}catch{}}return null}}var v0;var R6=k(()=>{L0();v0=new QX});function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(b0(J));continue}Y.push(`${b0(J)}="${b0(Q)}"`)}return Y}var e4=()=>{};function _$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hj($){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 A6;var N6=k(()=>{e4();A6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=Hj($),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="${_$(X.value)}"`);else q.push(`href="${_$(X.value)}"`);if(Q)q.push(`class="${_$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_$(J)}"`),q.push(`data-stx-exact-active-class="${_$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...w5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function M0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function T6($,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 GX($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=Oj[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 I6($,Z,Y,X){return Z.map((Q)=>`${H$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function Fj($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${H$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function H$($,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 Lj($,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 Oj,M6,D6;var E6=k(()=>{e4();Oj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M6=[320,640,768,1024,1280,1536,1920];D6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=S0($,"src")||"",Q=S0($,"alt")||"",J=S0($,"width"),G=S0($,"height"),K=S0($,"sizes"),q=S0($,"srcset"),W=S0($,"densities"),U=S0($,"format"),z=S0($,"placeholder"),j=S0($,"placeholderColor")||"#e5e7eb",_=S0($,"provider"),B=S0($,"class")||S0($,"className")||"",H=S0($,"style")||"",F=S0($,"quality"),L=T6($,"lazy",!0),O=T6($,"preload",!1),V=T6($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=I6(X,M6,_,U),N=GX(K);else if(!A&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Fj(X,S,w,_,U)}else if(K)N=GX(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 S=Lj(w||16,R||9,j);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${M0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=H$(X,w,R,_,U),I=[];if(I.push(`src="${M0(M)}"`),I.push(`alt="${M0(Q)}"`),J)I.push(`width="${M0(J)}"`);if(G)I.push(`height="${M0(G)}"`);if(L)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${M0(B)}"`);if(T.length>0)I.push(`style="${M0(T.join(";"))}"`);if(A)I.push(`srcset="${M0(A)}"`);if(N)I.push(`sizes="${M0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...w5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${M0(M)}"${b?` type="${b}"`:""}${A?` imagesrcset="${M0(A)}"`:""}${N?` imagesizes="${M0(N)}"`:""} />
10825
+ `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=H$(X,w,R,_,"avif"),v=A?I6(X,M6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${M0(v)}"${N?` sizes="${M0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=H$(X,w,R,_,"webp"),v=A?I6(X,M6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${M0(v)}"${N?` sizes="${M0(N)}"`:""} />`)}return`${y}<picture>
10589
10826
  ${S.join(`
10590
10827
  `)}
10591
10828
  ${D}
10592
- </picture>`}return`${y}${D}`}}});function H$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var XX="/images/safe-image-default.svg",zj,I6;var D6=k(()=>{t4();zj=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${XX}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,I6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=A5($,"src")||"",Q=A5($,"alt")||"",J=A5($,"fallback")||XX,G=A5($,"class")||A5($,"className")||"",K=A5($,"fallbackClassName")||"",q=[];if(q.push(`src="${H$(X)}"`),q.push(`alt="${H$(Q)}"`),G)q.push(`class="${H$(G)}"`);if(q.push(`data-fallback="${H$(J)}"`),K)q.push(`data-fallback-class="${H$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...w5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${zj}${U}`;return U}}});function E6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function O$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function e4($,Z,Y){let X=O$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var k6;var b6=k(()=>{k6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=E6(O$($,"color")||"#6366f1"),Q=E6(O$($,"initialColor")||O$($,"initial-color")||""),J=E6(O$($,"height")||"3px"),G=e4($,"duration",2000),K=e4($,"throttle",200),q=e4($,"zIndex",999999)||e4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10829
+ </picture>`}return`${y}${D}`}}});function O$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var KX="/images/safe-image-default.svg",Vj,k6;var b6=k(()=>{e4();Vj=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${KX}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,k6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=R5($,"src")||"",Q=R5($,"alt")||"",J=R5($,"fallback")||KX,G=R5($,"class")||R5($,"className")||"",K=R5($,"fallbackClassName")||"",q=[];if(q.push(`src="${O$(X)}"`),q.push(`alt="${O$(Q)}"`),G)q.push(`class="${O$(G)}"`);if(q.push(`data-fallback="${O$(J)}"`),K)q.push(`data-fallback-class="${O$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...w5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Vj}${U}`;return U}}});function S6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function F$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function $7($,Z,Y){let X=F$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var y6;var P6=k(()=>{y6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=S6(F$($,"color")||"#6366f1"),Q=S6(F$($,"initialColor")||F$($,"initial-color")||""),J=S6(F$($,"height")||"3px"),G=$7($,"duration",2000),K=$7($,"throttle",200),q=$7($,"zIndex",999999)||$7($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10593
10830
  <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">
10594
10831
  <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>
10595
10832
  </div>
10596
10833
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
10597
10834
  <script>
10598
10835
  (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()})})();
10599
- </script>`}}});function QX($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function jj($,Z,Y){let X=QX($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var JX,S6;var y6=k(()=>{JX={"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%)"},S6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=b0(QX($,"position")||"top-right"),Q=jj($,"max",5),J=JX[X]||JX["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>
10836
+ </script>`}}});function WX($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function wj($,Z,Y){let X=WX($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var qX,C6;var v6=k(()=>{qX={"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%)"},C6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=b0(WX($,"position")||"top-right"),Q=wj($,"max",5),J=qX[X]||qX["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>
10600
10837
  <style>
10601
10838
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
10602
10839
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -10604,7 +10841,7 @@ ${D}
10604
10841
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
10605
10842
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
10606
10843
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
10607
- </style>`}}});function $7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var GX,P6;var C6=k(()=>{GX={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)"},P6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=$7($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=b0(X),J=$7($,"size")||"md",G=$7($,"closeOnBackdrop")!=="false",K=$7($,"closeOnEscape")!=="false",q=GX[J]||GX.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">
10844
+ </style>`}}});function Z7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var UX,x6;var f6=k(()=>{UX={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)"},x6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=Z7($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=b0(X),J=Z7($,"size")||"md",G=Z7($,"closeOnBackdrop")!=="false",K=Z7($,"closeOnEscape")!=="false",q=UX[J]||UX.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">
10608
10845
  <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)">
10609
10846
  <div style="padding:1.5rem">${Z}</div>
10610
10847
  </div>
@@ -10613,7 +10850,7 @@ ${D}
10613
10850
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
10614
10851
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
10615
10852
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
10616
- </style>`}}});function R5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var KX,v6;var x6=k(()=>{KX={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},v6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=R5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=b0(X),J=R5($,"side")||"right",G=R5($,"size")||"md",K=R5($,"closeOnBackdrop")!=="false",q=R5($,"closeOnEscape")!=="false",W=R5($,"overlay")!=="false",U=KX[G]||KX.md,z=J==="left",j=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",B=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">
10853
+ </style>`}}});function A5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var zX,g6;var h6=k(()=>{zX={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},g6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=A5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=b0(X),J=A5($,"side")||"right",G=A5($,"size")||"md",K=A5($,"closeOnBackdrop")!=="false",q=A5($,"closeOnEscape")!=="false",W=A5($,"overlay")!=="false",U=zX[G]||zX.md,z=J==="left",j=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",B=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">
10617
10854
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${U};max-width:100vw;transform:${_};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
10618
10855
  <div style="padding:1.5rem">${Z}</div>
10619
10856
  </div>
@@ -10622,18 +10859,18 @@ ${D}
10622
10859
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
10623
10860
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
10624
10861
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
10625
- </style>`}}});import{existsSync as Bj,readFileSync as _j}from"fs";function Hj($){if(qX.has($))return;qX.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Oj($){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(Bj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function Lj($){if(Z7.has($))return Z7.get($);let Z=Oj($);if(!Z)return Hj($),null;try{let Y=JSON.parse(_j(Z,"utf8"));return Z7.set($,Y.icons),Y.icons}catch{return null}}function N5($,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 Z7,qX,f6;var g6=k(()=>{Z7=new Map,qX=new Set;f6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=N5($,"name")??N5($,"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=b0(N5($,"size")||"24"),K=b0(N5($,"color")||"currentColor"),q=b0(N5($,"class")||""),W=b0(N5($,"style")||""),U=Z7.get(Q)??Lj(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let j=z.width||24,_=z.height||24,B=`0 0 ${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="${B}" fill="none"${L}${F}>${H}</svg>`}}});function WX($,...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 UX($,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 h6;var d6=k(()=>{h6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=UX(Z,"fallback"),Q=X.rest,J=UX(Q,"error"),G=J.rest,K=X.region??WX($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??WX($,"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 Y7($,...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 m6;var u6=k(()=>{m6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(Y7($,"name")||"v").replace(/["'<>]/g,""),Q=(Y7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=Y7($,"class"),G=Y7($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function zX(){v0.registerBuiltin(V6),v0.registerBuiltin(T6),v0.registerBuiltin(I6),v0.registerBuiltin(k6),v0.registerBuiltin(S6),v0.registerBuiltin(P6),v0.registerBuiltin(v6),v0.registerBuiltin(f6),v0.registerBuiltin(h6),v0.registerBuiltin(m6)}var jX=k(()=>{w6();M6();D6();b6();y6();C6();x6();g6();d6();u6();F6();w6();M6();D6();b6();y6();C6();x6();g6();d6();u6()});function X7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function BX($,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,j=-1,_=!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]===">"){j=W+2,_=!0;break}if(H===">"){j=W+1;break}W++}if(j===-1){Q=J+1;continue}let B=$.slice(z,_?j-2:j-1).trim();if(_)X.push({fullMatch:$.slice(J,j),tagName:q,attributes:B,content:"",startIndex:J,endIndex:j,isSelfClosing:!0}),Q=j;else{let H=`<${q}`,L=`</${q}>`,F=1,O=j,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
10626
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=j;continue}let w=$.slice(j,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:B,content:w,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function _X($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function HX($,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 OX=k(()=>{_0();F0();y1()});var NX={};s(NX,{processESImports:()=>AX,processComponents:()=>Q7});import J7 from"fs";import d0 from"path";function Vj($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=HX(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===l6?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!J0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let j=Object.keys(Z),B=Q0(z,j)(...Object.values(Z));if(B===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=B}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(J0(z)){let _=Q0(z,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(q))!==null)try{let B=_[1];if(!J0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let L=Q0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,z)}continue}G(W,q===l6?"true":_X(q))}return X}function wj($){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]=l6}return Z}function FX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Aj($){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(v0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Rj($){let Z=VX.get($);if(Z)return Z;let Y=new Map,X=[d0.join($,"src"),d0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=J7.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=d0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return VX.set($,Y),Y}function Nj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=d0.join(Y,"node_modules",$);try{if(J7.statSync(X).isDirectory())return X}catch{}let Q=d0.dirname(Y);if(Q===Y)return null;Y=Q}}async function AX($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,B,H=[];while((B=j.exec(z))!==null){let[L,F,O,V]=B,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=d0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(J7.statSync(M).isFile())A=M}catch{try{if(J7.statSync(T).isDirectory())w=T}catch{}}}}else w=Nj(V,G);if(!w&&!A)continue;let N=!1,R=(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&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?Rj(w):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)R(E,D),N=!0}}if(N)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function Tj($,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((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[d0.resolve(d0.dirname(Y),`${j}.stx`),d0.resolve(d0.dirname(Y),j),d0.resolve(X.componentsDir||"components",`${j}.stx`),d0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function Mj($,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,j=1,_=z+1;while(_<J.length&&j>0){if(J[_]==="(")j++;else if(J[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=J.substring(z+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=B.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=V0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,H),`[Error parsing component props: ${D}]`);continue}let N="",R=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await g1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(R),q.lastIndex=0}return J}async function Ij($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=B1(J);return J=q.output,J=await j(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await j(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await j(J,/[a-z][a-z0-9]*/,!1,Fj),J=n5(J,q.scripts),J;async function j(_,B,H,L){if(!_)return _;let F=_,O=BX(F,B,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?X7(w.tagName):w.tagName,N=wj(w.attributes),R=Vj(N,Z,X),T=v0.getBuiltin(w.tagName),M=T?await W4(A,G,Z,Y,X):!1;if(T&&!M){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(R,w.content,y);if(Object.keys(R.clientReactive).length>0)S=wX(S,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([v,h])=>`${v}="${FX(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await W4(A,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(R.static))I[y]=S;for(let[y,S]of Object.entries(R.serverDynamic))I[y]=S;let D=await g1(A,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(R.clientReactive).length>0)D=wX(D,R.clientReactive);if(Object.keys(R.events).length>0){let y=RX(D);if(y){let S=Object.entries(R.events).map(([v,h])=>`${v}="${FX(h)}"`).join(" "),b=Object.keys(R.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function wX($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>X7(U)).join(" "),G=$,K=Q.length>0?RX(G):null;if(K){let U=Q.map(([j,_])=>`:${X7(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function RX($){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 Q7($,Z,Y,X,Q){if(!LX)zX(),LX=!0;let J=await AX($,Z,Y,X,Q);J=await Tj(J,Z,Y,X,Q),J=await Mj(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=t0(J,i5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await Ij(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=Aj(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 LX=!1,l6="\x00stx-boolean-attribute",Fj,VX;var p6=k(()=>{F6();jX();OX();y1();F0();_0();Fj=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"]);VX=new Map});var bX={};s(bX,{processLoops:()=>c6});function kj($,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,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=U.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let F=V0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${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 G7($,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 B=X[W];if(z){z=!1,W++;continue}if(B==="\\"&&U){z=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),_=Y(j);X=X.substring(0,G)+_+X.substring(W+1)}return X}function bj($,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);C$(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 Sj($,Z){let Y=$;return Y=G7(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($0(J,Z));return G?K7:""}catch{return""}}),Y=G7(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($0(J,Z));return G?q7:""}catch{return""}}),Y}function yj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,K7),Z=Z.replace(/@continue(?!\()/g,q7),Z}function TX($){let Z=$.includes(K7),Y=Z?$.substring(0,$.indexOf(K7)):$;return{hasBreak:Z,content:Y}}function MX($){let Z=$.includes(q7),Y=Z?$.substring(0,$.indexOf(q7)):$;return{hasContinue:Z,content:Y}}function DX($){let Z=$;return Z=G7(Z,"@break",(Y)=>{let X=Y.trim();if(!v$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=G7(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 Pj($){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,j=K.length-1,_=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)_=K[B].depth,z=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,_=z+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(z+1,B),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=B+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let S=N.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,y=S+1;else if(b.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function IX($,Z){let Y=$;while(!0){let X=Pj(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=$0(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),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(J)}}return Y}function c6($,Z,Y,X){let Q=$;Q=IX(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,j=U.index+U[0].length-1,_=1,B=j+1,H=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=q.substring(j+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let D=q.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:D}}R=E.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=z;try{let F=B.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=$0(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 E=e("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+E+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??Ej,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1],T=!0;else R=A}else R=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(R.startsWith("[")&&R.endsWith("]")){let f=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(D))f.forEach((m,r)=>{if(m)S[m]=D[r]});else S[R]=D}else S[R]=D;if(N)if(!T&&V&&Array.isArray(D)&&D.length===2)S[N]=D[0],S[R]=D[1];else S[N]=E;let b=Sj(L,S),v=MX(b);if(v.hasContinue){M+=v.content;continue}let h=TX(b);if(h.hasBreak){M+=h.content;break}if(b=IX(b,S),b=G(b,S),b=p1(b,S,Y),b=yj(b),h=TX(b),h.hasBreak){M+=h.content;break}if(v=MX(b),v.hasContinue){M+=v.content;continue}b=_1(b,S,Y),b=bj(b,S),b=kj(b,S),M+=b}U=U.substring(0,j)+M+U.substring(_)}catch(F){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=kX(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??Dj;return Q=xj(Q,Z,K),Q}function EX($){return v$($)}function kX($,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=C0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,j=p$(Q.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!EX(U)){let H=e("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(B),J=!0;continue}try{let H=Cj(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=vj({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(B),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=DX(V);let A=Function(...F,`
10862
+ </style>`}}});import{existsSync as Rj,readFileSync as Aj}from"fs";function Nj($){if(jX.has($))return;jX.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Mj($){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(Rj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function Tj($){if(Y7.has($))return Y7.get($);let Z=Mj($);if(!Z)return Nj($),null;try{let Y=JSON.parse(Aj(Z,"utf8"));return Y7.set($,Y.icons),Y.icons}catch{return null}}function N5($,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 Y7,jX,d6;var m6=k(()=>{Y7=new Map,jX=new Set;d6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=N5($,"name")??N5($,"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=b0(N5($,"size")||"24"),K=b0(N5($,"color")||"currentColor"),q=b0(N5($,"class")||""),W=b0(N5($,"style")||""),U=Y7.get(Q)??Tj(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let j=z.width||24,_=z.height||24,B=`0 0 ${j} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${H}</svg>`}}});function BX($,...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 _X($,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 u6;var l6=k(()=>{u6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=_X(Z,"fallback"),Q=X.rest,J=_X(Q,"error"),G=J.rest,K=X.region??BX($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??BX($,"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 X7($,...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 p6;var c6=k(()=>{p6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(X7($,"name")||"v").replace(/["'<>]/g,""),Q=(X7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=X7($,"class"),G=X7($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function HX(){v0.registerBuiltin(A6),v0.registerBuiltin(D6),v0.registerBuiltin(k6),v0.registerBuiltin(y6),v0.registerBuiltin(C6),v0.registerBuiltin(x6),v0.registerBuiltin(g6),v0.registerBuiltin(d6),v0.registerBuiltin(u6),v0.registerBuiltin(p6)}var OX=k(()=>{N6();E6();b6();P6();v6();f6();h6();m6();l6();c6();R6();N6();E6();b6();P6();v6();f6();h6();m6();l6();c6()});function J7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function FX($,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,j=-1,_=!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]===">"){j=W+2,_=!0;break}if(H===">"){j=W+1;break}W++}if(j===-1){Q=J+1;continue}let B=$.slice(z,_?j-2:j-1).trim();if(_)X.push({fullMatch:$.slice(J,j),tagName:q,attributes:B,content:"",startIndex:J,endIndex:j,isSelfClosing:!0}),Q=j;else{let H=`<${q}`,F=`</${q}>`,L=1,O=j,V=-1;while(L>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(F,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
10863
+ `||T==="\t")L++;O=A+H.length}else{if(L--,L===0){V=N;break}O=N+F.length}}if(V===-1){Q=j;continue}let w=$.slice(j,V),R=V+F.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:B,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function LX($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function VX($,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 wX=k(()=>{_0();L0();y1()});var DX={};s(DX,{processESImports:()=>TX,processComponents:()=>G7});import Q7 from"fs";import d0 from"path";function Dj($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let U=J(W.slice(6));X.serverDynamic[U]=VX(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===i6?U:q;if(U==="if"||U==="for"||U==="show"){X.clientReactive[U]=z;continue}try{if(!J0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let j=Object.keys(Z),B=Q0(z,j)(...Object.values(Z));if(B===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!F.has(O)&&!j.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=B}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(J0(z)){let _=Q0(z,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(q))!==null)try{let B=_[1];if(!J0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let F=Q0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(F??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,z)}continue}G(W,q===i6?"true":LX(q))}return X}function Ej($){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]=i6}return Z}function AX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kj($){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(v0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function bj($){let Z=NX.get($);if(Z)return Z;let Y=new Map,X=[d0.join($,"src"),d0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=Q7.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=d0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return NX.set($,Y),Y}function Sj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=d0.join(Y,"node_modules",$);try{if(Q7.statSync(X).isDirectory())return X}catch{}let Q=d0.dirname(Y);if(Q===Y)return null;Y=Q}}async function TX($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,B,H=[];while((B=j.exec(z))!==null){let[F,L,O,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=d0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if(Q7.statSync(M).isFile())R=M}catch{try{if(Q7.statSync(T).isDirectory())w=T}catch{}}}}else w=Sj(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(L){let T=L.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?bj(w):null;for(let{source:I,local:E}of T){let D=null;if(R)D=R;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),A=!0}}if(A)H.push({start:B.index,end:B.index+F.length})}if(H.length===0)return W;for(let F=H.length-1;F>=0;F--)_=_.slice(0,H[F].start)+_.slice(H[F].end);return`<script${U}>${_}</script>`}),K}async function yj($,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((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),F=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,O=[d0.resolve(d0.dirname(Y),`${j}.stx`),d0.resolve(d0.dirname(Y),j),d0.resolve(X.componentsDir||"components",`${j}.stx`),d0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(H,L),G.set(H.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),X.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function Pj($,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,j=1,_=z+1;while(_<J.length&&j>0){if(J[_]==="(")j++;else if(J[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=J.substring(z+1,_),H=_+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],O,V=B.slice(F[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=V0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,H),`[Error parsing component props: ${D}]`);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 g1(L,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function Cj($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=B1(J);return J=q.output,J=await j(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await j(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await j(J,/[a-z][a-z0-9]*/,!1,Ij),J=o5(J,q.scripts),J;async function j(_,B,H,F){if(!_)return _;let L=_,O=FX(L,B,F);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?J7(w.tagName):w.tagName,A=Ej(w.attributes),N=Dj(A,Z,X),T=v0.getBuiltin(w.tagName),M=T?await U4(R,G,Z,Y,X):!1;if(T&&!M){let y={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)S=MX(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([v,h])=>`${v}="${AX(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}L=L.substring(0,w.startIndex)+S+L.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await U4(R,G,Z,Y,X))continue;let I={};for(let[y,S]of Object.entries(N.static))I[y]=S;for(let[y,S]of Object.entries(N.serverDynamic))I[y]=S;let D=await g1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)D=MX(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=IX(D);if(y){let S=Object.entries(N.events).map(([v,h])=>`${v}="${AX(h)}"`).join(" "),b=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(y.insertPos)}}L=L.substring(0,w.startIndex)+D+L.substring(w.endIndex)}return L}}function MX($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([U])=>!Y.has(U)),J=Q.filter(([U])=>!X.has(U)).map(([U])=>J7(U)).join(" "),G=$,K=Q.length>0?IX(G):null;if(K){let U=Q.map(([j,_])=>`:${J7(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),z=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function IX($){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 G7($,Z,Y,X,Q){if(!RX)HX(),RX=!0;let J=await TX($,Z,Y,X,Q);J=await yj(J,Z,Y,X,Q),J=await Pj(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=t0(J,n5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await Cj(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=kj(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 RX=!1,i6="\x00stx-boolean-attribute",Ij,NX;var n6=k(()=>{R6();OX();wX();y1();L0();_0();Ij=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"]);NX=new Map});var CX={};s(CX,{processLoops:()=>o6});function fj($,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,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=U.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let F=B.slice(H[0].length).trim();if(!F)continue;try{let L=V0(F,Z),O=JSON.stringify(L),V=`@component('${_}', ${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 K7($,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 B=X[W];if(z){z=!1,W++;continue}if(B==="\\"&&U){z=!0,W++;continue}if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),_=Y(j);X=X.substring(0,G)+_+X.substring(W+1)}return X}function gj($,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);v$(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 hj($,Z){let Y=$;return Y=K7(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($0(J,Z));return G?q7:""}catch{return""}}),Y=K7(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($0(J,Z));return G?W7:""}catch{return""}}),Y}function dj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q7),Z=Z.replace(/@continue(?!\()/g,W7),Z}function EX($){let Z=$.includes(q7),Y=Z?$.substring(0,$.indexOf(q7)):$;return{hasBreak:Z,content:Y}}function kX($){let Z=$.includes(W7),Y=Z?$.substring(0,$.indexOf(W7)):$;return{hasContinue:Z,content:Y}}function SX($){let Z=$;return Z=K7(Z,"@break",(Y)=>{let X=Y.trim();if(!x$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=K7(Z,"@continue",(Y)=>{let X=Y.trim();if(!x$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function mj($){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,j=K.length-1,_=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)_=K[B].depth,z=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,_=z+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(z+1,B),F=H.indexOf(" as ");if(F===-1)continue;let L=H.substring(0,F).trim(),O=H.substring(F+4).trim(),V=B+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 S=A.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)w++,R=S.index+S[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,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,y=S+1;else if(b.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:U,end:I,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function bX($,Z){let Y=$;while(!0){let X=mj(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=$0(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),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(J)}}return Y}function o6($,Z,Y,X){let Q=$;Q=bX(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,j=U.index+U[0].length-1,_=1,B=j+1,H=-1;while(B<q.length&&_>0){if(q[B]==="(")_++;else if(q[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let F=q.substring(j+1,H),L=F.indexOf(" as ");if(L===-1)continue;let O=z,V=F.substring(0,L),w=F.substring(L+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),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let D=q.substring(R,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:D}}N=E.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:F}=z;try{let L=B.trim(),O;if(J0(L))O=Q0(L,Object.keys(W))(...Object.values(W));else O=$0(L,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 E=e("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+E+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??xj,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let E=R.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],N=E[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let E=R.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],A=E[1],T=!0;else N=R}else N=R;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(D))f.forEach((m,r)=>{if(m)S[m]=D[r]});else S[N]=D}else S[N]=D;if(A)if(!T&&V&&Array.isArray(D)&&D.length===2)S[A]=D[0],S[N]=D[1];else S[A]=E;let b=hj(F,S),v=kX(b);if(v.hasContinue){M+=v.content;continue}let h=EX(b);if(h.hasBreak){M+=h.content;break}if(b=bX(b,S),b=G(b,S),b=p1(b,S,Y),b=dj(b),h=EX(b),h.hasBreak){M+=h.content;break}if(v=kX(b),v.hasContinue){M+=v.content;continue}b=_1(b,S,Y),b=gj(b,S),b=fj(b,S),M+=b}U=U.substring(0,j)+M+U.substring(_)}catch(L){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=PX(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??vj;return Q=pj(Q,Z,K),Q}function yX($){return x$($)}function PX($,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=C0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,j=c$(Q.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!yX(U)){let H=e("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(B),J=!0;continue}try{let H=uj(U),F=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&F){let A=lj({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(B),J=!0;continue}let L=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=SX(V);let R=Function(...L,`
10627
10864
  let result = '';
10628
10865
  for (${U}) {
10629
10866
  result += \`${V}\`;
10630
10867
  }
10631
10868
  return result;
10632
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(B),J=!0}catch(H){let L=e("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(B),J=!0}}return Q}function Cj($){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 j=q.slice(W+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).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 vj($){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",`
10869
+ `)(...O);Q=Q.substring(0,K)+R+Q.substring(B),J=!0}catch(H){let F=e("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+F+Q.substring(B),J=!0}}return Q}function uj($){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 j=q.slice(W+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).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 lj($){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",`
10633
10870
  for (${Z}) {
10634
10871
  __pushIter([${X.join(", ")}])
10635
10872
  }
10636
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",j="";for(let _ of U){let B={...Q};X.forEach((L,F)=>{B[L]=_[F]});let H=kX(Y,B,J,G);H=p1(H,B,z),H=_1(H,B,z),j+=H}return j}function xj($,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=C0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=p$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!EX(W)){let _=e("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(j),Q=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=DX(H);let F=Function(..._,`
10873
+ `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",j="";for(let _ of U){let B={...Q};X.forEach((F,L)=>{B[F]=_[L]});let H=PX(Y,B,J,G);H=p1(H,B,z),H=_1(H,B,z),j+=H}return j}function pj($,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=C0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=c$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,j=G+U[0].end;if(!yX(W)){let _=e("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(j),Q=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=SX(H);let L=Function(..._,`
10637
10874
  let result = '';
10638
10875
  let maxIterations = ${Y}; // Configurable safety limit
10639
10876
  let counter = 0;
@@ -10645,8 +10882,8 @@ ${D}
10645
10882
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
10646
10883
  }
10647
10884
  return result;
10648
- `)(...B);X=X.substring(0,G)+F+X.substring(j),Q=!0}catch(_){let B=e("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),Q=!0}}return X}var Dj=1000,Ej=!1,K7="<!--__STX_BREAK__-->",q7="<!--__STX_CONTINUE__-->";var i6=k(()=>{n4();G1();e0();c$();_0()});import z0 from"path";function n6($,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 fj($,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 gj($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function yX($){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]!==`
10649
- `)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 B=z[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!X.has(B))Y.push(B),X.add(B)}};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 PX($,Z=""){let Y=yX($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10885
+ `)(...B);X=X.substring(0,G)+L+X.substring(j),Q=!0}catch(_){let B=e("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),Q=!0}}return X}var vj=1000,xj=!1,q7="<!--__STX_BREAK__-->",W7="<!--__STX_CONTINUE__-->";var s6=k(()=>{o4();G1();e0();i$();_0()});import z0 from"path";function r6($,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 cj($,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 ij($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function xX($){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]!==`
10886
+ `)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 B=z[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!X.has(B))Y.push(B),X.add(B)}};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 fX($,Z=""){let Y=xX($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10650
10887
  (function() {
10651
10888
  ${Q5("var",Y)}
10652
10889
  var __destroyHooks = [];
@@ -10655,11 +10892,11 @@ ${D}
10655
10892
 
10656
10893
  ${$}
10657
10894
  ${Z}})();
10658
- `}function CX($,Z){return`
10895
+ `}function gX($,Z){return`
10659
10896
  // Register scope variables for STX runtime
10660
10897
  if (!window.stx._scopes) window.stx._scopes = {};
10661
10898
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
10662
- ${yX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10899
+ ${xX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10663
10900
  `)}
10664
10901
  // #1767: when the bundler renamed a component const that collided with an
10665
10902
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -10667,7 +10904,7 @@ ${yX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10667
10904
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
10668
10905
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
10669
10906
  window.stx._scopes['${Z}'] = __scopeRegistration;
10670
- `}function hj($,Z){let Y=CX($,Z),X=`
10907
+ `}function nj($,Z){let Y=gX($,Z),X=`
10671
10908
  (function() {
10672
10909
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
10673
10910
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -10676,70 +10913,71 @@ ${yX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10676
10913
  } finally {
10677
10914
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10678
10915
  }
10679
- })();`;return X+PX($,Y)+`
10916
+ })();`;return X+fX($,Y)+`
10680
10917
  } finally {
10681
10918
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10682
10919
  }
10683
- })();`}function dj($,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 uj($){if($.__onceStore instanceof Set)return $.__onceStore;return mj}async function o6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||z0.join(z0.dirname(Y),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let K=fj($,"@partial","@include"),q=uj(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=n6(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),y,S=n6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let b=`Boolean(${T})`,v;if(J0(b)){let m=Q0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean($0(b,Z));let h=H?!v:v,f="";if(h){let m=W(E,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=W0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let E,D=T.trim();if(J0(D))E=Q0(D,Object.keys(Z))(...Object.values(Z));else E=$0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},v=await z(R,b,$,L);y+=v}else if(I)y=await z(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+W0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(M)try{S=V0(M,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=W0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await p(h)){let f=await z(v,S,$,L);K=K.replace(A,()=>f),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(A,()=>E);else if(X.debug){let v=W0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=W0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}B.lastIndex=0}}function W(B,H,L){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let O=z0.resolve(H),V=z0.resolve(z0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=z0.resolve(H,F);else w=z0.resolve(V,F);let A=z0.normalize(w),N=A.startsWith(O+z0.sep)||A===O,R=A.startsWith(V+z0.sep)||A===V,T=!1,M=z0.dirname(V);if(A.startsWith(M+z0.sep)){if(!z0.relative(M,A).split(z0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=z0.resolve(Y);J.add(U);async function z(B,H={},L,F){let O=W(B,G,Y);if(!O)return W0("Include",`Could not resolve path for include: ${B}`,Y,L,F);let V=z0.resolve(O);if(J.has(V)){let w=[...J,V].map((A)=>z0.basename(A)).join(" -> ");return W0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return W0("Include",`Error loading include file ${B}: ${m}`,Y,L,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (_6(),B6));w=f(w,Z)}if(w&&(X.debug||!G$()&&!v4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (O6(),tY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (p6(),NX));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let N=d$(A);if(N)A=N.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>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let m=f[1]||"",r=f[2]||"",M0=m.includes("server"),I0=b1(m),m0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:D0}=await Promise.resolve().then(() => (c5(),Q8)),i0=X0(r,{filePath:O,projectRoot:process.cwd()});r=i0.code,m0=D0(i0.styles)}catch(X0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}if(I0&&r.trim())r=S1(r);if(!M0)try{let{hasUserImports:X0,bundleClientScript:D0}=await Promise.resolve().then(() => (m5(),d5));if(X0(r))r=await D0(r,O,{projectRoot:process.cwd()})}catch(X0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}let Y0=gj(r);if(Y0&&!M0){S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++SX}`;let X0=o0(r),D0=hj(X0,S);y+=`${m0}<script data-stx-scoped>${D0}</script>
10684
- `;continue}if(M0)try{let{extractVariables:X0}=await Promise.resolve().then(() => (e5(),l$));await X0(r,I,O)}catch(X0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,X0)}if(!M0&&!Y0){let X0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++SX}`;let D0=o0(r),i0=CX(D0,S),W1=PX(D0,i0);y+=`${m0}<script data-stx-scoped${X0?` ${X0}`:""}>${W1}</script>
10685
- `}}if(S){let f=dj(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await o6(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (i6(),bX)),v=b(A,I,O);v=p1(v,I,O);let h=J5(w);if(v=_1(v,I,O,{forceSignals:h}),M)v+=`
10920
+ })();`}function oj($,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 rj($){if($.__onceStore instanceof Set)return $.__onceStore;return sj}async function a6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||z0.join(z0.dirname(Y),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let K=cj($,"@partial","@include"),q=rj(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,F)=>{let L=H.trim(),O=`${Y}:${L}`;if(q.has(O))return"";return q.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+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(L+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.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,F)+T+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let O=L.index,V=O+L[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=r6(A,0);if(N===-1){F.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){F.lastIndex=R;continue}let E=I[1],D=M.substring(I[0].length),y,S=r6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let b=`Boolean(${T})`,v;if(J0(b)){let m=Q0(b,Object.keys(Z));v=Boolean(m(...Object.values(Z)))}else v=Boolean($0(b,Z));let h=H?!v:v,f="";if(h){let m=W(E,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(R),F.lastIndex=0}catch(b){let v=b instanceof Error?b.message:String(b),h=W0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+h+K.substring(R),F.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+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(L+1,V),R=K.substring(F,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let E,D=T.trim();if(J0(D))E=Q0(D,Object.keys(Z))(...Object.values(Z));else E=$0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},v=await z(N,b,$,F);y+=v}else if(I)y=await z(I,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,F)+W0("Each",`Error in @each: ${D}`,Y,$,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+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(L+1,V),R=K.substring(F,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){B.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 y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=V0(M,Z)}catch(v){let h=v instanceof Error?v.message:String(v);if(X.debug){let f=W0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,F,R);K=K.replace(R,()=>f)}else K=K.replace(R,()=>E||"");continue}let b=!1;for(let v of y){let h=W(v,G,Y);if(!h)continue;if(await c(h)){let f=await z(v,S,$,F);K=K.replace(R,()=>f),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(R,()=>E);else if(X.debug){let v=W0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,F,R);K=K.replace(R,()=>v)}else K=K.replace(R,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=W0("Include",`Error processing @includeFirst: ${S}`,Y,$,F,R);K=K.replace(R,()=>b)}B.lastIndex=0}}function W(B,H,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let O=z0.resolve(H),V=z0.resolve(z0.dirname(F)),w;if(!L.startsWith("./")&&!L.startsWith("../"))w=z0.resolve(H,L);else w=z0.resolve(V,L);let R=z0.normalize(w),A=R.startsWith(O+z0.sep)||R===O,N=R.startsWith(V+z0.sep)||R===V,T=!1,M=z0.dirname(V);if(R.startsWith(M+z0.sep)){if(!z0.relative(M,R).split(z0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let U=z0.resolve(Y);J.add(U);async function z(B,H={},F,L){let O=W(B,G,Y);if(!O)return W0("Include",`Could not resolve path for include: ${B}`,Y,F,L);let V=z0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>z0.basename(R)).join(" -> ");return W0("Include",`Circular include detected: ${w}`,Y,F,L)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return W0("Include",`Error loading include file ${B}: ${m}`,Y,F,L)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (F6(),O6));w=f(w,Z)}if(w&&(X.debug||!K$()&&!x4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (V6(),YX));f(w,O)}catch{}let R=w;try{let{processESImports:f}=await Promise.resolve().then(() => (n6(),DX));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let A=m$(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[f,m]of Object.entries(H))I[f]=m;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let m=f[1]||"",r=f[2]||"",T0=m.includes("server"),I0=b1(m),m0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:D0}=await Promise.resolve().then(() => (i5(),W8)),i0=X0(r,{filePath:O,projectRoot:process.cwd()});r=i0.code,m0=D0(i0.styles)}catch(X0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}if(I0&&r.trim())r=S1(r);if(!T0)try{let{hasUserImports:X0,bundleClientScript:D0}=await Promise.resolve().then(() => (u5(),m5));if(X0(r))r=await D0(r,O,{projectRoot:process.cwd()})}catch(X0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}let Y0=ij(r);if(Y0&&!T0){S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let X0=o0(r),D0=nj(X0,S);y+=`${m0}<script data-stx-scoped data-stx-run="always">${D0}</script>
10921
+ `;continue}if(T0)try{let{extractVariables:X0}=await Promise.resolve().then(() => ($$(),p$));await X0(r,I,O)}catch(X0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,X0)}if(!T0&&!Y0){let X0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let D0=o0(r),i0=gX(D0,S),W1=fX(D0,i0);y+=`${m0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${W1}</script>
10922
+ `}}if(S){let f=oj(R,S);if(R=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await a6(R,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (s6(),CX)),v=b(R,I,O);v=p1(v,I,O);let h=J5(w);if(v=_1(v,I,O,{forceSignals:h}),M)v+=`
10686
10923
  `+M;if(y)v+=`
10687
- `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return W0("Include",`Error processing include ${B}: ${A}`,Y,L,F)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(B,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=n6(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=V0(N,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,W0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await z(A,M,$,B);K=K.substring(0,B)+I+K.substring(F),j.lastIndex=0}return K}function s6($,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 j=z.index,_=z[1],B=j+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=B,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[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(B,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function r6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10688
- `)})}var SX=0,XR,mj;var vX=k(()=>{x7();n4();e0();r5();q5();_0();F0();XR=new P1(500),mj=new Set});import*as a6 from"path";async function xX($,Z,Y=""){if(a6.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 gX($,Z,Y,"@js","@endjs")}async function fX($,Z,Y=""){if(a6.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 gX($,Z,Y,"@ts","@endts")}async function gX($,Z,Y,X,Q){let J=$,G=K5(`${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 j={...Z,global:Z},_=Object.keys(j),B=Object.values(j),H=U.trim();if(X==="@ts")H=H.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
10924
+ `+y;return v}catch(w){let R=w instanceof Error?w.message:String(w);return W0("Include",`Error processing include ${B}: ${R}`,Y,F,L)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,F=1,L=H+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let O=K.substring(B,L),V=K.substring(H+1,L-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=L;continue}let R=w[1],A,N=V.substring(w[0].length),T=r6(N,0);if(T!==-1)A=N.substring(T+1).trim();let M={};if(A)try{M=V0(A,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,W0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await z(R,M,$,B);K=K.substring(0,B)+I+K.substring(L),j.lastIndex=0}return K}function t6($,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 j=z.index,_=z[1],B=j+z[0].length,H=new RegExp(`@${J}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,O=B,V=-1;while(L>0&&O<q.length){let R=q.slice(O),A=R.match(H),N=R.match(F),T=A?O+A.index:1/0,M=N?O+N.index:1/0;if(T<M)L++,O=T+(A[0].length||1);else if(M<1/0){if(L--,L===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function e6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10925
+ `)})}var vX=0,_A,sj;var hX=k(()=>{h7();o4();e0();a5();q5();_0();L0();_A=new P1(500),sj=new Set});import*as $9 from"path";async function dX($,Z,Y=""){if($9.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 uX($,Z,Y,"@js","@endjs")}async function mX($,Z,Y=""){if($9.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 uX($,Z,Y,"@ts","@endts")}async function uX($,Z,Y,X,Q){let J=$,G=K5(`${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 j={...Z,global:Z},_=Object.keys(j),B=Object.values(j),H=U.trim();if(X==="@ts")H=H.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",V=`
10689
10926
  ${H}
10690
10927
  ${O}
10691
- `,A=Function(..._,V)(...B);if(A&&typeof A==="object")Object.assign(Z,A);J=J.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=W0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(B),J=J.replace(W,"")}return J}var hX=k(()=>{q5();F0()});function lj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function dX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return lj(X,J||"_method")})}async function mX($,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=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10928
+ `,R=Function(..._,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=W0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(B),J=J.replace(W,"")}return J}var lX=k(()=>{q5();L0()});function aj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function pX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return aj(X,J||"_method")})}async function cX($,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=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10692
10929
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${s0(W)}</div>
10693
- `)}}}return J}async function uX($,Z,Y,X){return mX($,Z,Y,X,"before")}async function lX($,Z,Y,X){return mX($,Z,Y,X,"after")}var pX=k(()=>{e0();F0()});import{defineRoute as OR,defineRoutes as LR,resetRoutes as FR,route as VR,setAppUrl as wR}from"stx-router";import{route as pj}from"stx-router";function cX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?V0(Q,{}):{};return pj(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var iX=k(()=>{_0()});async function nX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(L$.exact[$])for(let X of L$.exact[$])await Promise.resolve(X(Z,$));if(L$.exact[Y])for(let X of L$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of L$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var L$;var oX=k(()=>{L$={patterns:[],exact:{}}});function sX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>sX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function rX($,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,j,_=U,B=!1;while((j=z.exec(U))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=sX(A);if(N){let R=_.match(/\sclass="([^"]*)"/);if(R)_=_.replace(R[0],` class="${R[1]} ${N}"`);else _=_.replace(j[0],` class="${N}"`)}else _=_.replace(j[0],"");B=!0;continue}if(cj.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${N}"`)}B=!0}catch{continue}}if(B){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${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:j}=q[W];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var cj;var aX=k(()=>{cj=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function n1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&ij.has(X[1]),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function oj($,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 $1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=oj($,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 tX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function T5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function R1($,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 N1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function sj($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function rj($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=T5(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=R1(X.attrs,"v-for"),U=R1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U),B=`@foreach(${q})
10930
+ `)}}}return J}async function iX($,Z,Y,X){return cX($,Z,Y,X,"before")}async function nX($,Z,Y,X){return cX($,Z,Y,X,"after")}var oX=k(()=>{e0();L0()});import{defineRoute as DA,defineRoutes as EA,resetRoutes as kA,route as bA,setAppUrl as SA}from"stx-router";import{route as tj}from"stx-router";function sX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?V0(Q,{}):{};return tj(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var rX=k(()=>{_0()});async function aX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(L$.exact[$])for(let X of L$.exact[$])await Promise.resolve(X(Z,$));if(L$.exact[Y])for(let X of L$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of L$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var L$;var tX=k(()=>{L$={patterns:[],exact:{}}});function eX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>eX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $J($,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,j,_=U,B=!1;while((j=z.exec(U))!==null){let H=j[1],F=j[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),O=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...L,`return (${F})`)(...O);if(H==="class"){let A=eX(R);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(j[0],` class="${A}"`)}else _=_.replace(j[0],"");B=!0;continue}if(ej.has(H)){if(R)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)_=_.replace(j[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${A}"`)}B=!0}catch{continue}}if(B){let H=W.endsWith("/>")?" /":"",L=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:j}=q[W];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var ej;var ZJ=k(()=>{ej=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function n1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&$B.has(X[1]),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function YB($,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 $1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=YB($,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 YJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function M5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function A1($,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 N1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function XB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function JB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=M5(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 F=G.split(",").map((V)=>V.trim()),L=F[0],O=F[1];q=`${K} as ${O} => ${L}`}else q=`${K} as ${G}`;let W=A1(X.attrs,"v-for"),U=A1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U),B=`@foreach(${q})
10694
10931
  `,H=`${B}${_}
10695
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function aj($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=T5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=$1(Z,X),K=R1(X.attrs,"v-if"),q=N1(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=n1(Z,W+L);if(!F){U=!1;break}let O=T5(F.attrs,"v-else-if"),V=tX(F.attrs,"v-else");if(O!==null){let w=$1(Z,F),A=R1(F.attrs,"v-else-if"),N=N1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=$1(Z,F),A=R1(F.attrs,"v-else"),N=N1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
10932
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function QB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=M5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=$1(Z,X),K=A1(X.attrs,"v-if"),q=N1(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*/),F=H?H[0].length:0,L=n1(Z,W+F);if(!L){U=!1;break}let O=M5(L.attrs,"v-else-if"),V=YJ(L.attrs,"v-else");if(O!==null){let w=$1(Z,L),R=A1(L.attrs,"v-else-if"),A=N1(Z.slice(w.outerStart,w.outerEnd),{...L,start:0,end:L.end-L.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:L}),W=w.outerEnd}else if(V){let w=$1(Z,L),R=A1(L.attrs,"v-else"),A=N1(Z.slice(w.outerStart,w.outerEnd),{...L,start:0,end:L.end-L.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:L}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
10696
10933
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
10697
10934
  ${H.element}`);else z.push(`@else
10698
10935
  ${H.element}`);z.push("@endif");let j=z.join(`
10699
- `),_=J[0].outerStart,B=J[J.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function tj($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function ej($){let Z=$,Y=0;while(Y<Z.length){let X=n1(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],j=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=Q.match(G)}if(J){let U=$1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),j=N1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let q=T5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(nj.has(X.tag)){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function $B($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function ZB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function YB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=T5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=$1(Z,X),G=R1(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 XB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=T5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=$1(Z,X),G=R1(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 JB($){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 QB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;if(!tX(X.attrs,"v-once")){Y=X.end;continue}let Q=R1(X.attrs,"v-once"),J=$1(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10936
+ `),_=J[0].outerStart,B=J[J.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function GB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function KB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(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],j=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=Q.match(G)}if(J){let U=$1(Z,X),z=Z.slice(U.outerStart,U.outerEnd),j=N1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let q=M5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(ZB.has(X.tag)){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=$1(Z,X),j=Z.slice(z.outerStart,z.outerEnd),_=N1(j,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function qB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function WB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function UB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=M5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=$1(Z,X),G=A1(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 zB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;let Q=M5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=$1(Z,X),G=A1(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 jB($){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 BB($){let Z=$,Y=0;while(Y<Z.length){let X=n1(Z,Y);if(!X)break;if(!YJ(X.attrs,"v-once")){Y=X.end;continue}let Q=A1(X.attrs,"v-once"),J=$1(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10700
10937
  ${N1(G,{...X,start:0,end:X.end-X.start},Q)}
10701
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function GB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function KB($){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 eX($){if(!sj($))return $;let Z=$;return Z=rj(Z),Z=aj(Z),Z=QB(Z),Z=$B(Z),Z=ZB(Z),Z=ej(Z),Z=tj(Z),Z=KB(Z),Z=YB(Z),Z=XB(Z),Z=JB(Z),Z=GB(Z),Z}var ij,nj;var $J=k(()=>{ij=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nj=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 W7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function ZJ($,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=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${W7(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await g1(z,_,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 j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${W7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await qB(J,Z,Y,X,Q),J}async function qB($,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=$0(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${W7(U.expr)}" -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length);continue}let j=X.componentsDir||"components",_=await g1(z,{},"",j,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${W7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var YJ=k(()=>{F0();_0()});function jB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass??"dark",Q=$.attribute??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!WB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto \u2014 got ${JSON.stringify(Y)}`);if(typeof X!=="string"||!zB.test(X))throw Error(`colorMode.darkClass must be a single CSS class name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&(typeof Q!=="string"||!UB.test(Q)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Q)}`);return{storageKey:Z,initialMode:Y,darkClass:X,attribute:Q}}function BB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function t6($={}){let Z=jB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${BB(Z)};var p=c.initialMode;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"||v==="auto")p=v}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute){r.setAttribute(c.attribute,m)}else if(m==="dark"){r.classList.add(c.darkClass)}else{r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,preference:p,mode:m}}catch(e){}}());`}</script>`}function XJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length,Q=$.slice(X),J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(Q);if(J)X+=J[0].length;let G=t6(Z);return`${$.slice(0,X)}
10702
- ${G}${$.slice(X)}`}var WB,UB,zB;var e6=k(()=>{WB=new Set(["light","dark","auto"]),UB=/^[a-z][\w:-]*$/i,zB=/^[\w-]+$/});function QJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${JJ}
10703
- ${$.slice(Z)}`}function _B($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function HB($,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,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10704
- `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10705
- `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
10706
- `),F=Object.entries(U).map(([R,T])=>` ${R}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=_B($),A=[B,Y.colorMode?` ${t6(Y.colorMode)}`:"",` <title>${z}</title>`,` ${JJ}`,H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...w.map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),N=[V,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10707
- <html lang="${Q}">
10938
+ @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 HB($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function XJ($){if(!XB($))return $;let Z=$;return Z=JB(Z),Z=QB(Z),Z=BB(Z),Z=qB(Z),Z=WB(Z),Z=KB(Z),Z=GB(Z),Z=HB(Z),Z=UB(Z),Z=zB(Z),Z=jB(Z),Z=_B(Z),Z}var $B,ZB;var JJ=k(()=>{$B=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ZB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function U7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function QJ($,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=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${U7(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let F=X.componentsDir||"components",L=await g1(z,_,U.slotContent,F,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+L+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${U7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await OB(J,Z,Y,X,Q),J}async function OB($,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=$0(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${U7(U.expr)}" -->`;J=J.slice(0,U.index)+B+J.slice(U.index+U.full.length);continue}let j=X.componentsDir||"components",_=await g1(z,{},"",j,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${U7(j)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var GJ=k(()=>{L0();_0()});function RB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Q=$.attribute??null,J=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!FB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!wB.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&(typeof Q!=="string"||!VB.test(Q)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Q)}`);if(J!==null&&!LB.has(J))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(J)}`);if(X===null&&Q===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:X,attribute:Q,autoValue:J}}function AB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Z9($={}){let Z=RB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${AB(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function KJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length,Q=$.slice(X),J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(Q);if(J)X+=J[0].length;let G=Z9(Z);return`${$.slice(0,X)}
10939
+ ${G}${$.slice(X)}`}var FB,LB,VB,wB;var Y9=k(()=>{FB=new Set(["light","dark","auto","system"]),LB=new Set(["auto","system"]),VB=/^[a-z][\w:-]*$/i,wB=/^[\w-]+$/});function NB(){if(X9===null)X9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return X9}function qJ($,Z=NB()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length;return`${$.slice(0,X)}
10940
+ <meta name="stx-build" content="${Z}">${$.slice(X)}`}var X9=null;function T5($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MB($={},Z="en"){let Y=[],X=[],Q="",J=Z;for(let[K,q]of Object.entries($||{})){if(q==null)continue;let W=K.trim();if(!UJ.test(W))continue;let U=W.toLowerCase();if(U==="lang"){J=String(q);continue}if(U==="class"){Q=String(q).trim();continue}Y.push(` ${W}="${T5(String(q))}"`),X.push(W)}let G=` lang="${T5(J)}"`;if(Q)G+=` class="${T5(Q)}"`;if(G+=Y.join(""),Q)G+=` ${j7}="${T5(Q)}"`;if(X.length)G+=` ${z7}="${T5(X.join(" "))}"`;return G}function zJ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Q of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Q))X.push(Q);Y.class=X.join(" ")}return Y}function jJ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let X={},Q=[],J=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=J.exec(Y[1]))!==null){let U=G[1];if(!(U in X))Q.push(U);X[U]=G[2]??G[3]??G[4]??""}let K=[],q=[];for(let[U,z]of Object.entries(Z)){if(z==null)continue;let j=U.trim();if(!UJ.test(j))continue;let _=j.toLowerCase();if(_==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let H of String(z).split(/\s+/).filter(Boolean))if(!B.includes(H))B.push(H),K.push(H);if(!("class"in X))Q.push("class");X.class=B.join(" ");continue}if(!(j in X))Q.push(j);if(X[j]=String(z),_!=="lang")q.push(j)}if(K.length){if(!(j7 in X))Q.push(j7);X[j7]=K.join(" ")}if(q.length){if(!(z7 in X))Q.push(z7);X[z7]=q.join(" ")}let W=Q.map((U)=>` ${U}="${T5(X[U])}"`).join("");return $.replace(Y[0],()=>`<html${W}>`)}function BJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${WJ}
10941
+ ${$.slice(Z)}`}function TB($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function IB($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",htmlAttrs:W={},bodyClass:U="",bodyAttrs:z={}}=Z,j=Y.title||X,H=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((M)=>{return` <meta ${Object.entries(M).map(([E,D])=>`${E}="${D}"`).join(" ")}>`}).join(`
10942
+ `),F=G.map((M)=>{return` <link ${Object.entries(M).map(([E,D])=>`${E}="${D}"`).join(" ")}>`}).join(`
10943
+ `),L=K.map((M)=>{if(M.src)return` <script ${Object.entries(M).filter(([E])=>E!=="content").map(([E,D])=>`${E}="${D}"`).join(" ")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
10944
+ `),O=MB(W,Q),V=Object.entries(z).map(([M,I])=>` ${M}="${I}"`).join(""),w=U?` class="${U}"`:"",{body:R,hoisted:A}=TB($),N=[H,Y.colorMode?` ${Z9(Y.colorMode)}`:"",` <title>${j}</title>`,` ${WJ}`,F,L,q?` ${q}`:"",...(Y.styles||[]).map((M)=>` ${M}`),...A.map((M)=>` ${M}`),...(Y.headScripts||[]).map((M)=>` ${M}`),Y.headStack||""].filter(Boolean),T=[R,...(Y.bodyScripts||[]).map((M)=>M),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10945
+ <html${O}>
10708
10946
  <head>
10709
- ${A.join(`
10947
+ ${N.join(`
10710
10948
  `)}
10711
10949
  </head>
10712
- <body${O}${F}>
10713
- ${N.join(`
10950
+ <body${w}${V}>
10951
+ ${T.join(`
10714
10952
  `)}
10715
10953
  </body>
10716
- </html>`}function $9($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function GJ($,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,j])=>`${z}="${j}"`).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(`
10954
+ </html>`}function J9($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function _J($,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,j])=>`${z}="${j}"`).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(`
10717
10955
  `)}
10718
- ${$.slice(Y)}`}function KJ($,Z={},Y={}){if($9($))return $;return HB($,Z,Y)}var JJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";var qJ=k(()=>{e6()});import M5 from"path";function WJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function UJ($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=M5.join(Q,$);if(await Bun.file(G).exists())return G;Q=M5.dirname(Q)}X=M5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=M5.resolve(Z,$);else X=M5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function zJ($,Z,Y){let X=$,Q=M5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,j]=G;if(WJ(z))continue;let _=await UJ(z,Q,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
10956
+ ${$.slice(Y)}`}function HJ($,Z={},Y={}){if(J9($))return $;return IB($,Z,Y)}var WJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",z7="data-stx-html-attrs",j7="data-stx-html-class",UJ;var OJ=k(()=>{Y9();UJ=/^[A-Za-z_:][\w:.-]*$/});import I5 from"path";function FJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function LJ($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=I5.join(Q,$);if(await Bun.file(G).exists())return G;Q=I5.dirname(Q)}X=I5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=I5.resolve(Z,$);else X=I5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function VJ($,Z,Y){let X=$,Q=I5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,j]=G;if(FJ(z))continue;let _=await LJ(z,Q,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let F=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(F.outputs.length>0)B=await F.outputs[0].text()}let H=`<script>
10719
10957
  // Source: ${z}
10720
10958
  ${B}
10721
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,j]=q,_=U+j;if(WJ(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await UJ(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
10959
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,j]=q,_=U+j;if(FJ(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await LJ(z,Q,Z);if(H)try{let F=await Bun.file(H).text();Y.add(H);let L=`<style>
10722
10960
  /* Source: ${z} */
10723
- ${L}
10724
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var jJ=k(()=>{D1()});function U7($,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(),j=Y.substring(J,q+1),_=-1,B=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==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+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 A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+N+Y.substring(q+1),X.lastIndex=J+N.length}catch(V){a0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+j.length}}return Y}function z7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function BJ($){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),j=z.indexOf("@endmemo");if(j===-1)continue;let _=z.slice(0,j),B=U+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+E+w.slice(R.length)+_.slice(L+w.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:B,replacement:N}),Y.lastIndex=B}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 Z9($){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 _J($){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 j=$.slice(U+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function HJ($){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 B=`</${G}>`,H=$.toLowerCase().indexOf(B,J);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!OB.test(z))continue;let j=$[U-1]==="/",_=j?U-1:U;Y+=`${$.slice(X,_)} x-cloak${j?" ":""}`,X=_}return Y+=$.slice(X),Y}var OB;var Y9=k(()=>{G1();_0();OB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function j7($,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 LB){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(`
10961
+ ${F}
10962
+ </style>`;X=X.replace(W,L),K.lastIndex=0}catch(F){}}}return X}var wJ=k(()=>{D1()});function B7($,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(),j=Y.substring(J,q+1),_=-1,B=0,H=null,F=!1;for(let V=0;V<z.length;V++){let w=z[V];if(F){F=!1;continue}if(w==="\\"&&H){F=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=V;break}}let L=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=L.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){a0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+j.length}}return Y}function _7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function RJ($){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),j=z.indexOf("@endmemo");if(j===-1)continue;let _=z.slice(0,j),B=U+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=H?H[0].length:0,L=_.slice(F),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=L.slice(0,L.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,E=`<${T}${M} data-stx-memo="${W}"${I}>`;A=_.slice(0,F)+E+w.slice(N.length)+_.slice(F+w.length)}else A=`${_.slice(0,F)}<div data-stx-memo="${W}">${w}</div>${_.slice(F+w.length)}`;Q.push({start:J,end:B,replacement:A}),Y.lastIndex=B}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 Q9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function AJ($){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 j=$.slice(U+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function NJ($){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 B=`</${G}>`,H=$.toLowerCase().indexOf(B,J);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!DB.test(z))continue;let j=$[U-1]==="/",_=j?U-1:U;Y+=`${$.slice(X,_)} x-cloak${j?" ":""}`,X=_}return Y+=$.slice(X),Y}var DB;var G9=k(()=>{G1();_0();DB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function H7($,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 EB){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(`
10725
10963
  `),z=[];U.forEach((_,B)=>{if(G.lastIndex=0,G.test(_))z.push(B+1)});let j=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${j}
10726
10964
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
10727
10965
  ${J.join(`
10728
10966
  `)}
10729
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var LB;var X9=k(()=>{LB=[{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 OJ={};s(OJ,{getStoreScript:()=>FB,clearStoreCache:()=>VB});import B7 from"path";async function FB($){let Z;if($)Z=B7.resolve($);else{let U=await O5();Z=B7.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=I5.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=B7.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return I5.set(Z,""),null}if(Q.length===0)return I5.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:l0()});for(let U of G)try{let z=await Bun.file(U).text(),j=B7.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: ${j}
10730
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return I5.set(Z,""),null;let W=`;(function(){
10967
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var EB;var K9=k(()=>{EB=[{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 MJ={};s(MJ,{getStoreScript:()=>kB,clearStoreCache:()=>bB});import O7 from"path";async function kB($){let Z;if($)Z=O7.resolve($);else{let U=await O5();Z=O7.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=D5.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=O7.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return D5.set(Z,""),null}if(Q.length===0)return D5.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:l0()});for(let U of G)try{let z=await Bun.file(U).text(),j=O7.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: ${j}
10968
+ ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return D5.set(Z,""),null;let W=`;(function(){
10731
10969
  ${K.join(`
10732
10970
 
10733
10971
  `)}
10734
- })();`;return I5.set(Z,W),W}function VB(){I5.clear()}var I5;var LJ=k(()=>{L5();D1();I5=new Map});var VJ={};s(VJ,{getComposableScript:()=>NB,clearComposableCache:()=>TB});import F$ from"path";function FJ($){let Z=F$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function AB($){if($)return F$.resolve($);let Z=`<default>:${process.cwd()}`,Y=J9.get(Z);if(Y!==void 0)return Y;let X=await RB();return J9.set(Z,X),X}async function RB(){let $=await O5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return F$.resolve(Z,Y);for(let X of wB){let Q=F$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!FJ(G))return Q}catch{}}return null}async function NB($){let Z=await AB($);if(!Z)return null;let Y=D5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(FJ(B))continue;X.push(B)}}catch{return D5.set(Z,""),null}if(X.length===0)return D5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let B=await Bun.file(_).text(),H=F$.basename(_,".ts");for(let L of B.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(B).exports)if(L!=="default")G.add(L)}catch{}B=o0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=Q.transformSync(B),J.push(`// Composable: ${H}
10735
- ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(J.length===0||G.size===0)return D5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
10972
+ })();`;return D5.set(Z,W),W}function bB(){D5.clear()}var D5;var TJ=k(()=>{F5();D1();D5=new Map});var DJ={};s(DJ,{getComposableScript:()=>CB,clearComposableCache:()=>vB});import V$ from"path";function IJ($){let Z=V$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function yB($){if($)return V$.resolve($);let Z=`<default>:${process.cwd()}`,Y=q9.get(Z);if(Y!==void 0)return Y;let X=await PB();return q9.set(Z,X),X}async function PB(){let $=await O5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return V$.resolve(Z,Y);for(let X of SB){let Q=V$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!IJ(G))return Q}catch{}}return null}async function CB($){let Z=await yB($);if(!Z)return null;let Y=E5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(IJ(B))continue;X.push(B)}}catch{return E5.set(Z,""),null}if(X.length===0)return E5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let B=await Bun.file(_).text(),H=V$.basename(_,".ts");for(let F of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])K.add(F[1]);try{for(let F of Q.scan(B).exports)if(F!=="default")G.add(F)}catch{}B=o0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=Q.transformSync(B),J.push(`// Composable: ${H}
10973
+ ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(J.length===0||G.size===0)return E5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
10736
10974
  `),W=JSON.stringify([...G]),U=J.join(`
10737
10975
 
10738
10976
  `),j=`;(function(){
10739
10977
  window.__composables = window.__composables || {};
10740
10978
  var __c = window.__composables;
10741
10979
  var __stx = window.stx || {};
10742
- ${g$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10980
+ ${h$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10743
10981
  `)}
10744
10982
  ${U}
10745
10983
  ${q}
@@ -10756,7 +10994,7 @@ ${q}
10756
10994
  }
10757
10995
  window[__n] = __c[__n];
10758
10996
  }
10759
- })();`;return D5.set(Z,j),j}function TB(){D5.clear(),J9.clear()}var D5,J9,wB;var wJ=k(()=>{L5();D1();r5();D5=new Map,J9=new Map,wB=["composables","functions"]});var RJ={};s(RJ,{processDeferDirectives:()=>kB});function MB(){return`stx-defer-${++AJ}`}function IB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function DB($,Z,Y){let{trigger:X,value:Q}=IB(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 EB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10997
+ })();`;return E5.set(Z,j),j}function vB(){E5.clear(),q9.clear()}var E5,q9,SB;var EJ=k(()=>{F5();D1();a5();E5=new Map,q9=new Map,SB=["composables","functions"]});var bJ={};s(bJ,{processDeferDirectives:()=>dB});function xB(){return`stx-defer-${++kJ}`}function fB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function gB($,Z,Y){let{trigger:X,value:Q}=fB(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 hB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10760
10998
  const observer = new IntersectionObserver((entries) => {
10761
10999
  if (entries[0].isIntersecting) {
10762
11000
  observer.disconnect();
@@ -10829,7 +11067,7 @@ else {
10829
11067
  ${Q}
10830
11068
  })();
10831
11069
  </script>
10832
- `}function kB($,Z,Y){AJ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=MB(),q=DB(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>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,_=EB(K,q);return`
11070
+ `}function dB($,Z,Y){kJ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=xB(),q=gB(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>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,_=hB(K,q);return`
10833
11071
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
10834
11072
  ${W}
10835
11073
  ${U}
@@ -10837,7 +11075,7 @@ else {
10837
11075
  ${z}
10838
11076
  </div>
10839
11077
  ${_}
10840
- `})}var AJ=0;var TJ={};s(TJ,{processTeleportDirectives:()=>PB,ensureTeleportTargets:()=>CB});function bB(){return`stx-teleport-${++NJ}`}function SB($){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 yB($,Z){return`
11078
+ `})}var kJ=0;var yJ={};s(yJ,{processTeleportDirectives:()=>pB,ensureTeleportTargets:()=>cB});function mB(){return`stx-teleport-${++SJ}`}function uB($){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 lB($,Z){return`
10841
11079
  <script>
10842
11080
  (function() {
10843
11081
  const source = document.getElementById('${$}');
@@ -10883,12 +11121,12 @@ else {
10883
11121
  });
10884
11122
  })();
10885
11123
  </script>
10886
- `}function PB($,Z,Y){NJ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=bB(),{target:q,disabled:W}=SB(J),U=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=yB(K,q);return`
11124
+ `}function pB($,Z,Y){SJ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=mB(),{target:q,disabled:W}=uB(J),U=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=lB(K,q);return`
10887
11125
  <div id="${K}" class="stx-teleport-source" style="display: none;">
10888
11126
  <template>${U}</template>
10889
11127
  </div>
10890
11128
  ${z}
10891
- `})}function CB(){return`
11129
+ `})}function cB(){return`
10892
11130
  <script>
10893
11131
  (function() {
10894
11132
  // Common teleport targets
@@ -10905,7 +11143,7 @@ else {
10905
11143
  });
10906
11144
  })();
10907
11145
  </script>
10908
- `}var NJ=0;var EJ={};s(EJ,{processTransitionDirectives:()=>gB,processTransitionAttributes:()=>uB,performLeave:()=>fB,performEnter:()=>xB,generateTransitionRuntime:()=>mB,generateTransitionCSS:()=>dB});function MJ($,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 vB($){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 IJ($,Z){return new Promise((Y)=>{let X=Z??vB($);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 DJ($){$.offsetHeight}async function xB($,Z={}){let Y=Z.name||"stx",X=MJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),DJ($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await IJ($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function fB($,Z={}){let Y=Z.name||"stx",X=MJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),DJ($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await IJ($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function gB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=hB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
11146
+ `}var SJ=0;var xJ={};s(xJ,{processTransitionDirectives:()=>sB,processTransitionAttributes:()=>eB,performLeave:()=>oB,performEnter:()=>nB,generateTransitionRuntime:()=>tB,generateTransitionCSS:()=>aB});function PJ($,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 iB($){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 CJ($,Z){return new Promise((Y)=>{let X=Z??iB($);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 vJ($){$.offsetHeight}async function nB($,Z={}){let Y=Z.name||"stx",X=PJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),vJ($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await CJ($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function oB($,Z={}){let Y=Z.name||"stx",X=PJ(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),vJ($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await CJ($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function sB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=rB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10909
11147
  <div
10910
11148
  class="stx-transition-wrapper"
10911
11149
  data-transition="${q}"
@@ -10947,7 +11185,7 @@ else {
10947
11185
  });
10948
11186
  })();
10949
11187
  </script>
10950
- `})}function hB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function dB(){return`
11188
+ `})}function rB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function aB(){return`
10951
11189
  /* STX Transition Presets */
10952
11190
 
10953
11191
  /* Fade */
@@ -11134,7 +11372,7 @@ else {
11134
11372
  opacity: 1;
11135
11373
  max-height: 1000px;
11136
11374
  }
11137
- `}function mB(){return`
11375
+ `}function tB(){return`
11138
11376
  // STX Transition Runtime
11139
11377
  (function() {
11140
11378
  if (typeof window === 'undefined') return;
@@ -11223,7 +11461,7 @@ else {
11223
11461
 
11224
11462
  console.log('[stx] Transition runtime initialized');
11225
11463
  })();
11226
- `}function uB($){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 bJ={};s(bJ,{withErrorBoundary:()=>kJ,processErrorBoundaryDirectives:()=>cB,generateErrorBoundaryRuntime:()=>rB,generateErrorBoundaryCSS:()=>sB,createErrorBoundary:()=>oB});function pB(){return`eb-${++lB}-${Date.now().toString(36)}`}function cB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=pB(),W=iB(J||"");return nB(q,G.trim(),K.trim(),W)})}function iB($){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 nB($,Z,Y,X){let Q=X.logErrors!==!1;return`
11464
+ `}function eB($){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 gJ={};s(gJ,{withErrorBoundary:()=>fJ,processErrorBoundaryDirectives:()=>Y_,generateErrorBoundaryRuntime:()=>K_,generateErrorBoundaryCSS:()=>G_,createErrorBoundary:()=>Q_});function Z_(){return`eb-${++$_}-${Date.now().toString(36)}`}function Y_($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=Z_(),W=X_(J||"");return J_(q,G.trim(),K.trim(),W)})}function X_($){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 J_($,Z,Y,X){let Q=X.logErrors!==!1;return`
11227
11465
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
11228
11466
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
11229
11467
  ${Z}
@@ -11343,7 +11581,7 @@ else {
11343
11581
  };
11344
11582
  })();
11345
11583
  </script>
11346
- `}async function kJ($,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 oB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>kJ(X,$,Y)}function sB(){return`
11584
+ `}async function fJ($,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 Q_($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>fJ(X,$,Y)}function G_(){return`
11347
11585
  /* STX Error Boundary Styles */
11348
11586
  .stx-error-boundary {
11349
11587
  position: relative;
@@ -11387,7 +11625,7 @@ else {
11387
11625
  color: #fecaca;
11388
11626
  }
11389
11627
  }
11390
- `}function rB(){return`
11628
+ `}function K_(){return`
11391
11629
  // STX Error Boundary Runtime
11392
11630
  (function() {
11393
11631
  if (typeof window === 'undefined') return;
@@ -11452,7 +11690,7 @@ else {
11452
11690
 
11453
11691
  console.log('[stx] Error boundary runtime initialized');
11454
11692
  })();
11455
- `}var lB=0;var SJ={};s(SJ,{renderSSRSuspense:()=>X_,processSuspenseDirectives:()=>eB,generateSuspenseRuntime:()=>Q_,generateSuspenseCSS:()=>J_,createSSRSuspense:()=>Y_});function tB(){return`suspense-${++aB}-${Date.now().toString(36)}`}function eB($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=tB(),W=$_(J||"");return Z_(q,G.trim(),K.trim(),W)})}function $_($){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 Z_($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11693
+ `}var $_=0;var hJ={};s(hJ,{renderSSRSuspense:()=>__,processSuspenseDirectives:()=>U_,generateSuspenseRuntime:()=>O_,generateSuspenseCSS:()=>H_,createSSRSuspense:()=>B_});function W_(){return`suspense-${++q_}-${Date.now().toString(36)}`}function U_($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=W_(),W=z_(J||"");return j_(q,G.trim(),K.trim(),W)})}function z_($){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 j_($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11456
11694
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
11457
11695
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
11458
11696
  ${Y}
@@ -11642,7 +11880,7 @@ else {
11642
11880
  }, 0);
11643
11881
  })();
11644
11882
  </script>
11645
- `}function Y_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function X_($){let Z=$.map((X)=>`
11883
+ `}function B_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function __($){let Z=$.map((X)=>`
11646
11884
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
11647
11885
  ${X.fallback}
11648
11886
  </div>
@@ -11667,7 +11905,7 @@ else {
11667
11905
  }
11668
11906
  })();
11669
11907
  </script>
11670
- `}}return{initial:Z,streaming:Y()}}function J_(){return`
11908
+ `}}return{initial:Z,streaming:Y()}}function H_(){return`
11671
11909
  /* STX Suspense Styles */
11672
11910
  .stx-suspense {
11673
11911
  position: relative;
@@ -11723,7 +11961,7 @@ else {
11723
11961
  background-size: 200% 100%;
11724
11962
  }
11725
11963
  }
11726
- `}function Q_(){return`
11964
+ `}function O_(){return`
11727
11965
  // STX Suspense Runtime
11728
11966
  (function() {
11729
11967
  if (typeof window === 'undefined') return;
@@ -11790,7 +12028,7 @@ else {
11790
12028
 
11791
12029
  console.log('[stx] Suspense runtime initialized');
11792
12030
  })();
11793
- `}var aB=0;var vJ={};s(vJ,{processAsyncDirectives:()=>K_,isAsyncComponent:()=>W_,generateAsyncComponentRuntime:()=>z_,generateAsyncComponentCSS:()=>U_,defineAsyncComponent:()=>q_});function yJ(){return`async-${++G_}-${Date.now().toString(36)}`}function K_($,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=yJ(),z=PJ(K);return CJ(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=yJ(),U=PJ(K);return CJ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function PJ($){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 CJ($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
12031
+ `}var q_=0;var lJ={};s(lJ,{processAsyncDirectives:()=>L_,isAsyncComponent:()=>w_,generateAsyncComponentRuntime:()=>A_,generateAsyncComponentCSS:()=>R_,defineAsyncComponent:()=>V_});function dJ(){return`async-${++F_}-${Date.now().toString(36)}`}function L_($,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=dJ(),z=mJ(K);return uJ(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=dJ(),U=mJ(K);return uJ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function mJ($){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 uJ($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
11794
12032
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
11795
12033
  <div class="stx-async-loading" data-async-loading="${$}">
11796
12034
  ${Y}
@@ -12017,7 +12255,7 @@ catch (error) {
12017
12255
  loadComponent();
12018
12256
  })();
12019
12257
  </script>
12020
- `}function q_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function W_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function U_(){return`
12258
+ `}function V_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function w_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function R_(){return`
12021
12259
  /* STX Async Component Styles */
12022
12260
  .stx-async-component {
12023
12261
  position: relative;
@@ -12091,7 +12329,7 @@ catch (error) {
12091
12329
  background-size: 200% 100%;
12092
12330
  }
12093
12331
  }
12094
- `}function z_(){return`
12332
+ `}function A_(){return`
12095
12333
  // STX Async Component Runtime
12096
12334
  (function() {
12097
12335
  if (typeof window === 'undefined') return;
@@ -12145,7 +12383,7 @@ catch (error) {
12145
12383
 
12146
12384
  console.log('[stx] Async component runtime initialized');
12147
12385
  })();
12148
- `}var G_=0;var fJ={};s(fJ,{shouldCacheComponent:()=>L_,processKeepAliveDirectives:()=>B_,onDeactivated:()=>A_,onActivated:()=>w_,generateKeepAliveRuntime:()=>V_,generateKeepAliveCSS:()=>F_,createKeepAliveCache:()=>O_});function xJ(){return`keep-alive-${++j_}-${Date.now().toString(36)}`}function B_($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=xJ(),q=__(J||"");return H_(K,G.trim(),q)})}function __($){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 H_($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12386
+ `}var F_=0;var cJ={};s(cJ,{shouldCacheComponent:()=>E_,processKeepAliveDirectives:()=>M_,onDeactivated:()=>y_,onActivated:()=>S_,generateKeepAliveRuntime:()=>b_,generateKeepAliveCSS:()=>k_,createKeepAliveCache:()=>D_});function pJ(){return`keep-alive-${++N_}-${Date.now().toString(36)}`}function M_($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=pJ(),q=T_(J||"");return I_(K,G.trim(),q)})}function T_($){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 I_($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12149
12387
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
12150
12388
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
12151
12389
  ${Z}
@@ -12432,7 +12670,7 @@ else {
12432
12670
  });
12433
12671
  })();
12434
12672
  </script>
12435
- `}function O_($={}){return{id:$.id||xJ(),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 L_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function F_(){return`
12673
+ `}function D_($={}){return{id:$.id||pJ(),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 E_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function k_(){return`
12436
12674
  /* STX Keep-Alive Styles */
12437
12675
  .stx-keep-alive {
12438
12676
  position: relative;
@@ -12457,7 +12695,7 @@ else {
12457
12695
  .stx-keep-alive-content > [data-activated] {
12458
12696
  opacity: 1;
12459
12697
  }
12460
- `}function V_(){return`
12698
+ `}function b_(){return`
12461
12699
  // STX Keep-Alive Runtime
12462
12700
  (function() {
12463
12701
  if (typeof window === 'undefined') return;
@@ -12493,12 +12731,12 @@ else {
12493
12731
 
12494
12732
  console.log('[stx] Keep-alive runtime initialized');
12495
12733
  })();
12496
- `}function w_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function A_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var j_=0;var uJ={};s(uJ,{useVirtualList:()=>hJ,processVirtualListDirectives:()=>G9,processVirtualGridDirectives:()=>mJ,processInfiniteListDirectives:()=>dJ,generateVirtualListCSS:()=>gJ,default:()=>R_,createVirtualList:()=>Q9});function Q9($,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 j(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),R=Math.ceil(X/Y),T=Math.min(W.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+I>U){R=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+=I,N>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:R,endIndex:T}}function B(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=z.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=z.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=j();return{startIndex:N,endIndex:R,scrollTop:U,totalHeight:B(),visibleItems:W.slice(N,R+1),itemHeights:new Map(z)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){U=Math.max(0,Math.min(N,B()-X))}function V(){j()}function w(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function G9($,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)}`,j=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,H=Math.min(W.length-1,j+_),L="";for(let O=B;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
12734
+ `}function S_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function y_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var N_=0;var rJ={};s(rJ,{useVirtualList:()=>nJ,processVirtualListDirectives:()=>U9,processVirtualGridDirectives:()=>sJ,processInfiniteListDirectives:()=>oJ,generateVirtualListCSS:()=>iJ,default:()=>P_,createVirtualList:()=>W9});function W9($,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 j(){if(G)return _();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 _(){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 B(){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 F(){let{startIndex:A,endIndex:N}=j();return{startIndex:A,endIndex:N,scrollTop:U,totalHeight:B(),visibleItems:W.slice(A,N+1),itemHeights:new Map(z)}}function L(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){U=Math.max(0,Math.min(A,B()-X))}function V(){j()}function w(A){W=[...A],z.clear(),V()}function R(){W=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:F,refresh:V,setItems:w,destroy:R}}function U9($,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)}`,j=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,B=0,H=Math.min(W.length-1,j+_),F="";for(let O=B;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));F+=`
12497
12735
  <div class="virtual-item ${U.itemClass||""}"
12498
12736
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
12499
12737
  data-index="${O}">
12500
12738
  ${w}
12501
- </div>`}let F=W.length*U.itemHeight;return`
12739
+ </div>`}let L=W.length*U.itemHeight;return`
12502
12740
  <div id="${z}"
12503
12741
  class="virtual-list-container ${U.containerClass||""}"
12504
12742
  style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;"
@@ -12506,8 +12744,8 @@ else {
12506
12744
  data-total-items="${W.length}"
12507
12745
  data-overscan="${_}">
12508
12746
  <div class="virtual-list-viewport ${U.viewportClass||""}"
12509
- style="position: relative; height: ${F}px; width: 100%;">
12510
- ${L}
12747
+ style="position: relative; height: ${L}px; width: 100%;">
12748
+ ${F}
12511
12749
  </div>
12512
12750
  </div>
12513
12751
  <script data-virtual-list="${z}">
@@ -12570,7 +12808,7 @@ else {
12570
12808
  };
12571
12809
  })();
12572
12810
  </script>
12573
- `})}function gJ(){return`
12811
+ `})}function iJ(){return`
12574
12812
  .virtual-list-container {
12575
12813
  position: relative;
12576
12814
  overflow-y: auto;
@@ -12618,7 +12856,7 @@ else {
12618
12856
  0% { background-position: 200% 0; }
12619
12857
  100% { background-position: -200% 0; }
12620
12858
  }
12621
- `}function hJ($,Z){let Y=null,X=()=>{if(!Y)Y=Q9($(),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 dJ($,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 B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=G9(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12859
+ `}function nJ($,Z){let Y=null,X=()=>{if(!Y)Y=W9($(),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 oJ($,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 B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=U9(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12622
12860
  // Infinite scroll detection
12623
12861
  container.addEventListener('scroll', function() {
12624
12862
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -12636,10 +12874,10 @@ else {
12636
12874
  ${q}
12637
12875
  </div>
12638
12876
  </div>
12639
- `})}function mJ($,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)}`,j=Math.ceil(W.length/U.columns),_=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(j-1,B+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let A=V*U.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
12877
+ `})}function sJ($,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)}`,j=Math.ceil(W.length/U.columns),_=j*(U.rowHeight+(U.gap||0)),B=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,F=0,L=Math.min(j-1,B+H),O="";for(let V=F;V<=L;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,E)=>{if(typeof A==="object"&&A!==null)return String(A[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
12640
12878
  <div class="virtual-grid-item"
12641
- style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
12642
- data-index="${A}">
12879
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
12880
+ data-index="${R}">
12643
12881
  ${M}
12644
12882
  </div>`}return`
12645
12883
  <div id="${z}"
@@ -12706,7 +12944,7 @@ else {
12706
12944
  });
12707
12945
  })();
12708
12946
  </script>
12709
- `})}var R_;var lJ=k(()=>{R_={createVirtualList:Q9,processVirtualListDirectives:G9,processInfiniteListDirectives:dJ,processVirtualGridDirectives:mJ,generateVirtualListCSS:gJ,useVirtualList:hJ}});function pJ(){return`<script data-stx-hydration-runtime>
12947
+ `})}var P_;var aJ=k(()=>{P_={createVirtualList:W9,processVirtualListDirectives:U9,processInfiniteListDirectives:oJ,processVirtualGridDirectives:sJ,generateVirtualListCSS:iJ,useVirtualList:nJ}});function tJ(){return`<script data-stx-hydration-runtime>
12710
12948
  (function() {
12711
12949
  'use strict';
12712
12950
 
@@ -12866,7 +13104,7 @@ else {
12866
13104
  stxIslands.initIslands();
12867
13105
  }
12868
13106
  })();
12869
- </script>`}function cJ($){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 iJ($,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 XQ={};s(XQ,{processStaticDirectives:()=>ZQ,processPartialHydrationDirectives:()=>oJ,onHydrated:()=>$Q,isHydrated:()=>eJ,hydrateIsland:()=>rJ,hydrateByStrategy:()=>aJ,hydrateAll:()=>tJ,generatePartialHydrationCSS:()=>sJ,generateIslandManifest:()=>YQ,default:()=>b_,createIslandRegistry:()=>nJ});function nJ(){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 N_($){return`
13107
+ </script>`}function eJ($){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 $Q($,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 zQ={};s(zQ,{processStaticDirectives:()=>WQ,processPartialHydrationDirectives:()=>YQ,onHydrated:()=>qQ,isHydrated:()=>KQ,hydrateIsland:()=>JQ,hydrateByStrategy:()=>QQ,hydrateAll:()=>GQ,generatePartialHydrationCSS:()=>XQ,generateIslandManifest:()=>UQ,default:()=>m_,createIslandRegistry:()=>ZQ});function ZQ(){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 C_($){return`
12870
13108
  <script data-hydrate="${$}">
12871
13109
  (function() {
12872
13110
  const island = document.querySelector('[data-island="${$}"]');
@@ -12877,7 +13115,7 @@ else {
12877
13115
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
12878
13116
  })();
12879
13117
  </script>
12880
- `}function T_($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
13118
+ `}function v_($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
12881
13119
  <script data-hydrate="${$}">
12882
13120
  (function() {
12883
13121
  const island = document.querySelector('[data-island="${$}"]');
@@ -12913,7 +13151,7 @@ else {
12913
13151
  }
12914
13152
  })();
12915
13153
  </script>
12916
- `}function M_($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
13154
+ `}function x_($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
12917
13155
  <script data-hydrate="${$}">
12918
13156
  (function() {
12919
13157
  const island = document.querySelector('[data-island="${$}"]');
@@ -12946,7 +13184,7 @@ else {
12946
13184
  }
12947
13185
  })();
12948
13186
  </script>
12949
- `}function I_($,Z){let Y=Z.media||"(min-width: 768px)";return`
13187
+ `}function f_($,Z){let Y=Z.media||"(min-width: 768px)";return`
12950
13188
  <script data-hydrate="${$}">
12951
13189
  (function() {
12952
13190
  const island = document.querySelector('[data-island="${$}"]');
@@ -12975,7 +13213,7 @@ else {
12975
13213
  }
12976
13214
  })();
12977
13215
  </script>
12978
- `}function D_($){return`
13216
+ `}function g_($){return`
12979
13217
  <script data-hydrate="${$}">
12980
13218
  (function() {
12981
13219
  const island = document.querySelector('[data-island="${$}"]');
@@ -12997,7 +13235,7 @@ else {
12997
13235
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
12998
13236
  })();
12999
13237
  </script>
13000
- `}function E_($,Z){let Y=Z.event||"stx:activate";return`
13238
+ `}function h_($,Z){let Y=Z.event||"stx:activate";return`
13001
13239
  <script data-hydrate="${$}">
13002
13240
  (function() {
13003
13241
  const island = document.querySelector('[data-island="${$}"]');
@@ -13018,9 +13256,9 @@ else {
13018
13256
  });
13019
13257
  })();
13020
13258
  </script>
13021
- `}function oJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=E5(X,"load",Z),X=E5(X,"idle",Z),X=E5(X,"visible",Z),X=E5(X,"media",Z),X=k_(X),X=E5(X,"hover",Z),X=E5(X,"event",Z),Q=J&&X!==$,Q)X+=`
13022
- `+pJ();return X}function E5($,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=cJ(G.trim()),U=iJ(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 _=Object.keys(U).length>0?`
13023
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=N_(q);break;case"idle":B=T_(q,K);break;case"visible":B=M_(q,K);break;case"media":B=I_(q,K);break;case"hover":B=D_(q);break;case"event":B=E_(q,K);break}return`
13259
+ `}function YQ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=k5(X,"load",Z),X=k5(X,"idle",Z),X=k5(X,"visible",Z),X=k5(X,"media",Z),X=d_(X),X=k5(X,"hover",Z),X=k5(X,"event",Z),Q=J&&X!==$,Q)X+=`
13260
+ `+tJ();return X}function k5($,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((F)=>F.trim());for(let F of H){let[L,O]=F.split(":").map((V)=>V.trim());if(L&&O){let V=O.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=eJ(G.trim()),U=$Q(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 _=Object.keys(U).length>0?`
13261
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",B="";switch(Z){case"load":B=C_(q);break;case"idle":B=v_(q,K);break;case"visible":B=x_(q,K);break;case"media":B=f_(q,K);break;case"hover":B=g_(q);break;case"event":B=h_(q,K);break}return`
13024
13262
  <div data-island="${q}"
13025
13263
  data-strategy="${Z}"
13026
13264
  ${z.join(`
@@ -13030,7 +13268,7 @@ else {
13030
13268
  ${G.trim()}${_}
13031
13269
  </div>
13032
13270
  ${B}
13033
- `})}function k_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
13271
+ `})}function d_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
13034
13272
  <div data-island="${Q}"
13035
13273
  data-strategy="only"
13036
13274
  class="stx-island stx-client-only">
@@ -13049,7 +13287,7 @@ else {
13049
13287
  }
13050
13288
  })();
13051
13289
  </script>
13052
- `})}function sJ(){return`
13290
+ `})}function XQ(){return`
13053
13291
  /* Island base styles */
13054
13292
  .stx-island {
13055
13293
  display: contents;
@@ -13090,11 +13328,11 @@ else {
13090
13328
  .stx-island.hydrated {
13091
13329
  opacity: 1;
13092
13330
  }
13093
- `}function rJ($){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 aJ($){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 tJ(){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 eJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function $Q($){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 ZQ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function YQ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
13331
+ `}function JQ($){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 QQ($){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 GQ(){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 KQ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function qQ($){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 WQ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function UQ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
13094
13332
  <script type="application/json" id="stx-island-manifest">
13095
13333
  ${JSON.stringify(Z)}
13096
13334
  </script>
13097
- `}var b_;var JQ=k(()=>{b_={processPartialHydrationDirectives:oJ,processStaticDirectives:ZQ,generatePartialHydrationCSS:sJ,generateIslandManifest:YQ,createIslandRegistry:nJ,hydrateIsland:rJ,hydrateByStrategy:aJ,hydrateAll:tJ,isHydrated:eJ,onHydrated:$Q}});var HQ={};s(HQ,{watchMultiple:()=>WQ,watchEffect:()=>UQ,watch:()=>qQ,unref:()=>QQ,toRefs:()=>GQ,throttledComputed:()=>_Q,stxWatchMultiple:()=>WQ,stxWatchEffect:()=>UQ,stxWatch:()=>qQ,stxUnref:()=>QQ,stxToRefs:()=>GQ,stxThrottledComputed:()=>_Q,stxShallowRef:()=>KQ,stxRef:()=>k5,stxIsRef:()=>T1,stxDebouncedComputed:()=>BQ,stxComputed:()=>w$,shallowRef:()=>KQ,ref:()=>k5,processWatchDirectives:()=>jQ,processComputedDirectives:()=>zQ,isRef:()=>T1,default:()=>S_,debouncedComputed:()=>BQ,computed:()=>w$});function k5($){let Z=$,Y=new Set,X={get value(){if(Z1){let Q=V$.get(X);if(!Q)Q=new Set,V$.set(X,Q);Q.add(Z1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=V$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function T1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function QQ($){return T1($)?$.value:$}function GQ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=k5($[Y]);return Z}function KQ($){return k5($)}function w$($){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 j=z.value;q.forEach((_)=>_(j))}};function U(){K.clear();let j=Z1;Z1=W,_7.push(W);try{return Y()}finally{_7.pop(),Z1=j}}let z={get value(){if(Z1){let j=V$.get(z);if(!j)j=new Set,V$.set(z,j);j.add(Z1)}if(G){let j=U();if(!Q(J,j))J=j;G=!1}return J},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function qQ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(T1($))return Q?o1($.value):$.value;return $()},z=()=>{if(!q||W)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!Q)return;let H=()=>{if(Z(B,K),K=Q?o1(B):B,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(T1($))j=$.subscribe(()=>z());else j=w$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,j)j(),j=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function WQ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>T1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((j)=>T1(j)?j.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(T1(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 UQ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=Z1;Z1=G,_7.push(G);try{X=$()}finally{_7.pop(),Z1=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 zQ($,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 jQ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
13335
+ `}var m_;var jQ=k(()=>{m_={processPartialHydrationDirectives:YQ,processStaticDirectives:WQ,generatePartialHydrationCSS:XQ,generateIslandManifest:UQ,createIslandRegistry:ZQ,hydrateIsland:JQ,hydrateByStrategy:QQ,hydrateAll:GQ,isHydrated:KQ,onHydrated:qQ}});var NQ={};s(NQ,{watchMultiple:()=>FQ,watchEffect:()=>LQ,watch:()=>OQ,unref:()=>BQ,toRefs:()=>_Q,throttledComputed:()=>AQ,stxWatchMultiple:()=>FQ,stxWatchEffect:()=>LQ,stxWatch:()=>OQ,stxUnref:()=>BQ,stxToRefs:()=>_Q,stxThrottledComputed:()=>AQ,stxShallowRef:()=>HQ,stxRef:()=>b5,stxIsRef:()=>M1,stxDebouncedComputed:()=>RQ,stxComputed:()=>R$,shallowRef:()=>HQ,ref:()=>b5,processWatchDirectives:()=>wQ,processComputedDirectives:()=>VQ,isRef:()=>M1,default:()=>u_,debouncedComputed:()=>RQ,computed:()=>R$});function b5($){let Z=$,Y=new Set,X={get value(){if(Z1){let Q=w$.get(X);if(!Q)Q=new Set,w$.set(X,Q);Q.add(Z1)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=w$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function M1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function BQ($){return M1($)?$.value:$}function _Q($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=b5($[Y]);return Z}function HQ($){return b5($)}function R$($){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 j=z.value;q.forEach((_)=>_(j))}};function U(){K.clear();let j=Z1;Z1=W,F7.push(W);try{return Y()}finally{F7.pop(),Z1=j}}let z={get value(){if(Z1){let j=w$.get(z);if(!j)j=new Set,w$.set(z,j);j.add(Z1)}if(G){let j=U();if(!Q(J,j))J=j;G=!1}return J},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function OQ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(M1($))return Q?o1($.value):$.value;return $()},z=()=>{if(!q||W)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!Q)return;let H=()=>{if(Z(B,K),K=Q?o1(B):B,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(M1($))j=$.subscribe(()=>z());else j=R$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,j)j(),j=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function FQ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>M1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((j)=>M1(j)?j.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(M1(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 LQ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=Z1;Z1=G,F7.push(G);try{X=$()}finally{F7.pop(),Z1=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 VQ($,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 wQ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
13098
13336
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
13099
13337
  (function() {
13100
13338
  // Watch implementation for ${J}
@@ -13106,9 +13344,9 @@ else {
13106
13344
  }
13107
13345
  })();
13108
13346
  </script>
13109
- `})}function o1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>o1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(o1(Q),o1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(o1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=o1($[Y]);return Z}function BQ($,Z=100){let Y=k5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return w$($).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 _Q($,Z=100){let Y=k5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return w$($).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 Z1=null,_7,V$,S_;var OQ=k(()=>{_7=[],V$=new WeakMap;S_={ref:k5,computed:w$,watch:qQ,watchMultiple:WQ,watchEffect:UQ,isRef:T1,unref:QQ,toRefs:GQ,shallowRef:KQ,debouncedComputed:BQ,throttledComputed:_Q,processComputedDirectives:zQ,processWatchDirectives:jQ}});var wQ={};s(wQ,{v:()=>y_,processHasErrorsDirective:()=>VQ,processFormValidationDirectives:()=>C_,processErrorsDirective:()=>FQ,processErrorDirective:()=>LQ,defineForm:()=>P_,Validator:()=>b5});class b5{rules=[];defaultValue="";addRule($){let Z=new b5;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 b5;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 b5;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 P_($,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 j(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function B(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function LQ($,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(`
13110
- `)}catch{return""}})}function FQ($,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(`
13111
- `)}catch{return""}})}function VQ($,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 C_($,Z,Y){let X=$;return X=LQ(X,Z,Y),X=FQ(X,Z,Y),X=VQ(X,Z,Y),X}var y_;var AQ=k(()=>{y_=new b5});var TQ={};s(TQ,{processXElementDirectives:()=>v_,hasXElementDirectives:()=>NQ,generateXElementRuntime:()=>RQ});function RQ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13347
+ `})}function o1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>o1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(o1(Q),o1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(o1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=o1($[Y]);return Z}function RQ($,Z=100){let Y=b5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return R$($).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 AQ($,Z=100){let Y=b5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return R$($).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 Z1=null,F7,w$,u_;var MQ=k(()=>{F7=[],w$=new WeakMap;u_={ref:b5,computed:R$,watch:OQ,watchMultiple:FQ,watchEffect:LQ,isRef:M1,unref:BQ,toRefs:_Q,shallowRef:HQ,debouncedComputed:RQ,throttledComputed:AQ,processComputedDirectives:VQ,processWatchDirectives:wQ}});var EQ={};s(EQ,{v:()=>l_,processHasErrorsDirective:()=>DQ,processFormValidationDirectives:()=>c_,processErrorsDirective:()=>IQ,processErrorDirective:()=>TQ,defineForm:()=>p_,Validator:()=>S5});class S5{rules=[];defaultValue="";addRule($){let Z=new S5;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 S5;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 S5;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 p_($,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 j(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function B(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 F(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:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:F}}function TQ($,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(`
13348
+ `)}catch{return""}})}function IQ($,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(`
13349
+ `)}catch{return""}})}function DQ($,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 c_($,Z,Y){let X=$;return X=TQ(X,Z,Y),X=IQ(X,Z,Y),X=DQ(X,Z,Y),X}var l_;var kQ=k(()=>{l_=new S5});var yQ={};s(yQ,{processXElementDirectives:()=>i_,hasXElementDirectives:()=>SQ,generateXElementRuntime:()=>bQ});function bQ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13112
13350
  (function() {
13113
13351
  'use strict';
13114
13352
 
@@ -13392,45 +13630,45 @@ else {
13392
13630
  // Expose for manual initialization
13393
13631
  window.XElement = XElement;
13394
13632
  })();
13395
- </script>`}function NQ($){return/\bx-data(?:\s|=)/.test($)}function v_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!NQ(X))return X;let Q=Y[0]?.trim()||RQ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13633
+ </script>`}function SQ($){return/\bx-data(?:\s|=)/.test($)}function i_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!SQ(X))return X;let Q=Y[0]?.trim()||bQ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13396
13634
  `+X.slice(J);return X+`
13397
- `+Q}var MQ={};s(MQ,{rewriteImagesWithSiblings:()=>g_});import q1 from"path";async function g_($,Z){let Y=Z.formats??f_;if(!Z.publicDir)return $;let X=m_($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(u_(K.index,X))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let j=await h_(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${l_(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:B})}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 h_($,Z,Y){if(!d_($))return[];let X=q1.extname($).toLowerCase();if(!x_.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(j)=>{let _=q1.join(J,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:q1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function d_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function m_($){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 u_($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function l_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var x_,f_;var IQ=k(()=>{x_=new Set([".jpg",".jpeg",".png",".gif"]),f_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var bQ={};s(bQ,{validateClientScript:()=>j7,processOnceDirective:()=>z7,processJsonDirective:()=>U7,processDirectives:()=>w0,injectRouterScript:()=>jZ});import x0 from"path";import{deriveLayoutGroup as p_}from"stx-router/layout-metadata";function DQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c_($,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(`
13635
+ `+Q}var PQ={};s(PQ,{rewriteImagesWithSiblings:()=>s_});import q1 from"path";async function s_($,Z){let Y=Z.formats??o_;if(!Z.publicDir)return $;let X=t_($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(e_(K.index,X))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let j=await r_(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${$H(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:B})}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 r_($,Z,Y){if(!a_($))return[];let X=q1.extname($).toLowerCase();if(!n_.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(j)=>{let _=q1.join(J,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:q1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function a_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function t_($){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 e_($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function $H($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var n_,o_;var CQ=k(()=>{n_=new Set([".jpg",".jpeg",".png",".gif"]),o_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var gQ={};s(gQ,{validateClientScript:()=>H7,processOnceDirective:()=>_7,processJsonDirective:()=>B7,processDirectives:()=>w0,injectRouterScript:()=>OZ});import x0 from"path";import{deriveLayoutGroup as ZH}from"stx-router/layout-metadata";function vQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YH($,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(`
13398
13636
  `,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===`
13399
13637
  `){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]===`
13400
- `)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 H7($,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 EQ($){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 i_($){let Z=H7($,"data-stx-runtime");if(!Z)return $;let Y=EQ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=EQ(Q);if(J===-1)return X+`
13638
+ `)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 L7($,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 xQ($){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 XH($){let Z=L7($,"data-stx-runtime");if(!Z)return $;let Y=xQ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=xQ(Q);if(J===-1)return X+`
13401
13639
  `+Q;return Q.slice(0,J)+X+`
13402
- `+Q.slice(J)}async function w0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(J)K8(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!G$()&&!v4())&&Y&&Y.endsWith(".stx"))H6($,Y);try{return await b8.timeAsync("template-processing",async()=>{let G=await n_($,Z,Y,X,Q);if(J)G=Z9(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??f7(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let _=Z.__sections?.title,B=W.title||z||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
13403
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=$9(G);if(G=KJ(G,H,{...X.app?.colorMode&&{colorMode:X.app.colorMode}}),L)G=GJ(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=p_(V);G=G.replace("<head>",`<head>
13404
- <meta name="stx-layout" content="${DQ(V)}">
13405
- <meta name="stx-layout-group" content="${DQ(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=QJ(G);let K=X.app?.colorMode;if(K)G=XJ(G,K);G=i_(G)}if(J)try{let{getStoreScript:K}=await a("stx/store-loader",()=>Promise.resolve().then(() => (LJ(),OJ))),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=H7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13406
- `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await a("stx/composable-loader",()=>Promise.resolve().then(() => (wJ(),VJ))),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=H7(G,"data-stx-stores")||H7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13407
- `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await n2(G,void 0,X.buildMode==="serve");if(J)G=v8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof h4)throw G;let K=G instanceof Error?G.message:String(G),q=new m1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),p3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return u3.createFallbackContent("Template Processing",q)}}async function n_($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!x0.isAbsolute(X.partialsDir)?x0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!x0.isAbsolute(X.componentsDir)?x0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!x0.isAbsolute(X.layoutsDir)?x0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await r_(Y,Z),s_(Z,K),q=await _5(()=>uX(q,Z,Y,K),q,(O)=>{a0.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=t0(q,i5,(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)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=eX(q),q=await zJ(q,Y,Q);let _={};q=s6(q,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=x0.dirname(Y),N=K.layoutsDir?x0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=x0.join(A,"_layout.stx");if(await p(T)){w=T;break}let M=x0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=x0.isAbsolute(K.layoutsDir)?K.layoutsDir:x0.resolve(process.cwd(),K.layoutsDir),T=x0.join(R,`${K.defaultLayout}.stx`);if(await p(T))H=T}if(H&&!V)q=`@section('content')
13640
+ `+Q.slice(J)}async function w0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(J)z8(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!K$()&&!x4())&&Y&&Y.endsWith(".stx"))L6($,Y);try{return await C8.timeAsync("template-processing",async()=>{let G=await JH($,Z,Y,X,Q);if(J)G=Q9(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??d7(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let _=Z.__sections?.title,B=W.title||z||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
13641
+ `),...W.htmlAttrs&&{htmlAttrs:zJ(K.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},F=J9(G);if(G=HJ(G,H,{...X.app?.colorMode&&{colorMode:X.app.colorMode}}),F)G=_J(G,K),G=jJ(G,H.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let V=L[1],w=ZH(V);G=G.replace("<head>",`<head>
13642
+ <meta name="stx-layout" content="${vQ(V)}">
13643
+ <meta name="stx-layout-group" content="${vQ(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=BJ(G);let K=X.app?.colorMode;if(K)G=KJ(G,K);G=qJ(G),G=XH(G)}if(J)try{let{getStoreScript:K}=await a("stx/store-loader",()=>Promise.resolve().then(() => (TJ(),MJ))),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=L7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13644
+ `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await a("stx/composable-loader",()=>Promise.resolve().then(() => (EJ(),DJ))),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=L7(G,"data-stx-stores")||L7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13645
+ `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await a2(G,void 0,X.buildMode==="serve");if(J)G=h8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof d4)throw G;let K=G instanceof Error?G.message:String(G),q=new m1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),n3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return c3.createFallbackContent("Template Processing",q)}}async function JH($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!x0.isAbsolute(X.partialsDir)?x0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!x0.isAbsolute(X.componentsDir)?x0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!x0.isAbsolute(X.layoutsDir)?x0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await KH(Y,Z),GH(Z,K),q=await _5(()=>iX(q,Z,Y,K),q,(O)=>{a0.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=t0(q,n5,(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)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=XJ(q),q=await VJ(q,Y,Q);let _={};q=t6(q,_);let B={...Z.__sections||{}},H="",F=/@nolayout\b/.test(q);if(F)q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)H=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!F&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=x0.dirname(Y),A=K.layoutsDir?x0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=x0.join(R,"_layout.stx");if(await c(T)){w=T;break}let M=x0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=x0.isAbsolute(K.layoutsDir)?K.layoutsDir:x0.resolve(process.cwd(),K.layoutsDir),T=x0.join(N,`${K.defaultLayout}.stx`);if(await c(T))H=T}if(H&&!V)q=`@section('content')
13408
13646
  ${q.trim()}
13409
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return B[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=$0(w.trim(),Z);if(A===void 0)return O;return B[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))B[V]=w.replace("@parent",s1);else B[V]=w.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return B[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=r6(q,_),H){let O=[],V=B1(q),w=t0(V.output,X5,(A,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,N,R)=>{let T=N==="SCRIPT"?V.scripts[Number(R)]:w.tokens[Number(R)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
13647
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return B[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let R=$0(w.trim(),Z);if(R===void 0)return O;return B[V]=String(R??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))B[V]=w.replace("@parent",s1);else B[V]=w.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return B[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=e6(q,_),H){let O=[],V=B1(q),w=t0(V.output,X5,(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(`
13410
13648
  `);B.content=B.content?`${B.content}
13411
- ${A}`:A,Z.__sections=B}}if(H)try{let O;if(x0.isAbsolute(H))O=H,Q.add(H);else O=await _5(()=>Q3(H,Y,G,Q),null,()=>{throw new m1(`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(a0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new m1(T,Y);return q}let V=await _5(()=>Bun.file(O).text(),"",()=>{throw new m1(`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,(D,y,S)=>{return T[y]=S.trim(),""});for(let[D,y]of Object.entries(T))if(B[D]&&B[D].includes(s1)){let S=B[D].indexOf(s1);B[D]=B[D].slice(0,S)+y+B[D].slice(S+s1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${M}`;return await w0(E,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=s6(A,_),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(B[M]){let E=B[M];if(E.includes(s1)){let D=R[M]||"",y=E.indexOf(s1);E=E.slice(0,y)+D+E.slice(y+s1.length)}return E}return I||""}),N=o_(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=r6(N,_),Z.__originalFilePath=Y,q=await kQ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13412
- ${q}`,z(q)}catch(O){return a0.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 kQ(q,Z,Y,G,Q))}function o_($,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 s_($,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 r_($,Z){await _5(()=>nX($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function a_($,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 a("stx/variable-extractor",()=>Promise.resolve().then(() => (e5(),l$)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));a0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function t_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await a("stx/expressions",()=>Promise.resolve().then(() => (e0(),I8)));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return a0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function kQ($,Z,Y,X,Q){let J=$,G=X;if(await a_(J,Z,Y),J=await t_(J,Z,Y),J=await xX(J,Z,Y),J=await fX(J,Z,Y),J=await kY(J,Z,Y,G),J5(J))J=e7(J,Z),J=Z3(J,Z);J=$3(J);let{processStreamDirectives:K}=await a("stx/streaming",()=>Promise.resolve().then(() => (_6(),B6)));J=K(J,Z),J=c6(J,Z,Y,G),J=await Q7(J,Z,Y,G,Q),J=await ZJ(J,Z,Y,G,Q),J=g9(J,Z,Y,G);let{processDeferDirectives:q}=await a("stx/defer",()=>Promise.resolve().then(() => RJ));J=q(J,Z,Y);let{processTeleportDirectives:W}=await a("stx/teleport",()=>Promise.resolve().then(() => TJ));J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await a("stx/transitions",()=>Promise.resolve().then(() => EJ));J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:j}=await a("stx/error-boundaries",()=>Promise.resolve().then(() => bJ));J=j(J,Z,Y);let{processSuspenseDirectives:_}=await a("stx/suspense",()=>Promise.resolve().then(() => SJ));J=_(J,Z,Y);let{processAsyncDirectives:B}=await a("stx/async-components",()=>Promise.resolve().then(() => vJ));J=B(J,Z,Y);let{processKeepAliveDirectives:H}=await a("stx/keep-alive",()=>Promise.resolve().then(() => fJ));J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await a("stx/virtual-scrolling",()=>Promise.resolve().then(() => (lJ(),uJ)));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await a("stx/partial-hydration",()=>Promise.resolve().then(() => (JQ(),XQ)));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:A,processWatchDirectives:N}=await a("stx/computed",()=>Promise.resolve().then(() => (OQ(),HQ)));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:R}=await a("stx/forms-validation",()=>Promise.resolve().then(() => (AQ(),wQ)));J=R(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await a("stx/head",()=>Promise.resolve().then(() => (t5(),h7)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13413
- `;if(J=M(J,Z),J=I(J,Z),J=cX(J),J=$6(J,Z),J=DY(J),J=dX(J),J=await o6(J,Z,Y,G,Q),J=await Q7(J,Z,Y,G,Q),Z.__stxProcessingDepth===1)J=W8(J,Z);if(J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=Z9(J),J=p1(J,Z,Y),J=Z6(J,Z),J=Y6(J,Z),J=r4(J,Z),J=gY(J,Z),J=hY(J,Z),J=await HY(J,Z,Y,G),J=await IZ(J,Z,Y),J=await pY(J,Z,Y,G),J=S9(J,Z,Y,G),J=y2(J,Z,Y,G),J=P2(J,Z,Y),J=C2(J,Z,Y,G),J=TY(J,Z,Y,G),J=U7(J,Z),J=z7(J),J=BJ(J),!G.skipEventDirectives)J=qY(J,Z,Y);if(J=BY(J,Z,Y),G.debug){let i=/\bx-data\s*=/.test(J),Z0=Q4($);if(i&&Z0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13649
+ ${R}`:R,Z.__sections=B}}if(H)try{let O;if(x0.isAbsolute(H))O=H,Q.add(H);else O=await _5(()=>q3(H,Y,G,Q),null,()=>{throw new m1(`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(a0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new m1(T,Y);return q}let V=await _5(()=>Bun.file(O).text(),"",()=>{throw new m1(`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,(D,y,S)=>{return T[y]=S.trim(),""});for(let[D,y]of Object.entries(T))if(B[D]&&B[D].includes(s1)){let S=B[D].indexOf(s1);B[D]=B[D].slice(0,S)+y+B[D].slice(S+s1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${M}`;return await w0(E,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=t6(R,_),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(B[M]){let E=B[M];if(E.includes(s1)){let D=N[M]||"",y=E.indexOf(s1);E=E.slice(0,y)+D+E.slice(y+s1.length)}return E}return I||""}),A=QH(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=e6(A,_),Z.__originalFilePath=Y,q=await fQ(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13650
+ ${q}`,z(q)}catch(O){return a0.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 fQ(q,Z,Y,G,Q))}function QH($,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 GH($,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 KH($,Z){await _5(()=>aX($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function qH($,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 a("stx/variable-extractor",()=>Promise.resolve().then(() => ($$(),p$)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));a0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function WH($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await a("stx/expressions",()=>Promise.resolve().then(() => (e0(),b8)));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return a0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function fQ($,Z,Y,X,Q){let J=$,G=X;if(await qH(J,Z,Y),J=await WH(J,Z,Y),J=await dX(J,Z,Y),J=await mX(J,Z,Y),J=await PY(J,Z,Y,G),J5(J))J=Y3(J,Z),J=J3(J,Z);J=X3(J);let{processStreamDirectives:K}=await a("stx/streaming",()=>Promise.resolve().then(() => (F6(),O6)));J=K(J,Z),J=o6(J,Z,Y,G),J=await G7(J,Z,Y,G,Q),J=await QJ(J,Z,Y,G,Q),J=u9(J,Z,Y,G);let{processDeferDirectives:q}=await a("stx/defer",()=>Promise.resolve().then(() => bJ));J=q(J,Z,Y);let{processTeleportDirectives:W}=await a("stx/teleport",()=>Promise.resolve().then(() => yJ));J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await a("stx/transitions",()=>Promise.resolve().then(() => xJ));J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:j}=await a("stx/error-boundaries",()=>Promise.resolve().then(() => gJ));J=j(J,Z,Y);let{processSuspenseDirectives:_}=await a("stx/suspense",()=>Promise.resolve().then(() => hJ));J=_(J,Z,Y);let{processAsyncDirectives:B}=await a("stx/async-components",()=>Promise.resolve().then(() => lJ));J=B(J,Z,Y);let{processKeepAliveDirectives:H}=await a("stx/keep-alive",()=>Promise.resolve().then(() => cJ));J=H(J,Z,Y);let{processVirtualListDirectives:F,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await a("stx/virtual-scrolling",()=>Promise.resolve().then(() => (aJ(),rJ)));J=F(J,Z,Y),J=L(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await a("stx/partial-hydration",()=>Promise.resolve().then(() => (jQ(),zQ)));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await a("stx/computed",()=>Promise.resolve().then(() => (MQ(),NQ)));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>Promise.resolve().then(() => (kQ(),EQ)));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await a("stx/head",()=>Promise.resolve().then(() => (e5(),u7)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13651
+ `;if(J=M(J,Z),J=I(J,Z),J=sX(J),J=X6(J,Z),J=SY(J),J=pX(J),J=await a6(J,Z,Y,G,Q),J=await G7(J,Z,Y,G,Q),Z.__stxProcessingDepth===1)J=B8(J,Z);if(J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=Q9(J),J=p1(J,Z,Y),J=J6(J,Z),J=Q6(J,Z),J=a4(J,Z),J=uY(J,Z),J=lY(J,Z),J=await VY(J,Z,Y,G),J=await bZ(J,Z,Y),J=await oY(J,Z,Y,G),J=v9(J,Z,Y,G),J=x2(J,Z,Y,G),J=f2(J,Z,Y),J=g2(J,Z,Y,G),J=EY(J,Z,Y,G),J=B7(J,Z),J=_7(J),J=RJ(J),!G.skipEventDirectives)J=jY(J,Z,Y);if(J=FY(J,Z,Y),G.debug){let n=/\bx-data\s*=/.test(J),Z0=G4($);if(n&&Z0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13414
13652
  Both work on the same page, but they manage separate scopes.
13415
- Prefer signals (state/derived/effect) for new components.`)}J=rX(J,Z),J=await _1(J,Z,Y),J=_J(J),J=HJ(J),J=e2(J);let{processXElementDirectives:y}=await a("stx/x-element",()=>Promise.resolve().then(() => TQ));J=y(J);let S=Z.__originalFilePath||Y,b=l5(Z);if(J=await Y3(J,G,S,b),J=CY(J,Z),J=await lX(J,Z,Y,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await a("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (IQ(),MQ)));J=await Z0(J,{publicDir:i})}if(G.seo?.enabled)J=v2(J,Z,G);let v=(i,Z0,j0=!0)=>{if(!Z0)return i;let R0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),P=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&P){if(j0)i=i.replace(P[0],R0[0]);if(Z0=Z0.replace(R0[0],"").trim(),!Z0)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${Z0}
13416
- </head>`);if(/<head\b[^>]*>/i.test(i))return i.replace(/(<head\b[^>]*>)/i,`$1
13417
- ${Z0}`);if(/<html\b[^>]*>/i.test(i))return i.replace(/(<html\b[^>]*>)/i,`$1
13653
+ Prefer signals (state/derived/effect) for new components.`)}J=$J(J,Z),J=await _1(J,Z,Y),J=AJ(J),J=NJ(J),J=XY(J);let{processXElementDirectives:y}=await a("stx/x-element",()=>Promise.resolve().then(() => yQ));J=y(J);let S=Z.__originalFilePath||Y,b=p5(Z);if(J=await Q3(J,G,S,b),J=gY(J,Z),J=await nX(J,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await a("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (CQ(),PQ)));J=await Z0(J,{publicDir:n})}if(G.seo?.enabled)J=h2(J,Z,G);let v=(n,Z0,j0=!0)=>{if(!Z0)return n;let A0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),P=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&P){if(j0)n=n.replace(P[0],A0[0]);if(Z0=Z0.replace(A0[0],"").trim(),!Z0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${Z0}
13654
+ </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
13655
+ ${Z0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
13418
13656
  <head>
13419
13657
  ${Z0}
13420
- </head>`);return i},{renderHead:h,getHead:f}=await a("stx/head",()=>Promise.resolve().then(() => (t5(),h7))),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let i=h(r);if(i)J=v(J,i)}if(D.headContent)J=v(J,D.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=RY(J,G.csp,Z);if(G.analytics?.enabled)J=ZY(J,G);if(G.heatmap?.enabled)J=l9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:i}=await a("stx/pwa/inject",()=>Promise.resolve().then(() => (E$(),I9)));J=i(J,G)}let M0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),I0=/\bSTX\.\w+/.test(J),m0=/window\.STX\s*=/.test(J);if(M0&&I0&&!m0){let Z0=`<script data-stx-scoped>
13421
- ${s2()}
13658
+ </head>`);return n},{renderHead:h,getHead:f}=await a("stx/head",()=>Promise.resolve().then(() => (e5(),u7))),r=Z.__stx_runtime_head??f();if(r.title||r.meta?.length||r.link?.length){let n=h(r);if(n)J=v(J,n)}if(D.headContent)J=v(J,D.headContent,!r.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=IY(J,G.csp,Z);if(G.analytics?.enabled)J=QY(J,G);if(G.heatmap?.enabled)J=n9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await a("stx/pwa/inject",()=>Promise.resolve().then(() => (k$(),b9)));J=n(J,G)}let T0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),I0=/\bSTX\.\w+/.test(J),m0=/window\.STX\s*=/.test(J);if(T0&&I0&&!m0){let Z0=`<script data-stx-scoped>
13659
+ ${e2()}
13422
13660
  </script>`;if(J.includes("</head>")){let j0=J.indexOf("</head>"),P=J.slice(0,j0).indexOf("<script");if(P!==-1){let C=J.slice(0,P),x=J.slice(P);J=C+Z0+`
13423
13661
  `+x}else J=J.replace("</head>",`${Z0}
13424
13662
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
13425
13663
  ${Z0}`);else J=Z0+`
13426
- `+J}{let{scanScriptTags:i}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),G4))),Z0=[];for(let j0 of i(J)){if(!/\bserver\b/i.test(j0.attrs))continue;let R0=j0.start+j0.fullMatch.indexOf(">")+1,P=c_(J,R0);if(P===-1)continue;let C=P+9;while(C<J.length&&/\s/.test(J[C]))C++;Z0.push({start:j0.start,end:C})}for(let j0=Z0.length-1;j0>=0;j0--){let{start:R0,end:P}=Z0[j0];J=J.substring(0,R0)+J.substring(P)}}let Y0=h$(J,Y);if(Y0.hasScoped)J=Y0.html;let X0=Z.__stx_event_bindings||[],D0=!1,i0=[],W1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:a1}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),G4)));for(let i of a1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))i0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:j0}of i0){D0=!0;let R0=j0;j7(j0,Y,X.strict);let P=await p5(j0,{eventBindings:X0,attrs:Z0,hasColonDirectives:W1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(i,()=>P)}if(D0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=NY(J,Z.cspNonce);return J}var s1="<!--PARENT_CONTENT_PLACEHOLDER-->";var U4=k(()=>{o2();y1();N7();r2();$Y();YY();I7();T7();WY();c5();_Y();OY();n4();MY();EY();SY();vY();G1();t5();e0();dY();cY();vX();hX();i6();G3();pX();q5();iX();c3();F0();oX();aX();$J();YJ();v7();e6();qJ();X$();p6();jJ();Y9();X9();_0();O6();k7();h5();Y9();X9()});import XH from"fs";import K9 from"path";import dQ from"fs";import J1 from"path";var z9=[72,96,128,144,152,192,384,512],j9=[120,152,167,180],B9=[16,32];async function _9($,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=J1.isAbsolute(X.src)?X.src:J1.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=J1.resolve(Z,X.outputDir||"pwa-icons");try{dQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||z9,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
13427
- 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=J1.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=J1.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 j9){let O=J1.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=J1.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 B9){let F=J1.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 j=512,_=J1.join(J,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),H=j-B*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function KH($){let Z=$.sizes||z9,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 j9)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of B9)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function H9(){try{return await import("sharp"),!0}catch{return!1}}E$();function KG($,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 qG($){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 WG($){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 UG($){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 zG($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function jG($){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:KG(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=qG(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=WG($);if(W)q.share_target=W;let U=UG($);if(U)q.file_handlers=U;let z=zG($);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 D9($){let Z=jG($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function LH($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function FH($){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 SQ from"path";async function yQ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=SQ.isAbsolute(Z.page)?Z.page:SQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (U4(),bQ)),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 e_($)}function e_($){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>
13664
+ `+J}{let{scanScriptTags:n}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),K4))),Z0=[];for(let j0 of n(J)){if(!/\bserver\b/i.test(j0.attrs))continue;let A0=j0.start+j0.fullMatch.indexOf(">")+1,P=YH(J,A0);if(P===-1)continue;let C=P+9;while(C<J.length&&/\s/.test(J[C]))C++;Z0.push({start:j0.start,end:C})}for(let j0=Z0.length-1;j0>=0;j0--){let{start:A0,end:P}=Z0[j0];J=J.substring(0,A0)+J.substring(P)}}let Y0=d$(J,Y);if(Y0.hasScoped)J=Y0.html;let X0=Z.__stx_event_bindings||[],D0=!1,i0=[],W1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:a1}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),K4)));for(let n of a1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))i0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:Z0,content:j0}of i0){D0=!0;let A0=j0;H7(j0,Y,X.strict);let P=await c5(j0,{eventBindings:X0,attrs:Z0,hasColonDirectives:W1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(n,()=>P)}if(D0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=DY(J,Z.cspNonce);return J}var s1="<!--PARENT_CONTENT_PLACEHOLDER-->";var z4=k(()=>{t2();y1();I7();$Y();JY();GY();k7();D7();BY();i5();LY();wY();o4();kY();yY();vY();hY();G1();e5();e0();pY();sY();hX();lX();s6();W3();oX();q5();rX();o3();L0();tX();ZJ();JJ();GJ();g7();Y9();OJ();J$();n6();wJ();G9();K9();_0();V6();y7();d5();G9();K9()});import _H from"fs";import z9 from"path";import oQ from"fs";import J1 from"path";var H9=[72,96,128,144,152,192,384,512],O9=[120,152,167,180],F9=[16,32];async function L9($,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=J1.isAbsolute(X.src)?X.src:J1.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=J1.resolve(Z,X.outputDir||"pwa-icons");try{oQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||H9,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
13665
+ 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 F of G){let L=J1.join(J,`icon-${F}x${F}.png`);if(await W.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Y.generatedFiles.push(L),K){let O=J1.join(J,`icon-${F}x${F}.webp`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let L of O9){let O=J1.join(J,`apple-touch-icon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let F=J1.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(F),Y.generatedFiles.push(F)}for(let F of F9){let L=J1.join(J,`favicon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Y.generatedFiles.push(L)}let j=512,_=J1.join(J,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),H=j-B*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function LH($){let Z=$.sizes||H9,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 O9)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of F9)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function V9(){try{return await import("sharp"),!0}catch{return!1}}k$();function HG($,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 OG($){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 FG($){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 LG($){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 VG($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function wG($){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:HG(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=OG(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=FG($);if(W)q.share_target=W;let U=LG($);if(U)q.file_handlers=U;let z=VG($);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 S9($){let Z=wG($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function EH($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function kH($){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 hQ from"path";async function dQ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=hQ.isAbsolute(Z.page)?Z.page:hQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (z4(),gQ)),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 UH($)}function UH($){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>
13428
13666
  <html lang="en">
13429
13667
  <head>
13430
13668
  <meta charset="UTF-8">
13431
13669
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
13432
13670
  <meta name="theme-color" content="${J}">
13433
- <title>${O7(X)} - ${O7(G)}</title>
13671
+ <title>${V7(X)} - ${V7(G)}</title>
13434
13672
  <style>
13435
13673
  :root {
13436
13674
  --theme-color: ${J};
@@ -13600,8 +13838,8 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
13600
13838
  <circle cx="12" cy="20" r="1"/>
13601
13839
  </svg>
13602
13840
 
13603
- <h1>${O7(X)}</h1>
13604
- <p>${O7(Q)}</p>
13841
+ <h1>${V7(X)}</h1>
13842
+ <p>${V7(Q)}</p>
13605
13843
 
13606
13844
  <button class="retry-btn" onclick="window.location.reload()">
13607
13845
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -13657,9 +13895,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
13657
13895
  }, 5000);
13658
13896
  </script>
13659
13897
  </body>
13660
- </html>`}function O7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}y5();P5();import r1 from"fs";import L7 from"path";function $H($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function ZH($){let Z=[],Y=L7.join($,"manifest.json"),X=r1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(r1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=L7.join($,"sw.js"),J=r1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=L7.join($,"offline.html"),K=r1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=L7.join($,"pwa-icons");if(r1.existsSync(q)){let U=r1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function YH($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function eN($,Z){let Y=$H($),X=Z&&r1.existsSync(Z)?ZH(Z):[];return YH([...Y,...X])}function $T($){let Z=[];Z.push(`
13898
+ </html>`}function V7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}P5();C5();import r1 from"fs";import w7 from"path";function zH($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function jH($){let Z=[],Y=w7.join($,"manifest.json"),X=r1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(r1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=w7.join($,"sw.js"),J=r1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=w7.join($,"offline.html"),K=r1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=w7.join($,"pwa-icons");if(r1.existsSync(q)){let U=r1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function BH($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function jM($,Z){let Y=zH($),X=Z&&r1.existsSync(Z)?jH(Z):[];return BH([...Y,...X])}function BM($){let Z=[];Z.push(`
13661
13899
  === PWA Audit Report ===
13662
13900
  `);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}
13663
13901
  `);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(`
13664
13902
  ${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(`
13665
- `)}h3();E$();y5();P5();async function UT($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{XH.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=D9($);if(J){let G=K9.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 H9()){let G=await _9($,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 yQ($);if(J){let G=K9.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=I1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=I$($,Z);if(J){let G=$5($),K=K9.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 zT($,Z){return R7($,Z)}function jT($){return $.pwa?.enabled===!0}export{FH as validateManifest,eN as runPwaAudit,IF as registerPwaDirectives,aW as pwaUpdateDirective,eW as pwaPushDirective,tW as pwaOfflineDirective,rW as pwaInstallDirective,g3 as pwaDirectives,zT as processPwaHtml,LH as mergeManifestConfig,M9 as isWorkboxEnabled,H9 as isSharpAvailable,jT as isPwaEnabled,R7 as injectPwaTags,$5 as getServiceWorkerFileName,KH as getExpectedIconPaths,GG as generateThemeColorMeta,JG as generateSwRegistrationScript,XG as generateServiceWorkerAuto,I$ as generateServiceWorker,D$ as generatePwaTags,_9 as generatePwaIcons,M$ as generatePrecacheManifestJs,I1 as generatePrecacheManifest,yQ as generateOfflinePage,QG as generateManifestLink,D9 as generateManifestJson,jG as generateManifest,L9 as formatSize,$T as formatAuditResult,YH as calculateAuditResult,UT as buildPwaAssets,$H as auditConfig,ZH as auditBuildOutput,B9 as FAVICON_SIZES,z9 as DEFAULT_ICON_SIZES,j9 as APPLE_TOUCH_ICON_SIZES};
13903
+ `)}u3();k$();P5();C5();async function NM($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{_H.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=S9($);if(J){let G=z9.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 V9()){let G=await L9($,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 dQ($);if(J){let G=z9.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=I1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=D$($,Z);if(J){let G=$5($),K=z9.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 MM($,Z){return T7($,Z)}function TM($){return $.pwa?.enabled===!0}export{kH as validateManifest,jM as runPwaAudit,fL as registerPwaDirectives,QU as pwaUpdateDirective,KU as pwaPushDirective,GU as pwaOfflineDirective,JU as pwaInstallDirective,m3 as pwaDirectives,MM as processPwaHtml,EH as mergeManifestConfig,k9 as isWorkboxEnabled,V9 as isSharpAvailable,TM as isPwaEnabled,T7 as injectPwaTags,$5 as getServiceWorkerFileName,LH as getExpectedIconPaths,_G as generateThemeColorMeta,jG as generateSwRegistrationScript,zG as generateServiceWorkerAuto,D$ as generateServiceWorker,E$ as generatePwaTags,L9 as generatePwaIcons,I$ as generatePrecacheManifestJs,I1 as generatePrecacheManifest,dQ as generateOfflinePage,BG as generateManifestLink,S9 as generateManifestJson,wG as generateManifest,R9 as formatSize,BM as formatAuditResult,BH as calculateAuditResult,NM as buildPwaAssets,zH as auditConfig,jH as auditBuildOutput,F9 as FAVICON_SIZES,H9 as DEFAULT_ICON_SIZES,O9 as APPLE_TOUCH_ICON_SIZES};